Check for working ObjC compiler not working when building for iOS
Hello,
Ran into this problem with CMake 3.16 (SHA: g3c0a317
) when trying to build for iOS ARM64:
-- The C compiler identification is Clang 8.0.1
-- The CXX compiler identification is Clang 8.0.1
-- Check for working C compiler: /Users/tobias/.conan_plex/.conan/data/clang/8.0.1-71-0/plex/stable/package/0b647f069fa6c3d1e66c05f0cc32933e0ff5e065/bin/clang
-- Check for working C compiler: /Users/tobias/.conan_plex/.conan/data/clang/8.0.1-71-0/plex/stable/package/0b647f069fa6c3d1e66c05f0cc32933e0ff5e065/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Users/tobias/.conan_plex/.conan/data/clang/8.0.1-71-0/plex/stable/package/0b647f069fa6c3d1e66c05f0cc32933e0ff5e065/bin/clang++
-- Check for working CXX compiler: /Users/tobias/.conan_plex/.conan/data/clang/8.0.1-71-0/plex/stable/package/0b647f069fa6c3d1e66c05f0cc32933e0ff5e065/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The OBJC compiler identification is Clang 8.0.1
-- The OBJCXX compiler identification is Clang 8.0.1
-- Check for working OBJC compiler: /Users/tobias/.conan_plex/.conan/data/clang/8.0.1-71-0/plex/stable/package/0b647f069fa6c3d1e66c05f0cc32933e0ff5e065/bin/clang
-- Check for working OBJC compiler: /Users/tobias/.conan_plex/.conan/data/clang/8.0.1-71-0/plex/stable/package/0b647f069fa6c3d1e66c05f0cc32933e0ff5e065/bin/clang -- broken
CMake Error at /Users/tobias/.conan_plex/.conan/data/cmake/3.16.0-3c0a317a-1/plex/stable/package/b9cf9bf841aca97ce334c83f6fb7c40f3bd8db7d/share/cmake-3.16/Modules/CMakeTestOBJCCompiler.cmake:57 (message):
The Objective-C compiler
"/Users/tobias/.conan_plex/.conan/data/clang/8.0.1-71-0/plex/stable/package/0b647f069fa6c3d1e66c05f0cc32933e0ff5e065/bin/clang"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/tobias/Code/plex-media-server/build/CMakeFiles/CMakeTmp
Run Build Command(s):/Users/tobias/.conan_plex/.conan/data/ninja/1.8.2-e234a7bd-6/plex/stable/package/0b647f069fa6c3d1e66c05f0cc32933e0ff5e065/bin/ninja cmTC_a7b16 && [1/2] Building OBJC object CMakeFiles/cmTC_a7b16.dir/testOBJCCompiler.m.o
[2/2] Linking OBJC executable cmTC_a7b16
FAILED: cmTC_a7b16
: && /Users/tobias/.conan_plex/.conan/data/clang/8.0.1-71-0/plex/stable/package/0b647f069fa6c3d1e66c05f0cc32933e0ff5e065/bin/clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk -mios-version-min=8.0 -arch arm64 -stdlib=libc++ -Wl,-no_weak_imports CMakeFiles/cmTC_a7b16.dir/testOBJCCompiler.m.o -o cmTC_a7b16 && :
ld: warning: ignoring file CMakeFiles/cmTC_a7b16.dir/testOBJCCompiler.m.o, building for iOS-arm64 but attempting to link with file built for iOS Simulator-x86_64
Undefined symbols for architecture arm64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture arm64
clang-8: 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.
Call Stack (most recent call first):
CMakeLists.txt:35 (enable_language)
-- Configuring incomplete, errors occurred!
See also "/Users/tobias/Code/plex-media-server/build/CMakeFiles/CMakeOutput.log".
See also "/Users/tobias/Code/plex-media-server/build/CMakeFiles/CMakeError.log".
This works for iOS x86_64 (using the simulator). So something doesn't seem to be forwarded. It also works for C/C++ as you see above. Not sure what could cause this - the command line above looks correct.
Attached the CMakeOutput and CMakeError files as well.