Cross-compilation for iOS fails after upgrade to Big Sur (macOS 11)
See original GitHub issueDescribe the bug After updating a system to macOS 11 the cross compilation for iPhone fails with the message
Run-time dependency appleframeworks found: NO (tried framework)
meson.build:3:0: ERROR: Dependency "appleframeworks" not found, tried framework
I attached the succeeding and failing meson-log files:
- succeeds: meson-log-macos-10.15.log
- fails: meson-log-macos-11.2.log
After
export SDKROOT=$(xcrun --sdk iphoneos --show-sdk-path)
and retrying on macOS 11, I get the following hint in the log file:
Compiler stderr:
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk/System/Library/Frameworks//LocalAuthentication.framework/LocalAuthentication.tbd, missing required architecture x86_64 in file /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk/System/Library/Frameworks//LocalAuthentication.framework/LocalAuthentication.tbd (4 slices)
ld: building for iOS, but linking in object file built for iOS Simulator, file '/var/folders/8g/b9x3y6tj3yxf988c4gkb5ybc0000gp/T/testfile-cf7953.o' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
which indicates, the xcodebuild expects some architecture parameter.
If I use the clang++ command from the meson-log.txt and
- set SDKROOT correctly
- append
-arch arm64
to the command-line the setup succeeds on macOS 11 andfile output.exe
results inoutput.exe: Mach-O 64-bit executable arm64
.
So, how do I have to modify the meson.build for a succeeding build?
To Reproduce
meson.build
project('Objective C++', 'objcpp')
appleframeworks_dep = dependency('appleframeworks', modules: ['Foundation', 'Security', 'LocalAuthentication'])
exe = executable('objcppprog', 'prog.mm', dependencies: [appleframeworks_dep])
test('Simple Build', exe)
prog.mm
int main(void) { return 0; }
cross-file.txt
[host_machine]
system = 'darwin'
cpu_family = 'aarch64'
cpu = 'arm64'
endian = 'little'
[binaries]
ar = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar'
as = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/as'
c = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang'
cc = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang'
cpp = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang'
cxx = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++'
ld = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld'
objc = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang'
objcpp = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++'
ranlib = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib'
strip = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip'
[properties]
skip_sanity_check = true
ios_deployment_target = '13.0'
vendor = 'apple'
target_dir = 'apple-iphoneos13.0-aarch64-arm64-little'
sys_root = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'
Setup
meson setup --cross-file cross-file.txt build
Expected behavior
Finish the setup without error and meson test -C build
should run but should skip the test.
system parameters
- Is this a cross build or just a plain native build (for the same computer)? cross build
- what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
- Fails on macOS 11.2.1 and Xcode 12.3 / 12.4
- Succeeds on macOS 10.15.7 and Xcode 12.3
- what Python version are you using e.g. 3.8.0: 3.8.2 (from Xcode)
- what
meson --version
: 0.56.0 (but 0.57.0 fails, too) - what
ninja --version
if it’s a Ninja build: 1.10.2
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Clang linking error MacOS Big Sur | Apple Developer Forums
Hi All, I am trying to build my helloworld.cpp, but I am having problem since I updated to Big Sur. Below a verbose...
Read more >Can't compile a C program on a Mac after upgrading to ...
Immediately after the upgrade, I ran XCode 11.0. ... On MacOS Catalina 10.15.4, with Xcode Version 11.5 (11E608c) I also needed to update...
Read more >Failing Tests while Compiling Swift on Xcode 12 with MacOS ...
The compilation goes perfectly but some test case fails which results in the process to terminate with an exit status of 65. I...
Read more >Cross-compile Firefox for Mac on Linux - Bugzilla@Mozilla
Building clang eventually fails on a missing header -- cxxabi.h. libcxx and ... (Visit the following URL, select Apple under OS Vendor, and...
Read more >How to fix the error "The developer of this app needs to update ...
After upgrading to iOS 15, you may see an error in applications built with ... by a build with XCode 12.4 or lower...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I tested this and could make it work by adding these entries to the cross file’s
properties
entry:I also had to set SDKROOT. Presumably there is also a command line argument you can give to the compiler/linker to make it work, but I don’t know enough about macOS to know what that might be.
Short update: The settings provided above solve the problem on macOS 11 but are not applicable for macOS 10. (both Xcode 12.4) Ticket can stay closed.