IT story

"0이 아닌 종료 코드로 인해 명령 실패"로 빌드 실패

hot-time 2021. 1. 5. 19:15
반응형

"0이 아닌 종료 코드로 인해 명령 실패"로 빌드 실패


Xcode로 앱을 빌드하려고하면 오류가 발생하여 빌드 프로세스가 중단됩니다.

CompileStoryboard0이 아닌 종료 코드로 인해 명령이 실패했습니다.

때로는 대신 다음 오류가 표시됩니다.

CompileSwift0이 아닌 종료 코드로 인해 명령이 실패했습니다.

나는이 새로운 빌드 시스템이 켜져.

이 문제를 해결하려면 어떻게해야합니까?


컴파일러가 "중요한"작업 중일 때 프로젝트 빌드를 중지하면이 오류가 나타날 수 있습니다. 이 경우 프로젝트를 다시 빌드하고 정상적으로 완료하면이 오류가 사라집니다.


나를 위해 Xcode를 닫아도 효과가 없었습니다. 대신 CommandShiftK.


또 다른 이유를 찾았습니다. 제가 제거한 다른 스토리 보드에 대한 스토리 보드 참조가있었습니다. 빠른 수정으로 이것을 삭제했습니다.

여기에 이미지 설명 입력


이것은 Swift 4.2 및 Xcode 10의 알려진 문제입니다. 여기에서 문제를 해결 한 기사를 찾았습니다. https://github.com/Yummypets/YPImagePicker/issues/236

간단히 말해 프로젝트 빌드 설정으로 이동하여 SWIFT_ENABLE_BATCH_MODE라는 사용자 정의 설정을 추가하고 해당 값을 NO로 설정합니다.

이전에는 여기에서 제안 된 각 방법 (재 구축, Xcode 종료, 정리 및 재 구축, 파생 데이터 파일 제거)을 시도했습니다. 그들 중 누구도 일하지 않았습니다.

기사에 따라 사용자 정의 빌드 설정을 추가하면 Swift가 진정한 오류를 알려주었습니다. 제 경우에는} 누락되었지만 여러 문제가있을 수 있습니다.


나는 또한 xcode 10에서 동일한 문제에 직면하고 제공된 모든 솔루션을 시도했지만 아무것도 작동하지 않았습니다.

그런 다음 다음 폴더의 모든 파일과 폴더를 삭제했습니다.

/Users/meenakrishna/Library/Developer/Xcode/DerivedData

그리고 그것은 매력처럼 작동했습니다.


이 오류는 NSManagedObject 하위 클래스를 만들기 전에 엔터티 속성을 변경하는 것을 잊었을 때 발생했습니다. 해결 방법 :

  1. 삭제 Entity+CoreDataClass.swiftEntity+CoreDataProperties.swift.
  2. 엔티티 모델 검사기의 "클래스"에서 "모듈"을로 Current Product Module, "코드 겐"을로 변경 Manual/None합니다.
  3. NSManagedObject를 다시 만듭니다.

영상


오류가 발생 Command LinkStoryboards failed with a nonzero exit code하여 존재하지 않는 스토리 보드에 대한 외부 스토리 보드 참조를 사용하고 있음을 발견했습니다. 최근에 스토리 보드 파일의 이름을 변경 했으므로 참조를 '이전'이름에서 '새'이름으로 변경하면 문제가 해결되었습니다.
저와 똑같은 오류가 없을 수도 있지만 오류에 대한 자세한 설명을 찾는 쉬운 방법은 다음과 같습니다.

  • 이슈 탐색기 표시 (빌드 시간 오류가 표시되는 동안)
  • 오류를 클릭하십시오. 이슈 탐색기에서 오류를 클릭합니다.
  • 그런 다음 오류에 대한 자세한 내용을 볼 수 있습니다. 0이 아닌 종료 코드로 인해 명령 LinkStoryboards가 실패했습니다.


이게 도움이 되길 바란다. 제발,이 질문과 다른 오류의 경험에서 대답하고 있음을 알고 있지만이 조언이 비슷한 문제를 해결하는 데 도움이 될 것이라고 믿습니다!


두 개 이상의 대상에 동일한 이름의 파일이있는 여러 대상이있는 경우 파일 검사기에서 해당 파일의 대상 구성원을 확인하십시오. 동일한 이름의 파일의 여러 인스턴스가 동일한 대상에 대한 대상 구성원을 설정 한 경우 오류가 발생합니다.


레거시 빌드 시스템으로 전환하면 문제가 해결되었습니다.


프로젝트를 Swift 4에서 5로 업그레이드 할 때이 오류가 발생했습니다. 먼저 모든 포드를 최신 버전으로 업데이트했습니다. 내가 빌드 할 때 일부 포드에이 오류가 표시되었습니다.

다음 단계를 통해이 문제가 해결되었습니다.

  1. 에서 모든 포드를 제거했습니다. Podfile
  2. Executed pod install to remove all installed pods
  3. Executed pod deintegrate to remove support for CocoaPods
  4. Deleted Podfile.lock and .xcworkspace from my project so no CocoaPods anymore
  5. Now my project is a pure Xcode project
  6. Opened my project from the regular .xcodeproj file
  7. Changed Swift Version of my project to Swift 5
  8. Cleaned the project (cmd+shift+K)
  9. Quitted Xcode
  10. Restored all pods to my Podfile
  11. Executed pod install to reintegrate CocoaPods and add my pods
  12. Opened the project from the .xcworkspace file
  13. Cleaned and rebuilt
  14. Some old pods that were still using Swift 4.0 (SlideMenuControllerSwift in my case) were set to Swift 5.0, caused many build errors in their code. I corrected it back to Swift 4.0 by opening the Pods project and selecting its target.
  15. Cleaned again, rebuilt.

Now I have only errors in my own project code related with difference in Swift version I made. My job now is to fix them.


In my case, I was clean build folder then restart my mac then it's work.


In my case, I used too complicated initializations inside a class extension. It suddenly broke my build.

class MyClass { }
extension MyClass {
static var  var1 = "", var2 = "", var3 = "", var4 = "", ...., var20 = ""
}

Resolved:

class MyClass { }
    extension MyClass {
    static var var1 = "",
    static var var2 = "",
    static var var3 = ""
    static var var4 = "", ...., 
    static var var20 = ""
    }

In my case it was empty assets catalog, when I delete it everything was fine again.


Command CompileSwift failed with a nonzero exit code

This error happens when you are migrating your code from Xcode 9 to Xcode 10+. It due to any class name is conflicting with existing apple classes. For Example: State, Event etc.

  1. So first change the class/structure name if any existing in your code like "State" to "StateDetail"

  2. If Info.plist is added in target, remove tick mark from it so it will not copy app bundle (Latest Xcode10 security reason).

    • Select Info.plist file and uncheck under "Target Membership" in right side Identity inspector

And build code again!!!


Since this issue looks to have dozens of possible solutions and the root cause could be very vague, I'll throw my situation into the ring. Half of my pods were failing with some sort of CompileSwiftSource failure, but only on archive. I was still able to build for device and simulator just fine. I tried a lot (if not all) of the solutions suggested here with no luck. One of the pods had a slightly different error before the CompileSwiftSource error so I went to updating and trying to fix that single pod. It was the Cache library for iOS which hadn't been updated in a while. There was a fork that resolved the issue with updating to Xcode 10.2 that I was able to update to and after that, all of the other issues took care of themselves. So look for a single outlier in your pods if you're getting a bunch of them erroring out and start there.


I had the JSONwebtoken pod installed and that was causing issues. I needed to delete the CommonCrypto folder that is in the JSONWebtoken pod folder. Here is a ->link<- explaining the issue. This started happening in Xcode 10.


In my case, the problem was that I assigned a .swift class to the viewController in the storyboard, while the project was Objective C.


I have the issue like that and my solution is change a little thing in Build Settings:

SWIFT_COMPILATION_MODE = singlefile;
SWIFT_OPTIMIZATION_LEVEL = "-O";

it work to me


If you are facing an error like that on new MacOS version.

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

It means that you need to install XCode command line, open a Terminal and run this command:

$ xcode-select --install


In my case it was renaming a file to an existing file in other folder(Group) by mistake, just rename it to what it was then the error disappeared


The targets should be specified with related data such as appicon


For me the problem was that on my Podfile I didn't put use_frameworks!. I just uncomment that line, run pod install on the terminal again. And it got fixed.

It was commented since the app was entirely made on Objective-C. Since the app now uses Swift I had to make that change on the Podfile


I had the same error Restarting Xcode and Recompiling Fixed the issue for me.


I tried a lot of the options discussed here.

  • Delete and reinstall pods
  • Clean Build Folder
  • Delete Derived Data
  • Add SWIFT_ENABLE_BATCH_MODE and set its value to NO
  • Restarting Xcode and Recompiling
  • Restarting iMac and Recompiling
  • set Compilation Mode to Incremental
  • Changed build settings: SWIFT_COMPILATION_MODE = singlefile and SWIFT_OPTIMIZATION_LEVEL = "-O"

Nothing worked. I'm using Xcode Version 11.0 beta (11M336w).

Finally I downloaded a fresh copy and replaced the one I had previously installed. It was the same exact version. That did the trick.


What helped to me is to set Compilation Mode to Incremental for all configurations in Target's Build Settings. With Whole module compilation mode I got errors. But this setting made project build slower.


Alright, I was having the same problem with Xcode 10. I usually use a storyboard for every view, that way if someone is helping it's easier to fold code in. I needed to make one of the view on one storyboard the initial view Controller.


What was causing these errors for me (I was getting 8+ for some of my cocoapods) was fixing any runtime build issues in all the pods.


I have faced similar problem. I have done

  • clean project - didn't work
  • Remove Derived Data Folder - didn't work
  • Change build system to Legacy Build Settings - didn't work
  • Restart XCode - didn't work
  • Comment some of my code, a typedef NS_ENUM in .h file and enums related works. Build the system and build success shown. Next un-comment the code and build again - Magically works

I got this error while trying to run my unit tests in a submodule. What I have done is Change the simulator => Clean the project => Build the project => Run unit tests . After this my unit tests runs without any issue.


별도의 스토리 보드를 연결할 때 동일한 오류가 발생합니다. "명령 CompileSwiftSources가 0이 아닌 종료 코드로 인해 실패했습니다."오류 '초기 뷰 컨트롤러'로 연결하고있는 두 번째 스토리 보드 안에 뷰 컨트롤러를 설정하는 것을 잊었 기 때문에 표시됩니다.


제 경우에는 Location이라는 파일을 갖는 것이 었습니다. 약간의 파헤 치기 후에 나는 그것이 같은 이름 (이상한)을 가진 두 개의 파일을 가지고 있다는 것을 알게되었다. 그러나 나는 파일을 제거하고 다른 이름을 가진 다른 파일을 추가하여 해결되지 않았습니다.

filenames are used to distinguish private declarations with the same name

참조 URL : https://stackoverflow.com/questions/46690619/build-fails-with-command-failed-with-a-nonzero-exit-code

반응형