Xcode4 Linking Problem. File was built for archive which is not the architecture being linked (arm6)

后端 未结 17 1354
别那么骄傲
别那么骄傲 2020-12-07 14:05

Recently, I switched to Xcode4 and when I compile my project I got following error.

ld: warning: ignoring file /Users/myname/Library/Developer/Xcode/DerivedD         


        
相关标签:
17条回答
  • This solved the problem for me:

    Some external library like three20 did extra settings for

    Build Settings->Architectures->Any iOS SDK

    the value is "armv6 armv7" that different from standard "armv7 armv7s"

    drop down and select "Standard", it worked for me.

    0 讨论(0)
  • 2020-12-07 14:24

    Had the same problem, and tried diverse solutions from the page to no avail. I still had a message telling me my library was not build for arm64.

    Finally how I resolved it :

    • opened the project.pbxproj for the library in a text editor
    • searched for VALID_ARCHS
    • there were 4 occurrences, 2 of which did not contain arm64
    • I manually added arm64 in the chain (VALID_ARCHS = "arm64 i386 armv7 armv7s")
    • rebuild the lib and it was all right

    Seems sometimes the build settings displayed by XCode is incomplete, and doesn't correspond precisely to the make file.

    0 讨论(0)
  • 2020-12-07 14:26

    I tried all the options above and none worked.

    This is the right answer:

    simply dragging a framework in your project won't link it properly (or something along these lines, in any case)

    what you need to do is select the framework you want to add in Build Phases (click on your project's blue icon, then select your project's name under Targets, then the tab Build Phases), see here for more reference.

    0 讨论(0)
  • 2020-12-07 14:28

    Make sure the build variants on your projects are set to "normal".

    If you are building a project which includes other projects, take a look inside the DerivedData folder for the main project. Examine the archive files with the "lipo -info yourarchive.a". Also, examine the timestamps on these archives. You may find that these libraries are not getting rebuilt or you are trying to link against an old version of the archive which is the wrong architecture.

    In my case, I shutdown Xcode and deleted the DerivedData folder for my main project. This forced a full rebuild when I reopened the main project in Xcode 4. The full rebuild caused the i386 archives to be created (or the correct version to be found) & the simulator version to link correctly.

    0 讨论(0)
  • 2020-12-07 14:28

    If I get the ignore file warning - I would run lipo -info on ignored file to find it's architecture as below

    lipo -info libTapkuLibrary.a
    

    That would print either of i386, armv6, armv7, armv7s, x86_64 etc. In general, that architecture has to match with your target build platform. E.g.

    • i386 = ios simulator or 32 bit build on mac os x
    • armv6 armv7 arm7s = ios device
    • x86_64 = 64 bit build on mac os x

    Depending on the mismatch, either you have to rebuild your library for your target platform or change your target platform.

    Note: For fat binaries, lipo -info will print a combination of above architectures.

    0 讨论(0)
  • 2020-12-07 14:29

    I figured out what caused the problem. I changed 'Build Active Architecture Only' of TapkuLibrary from Yes to No and it compiles with no problem.

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