简体   繁体   中英

Xcode 8 beta 6 - conflicting values for architecture

I am trying to install my app on a device using Xcode beta 6, and it fails on the linking stage with the following error:

ld: linking module flags 'Objective-C Class Properties': IDs have conflicting values for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Xcode 8 beta 3 was building the app successfully, what may be the problem here?

Try turning off Link Time Optimization (LLVM_LTO) for your build. I hope they fix that for the final release.

I've been facing similar issue in my non-Xcode project.

I started seeing these messages when I upgraded Xcode to version 12.

My setup consists of several 3rd party libraries and the main project which depends on them and on a few macOS system Frameworks. The project is CMake-based.

I tried to rebuild everything with the new Xcode version with no luck. But I can confirm that this is LTO related. (Yes, I'm building the 3rd party libraries with thin LTO as well.)

The sudden change happened when I set proper -isysroot to the latest macOS release – 11. Then the linker started to complain about minimum OSX release, specifically that is too old. When I set it to 10.15 (which is my current macOS) the issue disappeared completely.

The solution hence is:

  • set -mmacosx-version-min=10.15
  • set -isysroot to MacOSX11.1.sdk , eg: -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk ( MacOSX.sdk is a symlink to the lates one)

Note: I'm using -isysroot from Command Line Tools but some autoconf stuff resolves to the Xcode.app/Contents/Developer/... latest SDK as well with no issues. The two SDKs – one from Xcode itself and the other one from Command Line Tools – are compatible.

Note/2: I'm posting the solution here as this question is the most relevant one.

This is because Xcode 8 cannot LTO when there is a mix of files that contains class properties in categories and files that contains categories but that have been generated by Xcode 7 (or prior). The only workaround for now seems to be to rebuild all the files with Xcode 8.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM