我正在尝试配置最基本的cmake项目:
cmake_minimum_required(VERSION 3.12)
enable_language(C)
当我尝试使用以下参数配置此cmake项目时:
cmake -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64 -GNinja ..
我收到以下错误,可以通过删除结果-arch armv7
文件中的CMakeCache.txt
标志来手动修复。有谁知道为什么要添加该标志以及是否有办法通过上述cmake
命令以编程方式将其删除?
-- The C compiler identification is AppleClang 10.0.0.10001145
-- The CXX compiler identification is AppleClang 10.0.0.10001145
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/gcc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -- broken
CMake Error at /usr/local/Cellar/cmake/3.12.2/share/cmake/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"/Applications/Xcode.app/Contents/Developer/usr/bin/gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/Phil/work/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/local/bin/ninja" "cmTC_fb5c2"
[1/2] Building C object CMakeFiles/cmTC_fb5c2.dir/testCCompiler.c.o
[2/2] Linking C executable cmTC_fb5c2
FAILED: : && /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -arch armv7 -mtvos-version-min=10.2 -fembed-bitcode -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.1.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_fb5c2.dir/testCCompiler.c.o -o cmTC_fb5c2 && :
ld: warning: -headerpad_max_install_names is ignored when used with -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES)
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.1.sdk/usr/lib/libSystem.tbd, missing required architecture armv7 in file /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.1.sdk/usr/lib/libSystem.tbd
ld: dynamic main executables must link with libSystem.dylib for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
-- Configuring incomplete, errors occurred!
See also "/Users/Phil/work/build/CMakeFiles/CMakeOutput.log".
See also "/Users/Phil/work/build/CMakeFiles/CMakeError.log".