developer tip

종료 코드 1 (링커를 보려면 -v 사용), Xcode 8, Swift 3으로 링커 명령이 실패했습니다.

optionbox 2020. 8. 6. 08:16
반응형

종료 코드 1 (링커를 보려면 -v 사용), Xcode 8, Swift 3으로 링커 명령이 실패했습니다.


이 오류를 제거 할 수 없습니다!

파생 데이터 지우기 (환경 설정-> 위치-> 회색 화살표 클릭으로 Finder에서 파생 데이터 폴더 열기-> 마우스 오른쪽 버튼 클릭, 휴지통으로 이동), 프로젝트 정리 (CMD + Shift + K 또는 제품)와 같은 모든 종류의 시도를했습니다. -> 청소), 카르타고 및 종속성 업데이트, StackOverflow에 대한 다른 답변 (주로 빌드 설정 / 단계 조정)을 확인하고 github 등에서 앱을 복제했습니다.

공동 작업자 컴퓨터에서도 동일한 프로젝트가 작동합니다.

편집 : 현재 최상위 답변에서 조금 더 디버깅 할 수 있었지만 여전히 고칠 방법을 모르겠습니다. 프로젝트에 뭔가가 두 번있는 것 같습니다. 보고 두 번 나타나는 것을 찾을 수 없습니다!

로그 사진은 다음과 같습니다.


나는 오늘 xcode 8 버전 8.3.2에서 같은 문제에 직면했다.

이슈를 마우스 오른쪽 버튼으로 클릭-> 로그에 공개

여기에 이미지 설명을 입력하십시오

그 문제를 일으키는 원인을 확인할 수 있습니다

여기에 이미지 설명을 입력하십시오


아마도 포드 파일 을 설치했는데 여전히 .xcodeproj파일 대신 빌드하려고합니다..xcworkspace


나를 위해 일한 유일한 것은 달리기 pod deintegratepod install


당신은 청소를 시도 했습니까? cmd + shift + k


알았어 ... 그래서 내 문제를 해결 한 것은 ...

앱 델리게이트 파일에서 :

#import "AppDelegate.h"
#import "DarkSkyAPI.h"
//#import "Credentials.h"

내 프로젝트의 DarkSkyAPI.m 파일에 Credentials.h를 이미 가져 왔습니다. 추가 가져 오기를 주석 처리하면 오류가 사라졌습니다!

Some things to mention and maybe help anyone in the future. @umairqureshi_6's answer did help me along the process, but did not solve it. He led to where I was able to dig out the info. I kept seeing AppDelegate and DarkSkyAPI files showing up in the error log and the information it was pulling from Credentials file was causing the error. I knew it had to be in one of these 3 files, so I immediately checked imports, because I remembered hearing that the .h carries all the imports from its .m file. Boom!


I k now the question has already been answered. But if this helps somebody save some time : I had the same error. I checked everything to find a very small and stupid mistake from my side. I imported a core data ManagedObject custom file in a view controller of my project. I accidentally imported the .m file instead of the .h file which was causing the duplicate symbol in architecture error (linker command failed) because my .m file of properties class imports the .h file of core data class and hence causing duplicate import.

So just check if u have imported the right files before you try multiple solutions.!


A lot of solutions are mentioned above. No one worked for me(but please try above first).

Select Project -> Select Target -> Linked Framework and Libraries -> Add all pod libraries . (remove if they exist in embedded binaries)

Now remove these from Framework Folder in left file explorer of xcode.

This solved my issue.


Select the project-> Build Phase->Link Binary with libraries and add all pod libraries.


I had the same problem using Carthage for dependencies.

Just go to Select Project -> Build Settings -> Search for Enable Bitcode -> If it is selected to Yes, select No.

That solved this problem for me.


I had same problem.

The cause was that I declared same global variable in 2 files. So it was showing same error saying 2 duplicate symbols.

The solution was to remove those variables.


For any one having this issue with Flurry framework. This is what fixed my issue. For me the issue was that i had imported the following files but never used them. "libFlurryTVOS_9.2.3" "libFlurryWatch_9.2.3"

So all I had to do was go to project target settings and remove these 2 files from the "Linked framework and libraries" section and the problem was solved.


Make sure the Find Implicit Dependencies checkbox is checked.

(Product -> Scheme -> Edit Scheme -> Build -> Find Implicit Dependencies)


I just had to do import Foundation!

I was using Kitura for Swift server side and kept forgetting this!


Here is my problem and solution:

I removed two files from the source code using source tree(Version controller). After applying the diff, that contains the two classes I removed, Xcode didn't add it automatically. So I got linker error.

I manually added the files, by right click on group name and select "Add files to ". Now my error got resolved.

If anyone faced the linker error regarding class file, then try to add it manually.


Did not have this problem when I built and ran on my own device. Only had this problem with simulators. I just simply restarted my computer and ran it. It worked.


In my case the reason of the error is library which was linked two times.

I use react-native so it was linked automatically using react-native link and manually in xcode.


In my case I have change the Target name in my Podfile So it's create the same Error for me.

Solution

Just go project-> Build Phase->Link Binary with libraries Remove the old FrameWorks by click on minus button(-) And clean and Run again. It's work me.

여기에 이미지 설명을 입력하십시오

Remove Unwanted .framework.


The other answers didn't work for me so here I share my solution in case it might help somebody else:

My problem was that I was configuring the Podfile of my XCode-Project for the wrong platform. Changing "platform :ios" at the beginning of my Podfile to "platform :macos" worked for me to get rid of the error.


I was testing the Sparkle framework with CocoaPods.

Sadly, I put "pod 'Sparkle', '~> 1.21'" in the PodFile in the wrong place. I put it underneath Testing (for unit tests).

Once placed in correct spot in PodFile, everything's fine.


I had the same problem. If you are checking out any github project, then instead of using git clone, use git lfs clone, as sometimes, some large files are not properly cloned by using git only. Also, make sure your bitcode is disabled.


For me, the gem lock file was specifying an older version of cocoapods than the one I had installed. I had to re-branch and run bundle exec pod install instead of pod install


It seems like the issue is different for most of us, and the error message has decent info. In my case, the Deployment Target was set to 10.13 by the export MACOSX_DEPLOYMENT_TARGET=10.13 line, but I was running 10.14. So I had to switch my Deployment Target to 10.14 in General > Deployment Info, in order for the ITLibrary-related symbols to be available again.

cd /Users/foo/src/scrobble/macos/itunes-scrobble
    export MACOSX_DEPLOYMENT_TARGET=10.13

... SNIP ...

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_ITLibMediaItem", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_ITLibPlaylist", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_ITLibrary", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I got the same issues while making a build of Ionic 1 project.

I was able to solve the issue after deleting the file CDVLogger.h & CDVLogger.m


Ok, I had the same problem just today and started googling it, when I came across this thread. I haven't finished reading the question when the answer struck my mind: I declared a class with an empty constructor

class MyClass{
    MyClass();

    void func_one(){
    // code
    }

    void func_two(){
    // code
    }

    ~MyClass(){
        cout << "Deleting object" << endl;
     }
};

Then I thought why not terminating (not sure if I'm correct with word selection here, but who cares) the constructor of my class with curly braces ({}). So I did:

class MyClass{
    MyClass(){}

    void func_one(){
    // code
    }

    void func_two(){
    // code
    }

    ~MyClass(){
        cout << "Deleting object" << endl;
     }
};

The problem eliminated, my code started working perfectly.

I know, the good practice is to investigate the issue and find the real cause, but this worked for me.

참고URL : https://stackoverflow.com/questions/43795385/linker-command-failed-with-exit-code-1-use-v-to-see-invocation-xcode-8-swif

반응형