facebookarchive / xcbuild

Xcode-compatible build tool.
Other
2k stars 190 forks source link

Linking fails for iOS simulator #298

Open mstorsjo opened 5 years ago

mstorsjo commented 5 years ago

Linking the final executable for iOS device builds works fine:

Ld /Users/martin/Library/Developer/Xcode/DerivedData/IosTestApp-dfkclgwfkpwytnaowvrqhruhakfm/Build/Products/Release-iphoneos/IosTestApp.app/IosTestApp normal arm64
    cd /Users/martin/code/IosTestApp
    export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
    export IPHONEOS_DEPLOYMENT_TARGET=12.1
    export PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec:/Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Tools:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/martin/.cargo/bin:/Users/martin/gem/bin:/opt/local/bin:/opt/local/sbin:/usr/local/texlive/2009/bin/universal-darwin:/Users/martin/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/texbin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/git/bin
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -filelist /Users/martin/Library/Developer/Xcode/DerivedData/IosTestApp-dfkclgwfkpwytnaowvrqhruhakfm/Build/Intermediates/IosTestApp.build/Release-iphoneos/IosTestApp.build/Objects-normal/arm64/IosTestApp.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-version-min=12.1 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/martin/Library/Developer/Xcode/DerivedData/IosTestApp-dfkclgwfkpwytnaowvrqhruhakfm/Build/Intermediates/IosTestApp.build/Release-iphoneos/IosTestApp.build/Objects-normal/arm64/IosTestApp_lto.o -fobjc-arc -fobjc-link-runtime -F/Users/martin/Library/Developer/Xcode/DerivedData/IosTestApp-dfkclgwfkpwytnaowvrqhruhakfm/Build/Products/Release-iphoneos -Xlinker -dependency_info -Xlinker /Users/martin/Library/Developer/Xcode/DerivedData/IosTestApp-dfkclgwfkpwytnaowvrqhruhakfm/Build/Intermediates/IosTestApp.build/Release-iphoneos/IosTestApp.build/Objects-normal/arm64/IosTestApp_dependency_info.dat -o /Users/martin/Library/Developer/Xcode/DerivedData/IosTestApp-dfkclgwfkpwytnaowvrqhruhakfm/Build/Products/Release-iphoneos/IosTestApp.app/IosTestApp

But when switching SDKs to a simulator build, linking fails like this:

    cd /Users/martin/code/IosTestApp
    export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
    export PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec:/Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Tools:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/martin/.cargo/bin:/Users/martin/gem/bin:/opt/local/bin:/opt/local/sbin:/usr/local/texlive/2009/bin/universal-darwin:/Users/martin/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/texbin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/git/bin
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -fobjc-arc -fobjc-link-runtime -F/Users/martin/Library/Developer/Xcode/DerivedData/IosTestApp-dfkclgwfkpwytnaowvrqhruhakfm/Build/Products/Release-iphonesimulator
clang: error: no input files

Thus, it's missing almost every command line option needed for linking. (It doesn't include the header corresponding to Ld /Users/martin/Library/Developer/Xcode/DerivedData/IosTestApp-dfkclgwfkpwytnaowvrqhruhakfm/Build/Products/Release-iphoneos/IosTestApp.app/IosTestApp normal arm64 either, so this might be an extra stray command that gets run before the actual linking.)