After update to Xcode 5 - ld: symbol(s) not found for architecture armv7 or armv7s linker error

后端 未结 7 1272
无人及你
无人及你 2020-12-04 06:27

I just updated my iPhone 4S software to iOS 7 Beta 2 while I was in the middle of putting the final touches on a new app (Phonegap).. not a good idea!

After it was d

相关标签:
7条回答
  • 2020-12-04 06:52

    njtman had a correct answer. I don't have the rep to comment so I am adding more details.

    You need a iOS 7 SDK to use the standard architectures (armv7,armv7s).

    My project was defaulting to (armv7), not including armv7s.

    To fix this, Open CordovaLib.xcodeproj, Under Build Settings (one of the menus in the top row, centered alignment) Under architectures, Architectures, Debug and Release, ADD iOS 7.0 using Standard architectures.

    0 讨论(0)
  • 2020-12-04 06:53

    I am using Xcode 5 so iOS SDK 7. The solution which worked for me was simply to remove the arm64 architecture.

    Select the project target (NOT CordovaLib.xcodeproj) and in the build settings>Valid Architectures, remove arm64 if it's there in the list. Here is mine after I remove arm64 architecture.

    enter image description here

    0 讨论(0)
  • 2020-12-04 06:54

    Because my lib.a is for only armv7

    what i did was

    Active Architecture Only = yes

    buildSettings = {
                    ALWAYS_SEARCH_USER_PATHS = NO;
                    "ARCHS[sdk=iphoneos*]" = (
                        armv7s,
                        armv7,
                    );
                    "ARCHS[sdk=iphoneos6.*]" = (
                        armv7s,
                        armv7,
                    );
                    "ARCHS[sdk=iphoneos7.*]" = (
                        armv7,
                        armv7s,
                    );
    

    it was build and archived fine

    hope it helps

    0 讨论(0)
  • 2020-12-04 07:01

    Short answer:

    • Remove Build Active Architecture Only (build setting parameter key is 'ONLY_ACTIVE_ARCH') from all of your static libraries' project build settings or overwrite it with 'NO' like in the screenshot below: Overwrite 'Build Active Architecture Only' to 'NO' or delete it's entry completely to fallback to iOS Default

    Detailed answer:

    The problem is that your static library 'libCordova.a' which you're linking in your main app is only compiled for one architecture (armv7, but not armv7s).

    You've probably let Xcode perform all the recommended changes for your static libraries project without reading what these changes actually are. Speaking for myself, I've never bothered to take a closer look at that info dialog (screenshot below), when I switched over to a new version of Xcode -- until now. enter image description here

    The problem is that performing these changes activates for debug builds a new feature called Build Active Architecture Only (build setting parameter key is 'ONLY_ACTIVE_ARCH'). In principle, this is a very cool enhancement of Xcode, because setting this to YES leads to faster building times, as Xcode only compiles the architecture of the connected device you've currently selected at the top when you hit the run button.

    However, when blindly accepting this new parameter in a static library, you may run into this bug. The bug occurs when you've built the debug version of a static library while having connected an armv7 device, and then, when you're debugging your main application, you've connected an armv7s device (or vice versa). Subsequently you'll get the error above (or a similar one).

    So my recommendation is to completely remove the value at project level for Build Active Architecture Only from all of your static libraries' project build settings. Because if you take a look at the iOS default, it is NO. Of course you can also overwrite the setting to 'NO' to be sure the setting is correct even if in the future the default value will change (cf. 1st screenshot).

    0 讨论(0)
  • 2020-12-04 07:05

    If your project was built using Cordova 2.x and Xcode 4.x, and you are receiving the error mentioned by the OP, this solution worked for me. (I was experiencing the error with Cordova 2.5 and Xcode 5).

    https://issues.apache.org/jira/browse/CB-3768

    Go to your Cordova Project

    Root Folder -> CordovaLib -> Right Click CordovaLib.xcodeproj -> Show Package Contents -> Open project.pbxproj

    Replace all occurrences of (I had 4)

    buildSettings = {
        ALWAYS_SEARCH_USER_PATHS = NO;//in 2 out of 4 occurrences
        "ARCHS[sdk=iphoneos*]" = armv7;
        "ARCHS[sdk=iphoneos6.*]" = (
            armv7,
            armv7s,
        );
            /* other settings here */
    };
    

    With this

    buildSettings = {
        ALWAYS_SEARCH_USER_PATHS = NO;//in 2 out of 4 occurrences
        "ARCHS[sdk=iphoneos*]" = armv7;
        "ARCHS[sdk=iphoneos7.*]" = (
            armv7,
            armv7s,
        );
        "ARCHS[sdk=iphoneos6.*]" = (
            armv7,
            armv7s,
        );
        /* other settings here */
    };
    

    Now your project will build fine!

    0 讨论(0)
  • 2020-12-04 07:06

    I have removed armv7s from valid architectures section and it worked for me.

    Build Settings --> Architectures --> Valid Architectures

    Xcode Build Settings

    0 讨论(0)
提交回复
热议问题