Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Fails to build on latest macOS setup (Big Sur) #88

Closed
JonasVautherin opened this issue Dec 5, 2020 · 5 comments · Fixed by #97
Closed

[bug] Fails to build on latest macOS setup (Big Sur) #88

JonasVautherin opened this issue Dec 5, 2020 · 5 comments · Fixed by #97
Assignees
Labels

Comments

@JonasVautherin
Copy link
Contributor

I have been using the toolchain for years now without issues. And recently, the github workflow stopped working. I believe they updated something on the machines. I tried to reproduce locally by updating to Big Sur, Xcode 12.2 and cmake 3.19.1, but clean builds would still work. After running brew upgrade, though, I started reproducing the error. So it seems to me that something has changed somewhere, and maybe there is a need for a fix in the toolchain.

When running the configure step for -DPLATFORM=SIMULATOR64, I see the following, which seems fine (i.e. it is targeting iOS Simulator):

-- Disabling bitcode support by default on simulators. ENABLE_BITCODE not provided for override!
-- Enabling ARC support by default. ENABLE_ARC not provided!
-- Hiding symbols visibility by default. ENABLE_VISIBILITY not provided!
-- Using NON-strict compiler checks by default. ENABLE_STRICT_TRY_COMPILE not provided!
-- Using C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Using CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-- Using libtool: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-- Configuring iphonesimulator build for platform: SIMULATOR64, architecture(s): x86_64
-- Using SDK: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.2.sdk
-- Autoconf target triple: x86_64-apple-ios
-- Using minimum deployment version: 11.0 (SDK version: 14.2)
-- Merging integrated CMake 3.14+ iOS,tvOS,watchOS,macOS toolchain(s) with this toolchain!
-- Using a data_ptr size of: 8
-- Using install_name_tool: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool
-- Disabling bitcode support.
-- Enabling ARC support.
-- Hiding symbols (-fvisibility=hidden).
-- Using libtool: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done

But in the build step, I now receive a ton of those warnings, that I did not have before the update:

ld: warning: building for iOS, but linking in .tbd file (/usr/lib/system/libcache.dylib) built for iOS Simulator
ld: warning: building for iOS, but linking in .tbd file (/usr/lib/system/libcommonCrypto.dylib) built for iOS Simulator
ld: warning: building for iOS, but linking in .tbd file (/usr/lib/system/libcompiler_rt.dylib) built for iOS Simulator
ld: warning: building for iOS, but linking in .tbd file (/usr/lib/system/libcopyfile.dylib) built for iOS Simulator
ld: warning: building for iOS, but linking in .tbd file (/usr/lib/system/libcorecrypto.dylib) built for iOS Simulator
ld: warning: building for iOS, but linking in .tbd file (/usr/lib/system/libdispatch.dylib) built for iOS Simulator
ld: warning: building for iOS, but linking in .tbd file (/usr/lib/system/libdyld.dylib) built for iOS Simulator

Which seems weird to me, because it just said that it would build for iOS Simulator. Why could it be complaining? Is there something to be done at the toolchain level?

Happy to try things on my different setups, I have been struggling for a while and I just don't know what to try anymore.

@JonasVautherin
Copy link
Contributor Author

Struggling with this, any help would be appreciated. From some forum threads, it seems like it may be related to VALID_ARCHS, and the new EXCLUDED_ARCHS coming with Xcode 12.

From Xcode 12 release notes:

The Build Settings editor no longer includes the Valid Architectures build setting (VALID_ARCHS), and its use is discouraged. Instead, there is a new Excluded Architectures build setting (EXCLUDED_ARCHS). If a project includes VALID_ARCHS, the setting is displayed in the User-Defined section of the Build Settings editor. (15145028)

I also see some suggesting:

EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64

But I don't really know where to define that within this toolchain.

Any suggestion?

@leetal
Copy link
Owner

leetal commented Dec 8, 2020

This has also been discussed in the CMake issue tracker and is currently tracked here and here (closed in favour of the first link).

I have not yet encountered this myself, but try adding the following to your applicable CMakeLists.txt (untested):
set_target_properties(yourtargetshere PROPERTIES XCODE_ATTRIBUTE_EXCLUDED_ARCHS[sdk=iphonesimulator*] "arm64")
or if a global (all targets) behaviour is wanted, try:
set(CMAKE_XCODE_ATTRIBUTE_EXCLUDED_ARCHS[sdk=iphonesimulator*] "arm64")

@JonasVautherin
Copy link
Contributor Author

Adding set(CMAKE_XCODE_ATTRIBUTE_EXCLUDED_ARCHS[sdk=iphonesimulator*] "arm64") to the toolchain file did it, thanks a lot :-).

It seems to me that the toolchain is not yet aware of arm macbooks, and therefore it could make sense to add that line until it does. What do you think?

@leetal
Copy link
Owner

leetal commented Dec 9, 2020

Yeah, i've followed the discussions in the CMake mailing lists/issue tracker and are currently waiting for any progress on their end to potentially solve this, but i can (for now) probably limit the inclusion of that excluded archs xcode setting to the toolchain if xcode version is above 12.0 and the CMake version is less than whatever version they add the fixes upstream.

@leetal
Copy link
Owner

leetal commented Feb 4, 2021

This commit includes a workaround for now: 6e9021a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants