문제 설명
Swift 패키지 관리자: 소프트웨어 업데이트 후 정적 빌드 실패 (Swift Package manager : static build failing after software updates)
문제 설명
Xcode를 업데이트한 후 작업 중인 프로젝트 중 하나가 빌드되지 않습니다. 나는 swift build(Xcode가 아님)로 실행 파일을 빌드하고 있습니다.
Details
실패한 명령은 다음과 같습니다. swift build ‑ Xswiftc ‑static‑stdlib ‑Xswiftc ‑DDEBUG
정적 빌드를 만들려고 합니다. swift build
를 시도하면 작동합니다.
오류
오류 출력의 시작 부분만 복사합니다. (나머지는 너무 깁니다):
ld: warning: directory not found for option '‑L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift_static/macosx'
ld: warning: Could not find auto‑linked library 'swiftFoundation'
ld: warning: Could not find auto‑linked library 'swiftDarwin'
ld: warning: Could not find auto‑linked library 'swiftCoreFoundation'
ld: warning: Could not find auto‑linked library 'swiftIOKit'
ld: warning: Could not find auto‑linked library 'swiftQuartzCore'
ld: warning: Could not find auto‑linked library 'swiftCore'
ld: warning: Could not find auto‑linked library 'swiftCoreGraphics'
ld: warning: Could not find auto‑linked library 'swiftObjectiveC'
ld: warning: Could not find auto‑linked library 'swiftDispatch'
ld: warning: Could not find auto‑linked library 'swiftCoreData'
ld: warning: Could not find auto‑linked library 'swiftSwiftOnoneSupport'
ld: warning: Could not find auto‑linked library 'swiftXPC'
ld: warning: Could not find auto‑linked library 'swiftMetal'
ld: warning: Could not find auto‑linked library 'swiftAppKit'
ld: warning: Could not find auto‑linked library 'swiftCoreImage'
Undefined symbols for architecture x86_64:
Package.swift
참고로
참조 솔루션
방법 1:
Swift 5.0 doesn't support static linking on Apple platforms anymore because of ABI stability. So the build should work if you remove ‑Xswiftc ‑static‑stdlib
and the code is valid Swift 5.0.
방법 2:
Static building isn't supported on new versions of MacOS. See answer here :
https://forums.swift.org/t/swift‑package‑manager‑static‑build‑failing‑after‑software‑updates/25694