Keep getting linker errors on Xcode 5.1 despite reverting to 32bit architectures only

随声附和 提交于 2019-12-12 13:20:06

问题


since I updated to Xcode 5.1, which changes the standard architectures to also include arm64, I keep getting the following error from the linker:

0  0x109157f93  __assert_rtn + 144
1  0x1091faed4  ld::passes::stubs::Pass::makeStub(ld::Atom const&, bool) + 0
2  0x1091fb5f7  ld::passes::stubs::Pass::process(ld::Internal&) + 497
3  0x1091fbc07  ld::passes::stubs::doPass(Options const&, ld::Internal&) + 111
4  0x109158b50  main + 772
5  0x7fff8568b5fd  start + 1
A linker snapshot was created at:
    /tmp/MyApp-2014-02-19-175731.ld-snapshot
ld: Assertion failed: (target != NULL), function stubableFixup, file /SourceCache/ld64/ld64-236.3/src/ld/passes/stubs/stubs.cpp, line 126.
clang: error: linker command failed with exit code 1 (use -v to see invocation)

given the fact that I use third party libraries which are compiled only for armv7, I tried to set the Architectures and Valid Architectures options to only include armv7, in both the Project's and the target's build settings, but I keep getting the error, even after cleaning... any idea?

Thank you!


回答1:


The solution (a workaround - rather), in my case, was to disable the Dead Code Stripping functionality in the Linking section of the Build Settings.

There seems to be a bug in Xcode 5.1 regarding this feature and the Link Time Optimization one (which I already had set to NO).

More info can be found here: https://devforums.apple.com/message/950372#950372

EDIT (2014-04-18):

The problem seems to be solved as of Xcode 5.1.1, as turning the Dead Code Stripping flag back to Yes no longer results in the linking error.




回答2:


I just had the same error message for one of my apps and the only thing that fixed it for me was to change Link-Time Optimizations to No.




回答3:


Just encountered the same error,

What you want to do is go to project build settings, and set 'Build Active Architecture Only' to NO for Debug as well as Release. . .

This would get you going :-)




回答4:


I hope this isn't too far afield of your question, but it's worth noting that you can keep old SDKs around to use after upgrading Xcode. It's not a bad idea to backup the contents of the following folders before an upgrade:

$(xcode-select --print-path)/Platforms/*/Developer/SDKs

The old SDKs can be copied back in after the upgrade. Obviously, it's better to use the latest SDK whenever possible, but sometimes deadlines and development realities make it necessary to continue with a working SDK until code can be re-worked.

This process can also be performed semi-automatically. Simply install the latest Xcode version in a new location (keeping the old version untouched) and link the existing SDKs with the following script:

platforms_path="$1/Contents/Developer/Platforms";
if [ -d $platforms_path ]; then
    for platform in `ls $platforms_path`
    do
        sudo ln -sf $platforms_path/$platform/Developer/SDKs/* $(xcode-select --print-path)/Platforms/$platform/Developer/SDKs;
    done;
fi;

You just need to supply it with the path to the old .app:

./xcode.sh /Applications/Xcode-463.app

More information in this question:

  • Is it possible to install iOS 6 SDK on Xcode 5?

You can find old versions of Xcode here:

  • https://developer.apple.com/downloads/index.action?name=Xcode


来源:https://stackoverflow.com/questions/22513294/keep-getting-linker-errors-on-xcode-5-1-despite-reverting-to-32bit-architectures

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!