Im trying to compile an c++ code using CMake but Im facing these errors ?
Couldnt manage to find any related content for these 2.
CMakeError.log is:
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /Library/Developer/CommandLineTools/usr/bin/cc
Build flags:
Id flags:
The output was:
1
ld: library not found for -lSystem
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /Library/Developer/CommandLineTools/usr/bin/c++
Build flags:
Id flags:
The output was:
1
ld: library not found for -lc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Checking whether the ASM compiler is GNU using "--version" did not match "(GNU assembler)|(GCC)|(Free Software Foundation)":
Apple clang version 12.0.0 (clang-1200.0.32.28)
Target: x86_64-apple-darwin20.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Im using Mac, OS X version: 11.0.1 and Apple clang version 12.0.0 (clang-1200.0.32.28)
Thanks in advance, but Im probably going to need some extra detailed information since it seems like not gonna get fixed by a simple version update..
Related
I am compiling a C++ application on CLion IDE using the Clang 12 from LLVM with CMake 3.20. MacOS version is 10.15.7.
The error I get is:
-- The C compiler identification is Clang 12.0.1
-- The CXX compiler identification is Clang 12.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/local/Cellar/llvm/12.0.1/bin/clang-12
-- Check for working C compiler: /usr/local/Cellar/llvm/12.0.1/bin/clang-12 - broken
CMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"/usr/local/Cellar/llvm/12.0.1/bin/clang-12"
is not able to compile a simple test program.
ld: unknown option: -platform_version
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [cmTC_ca485] Error 1
make: *** [cmTC_ca485/fast] Error 2
I was trying to solve the problem with the help of the following: Clang 10 fails to link C++ application with CMake on macOS 10.12 but to no avail.
It seems CMake is using the linker from /usr/bin/. Forcing it to use the one from the same directory where Clang 12 resides (by using -DCMAKE_LINKER="/usr/local/Cellar/llvm/12.0.1/bin/lld) doesn't help. Not sure if it is relevant but when I try to get the linker version by running ld64.lld -v I get the error message:
ld64.lld: error: -arch not specified and could not be inferred
Any help will be highly appreciated.
I have a C++ project with CMake build system. When I compile using GCC it compiles fine. But when I tried to use NDK toolchain, it shows the following error.
Linking CXX executable ../bin/my_app
/opt/r19c/linux-x86_64/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld:
cannot find -lpthread
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
How can I fix this issue?
I am trying to install a library from https://github.com/Koihik/LuaFormatter, and I got an error when I am using cmake .
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- IPO / LTO enabled
-- Looking for C++ include filesystem
-- Looking for C++ include filesystem - not found
CMake Warning at CMakeLists.txt:30 (message):
filesystem not found, use experimental/filesystem as fallback. It's
recommended to use a stable C++17 compliant compiler/libstdc++.
I am not a C++ developer and I am not sure what is the next step I need to take. I have checked this question, it seems like I need to have gcc 9 or 10, clang 9 or 10 and XCode LLVM 9.3 or later. I have installed all packages, but it is still not working. These are my version check:
❯ clang --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Is gcc the problem here? It is Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
❯ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
❯ xcode-select --version
xcode-select version 2354.
Update
Following this answer, I have made an alias in .zshrc, but still I can't build correctly:
alias gcc='gcc-10'
alias cc='gcc-10'
alias g++='g++-10'
alias c++='c++-10'
Update 2
This is the error I am getting when I cmake .
#include <experimental/filesystem>
^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[1]: *** [CMakeFiles/cmTC_a8010.dir/fs.cpp.o] Error 1
make: *** [cmTC_a8010/fast] Error 2
CMake Error at CMakeLists.txt:61 (message):
Your compiler does not fully support the C++17 standard and libraries
I've been trying to cross compile an open source library for AArch64.
When I run an executable linking against this library on a Raspberry Pi 4 (running a 64-bit OS), I get an Illegal Instruction error.
I created a github issue and the library developer suggested I enable the -mno-outline-atomics compiler flag (more details on the github issue here). More details on the flag itself can be found here.
So I edited the aarch64 cmake toolchain file (found here) to include the following:
set(CMAKE_C_FLAGS "-march=armv8-a -mno-outline-atomics")
set(CMAKE_CXX_FLAGS "-march=armv8-a -mno-outline-atomics")
However, when I try to compile the library, I get the following error messages:
-- CMAKE_TOOLCHAIN_FILE = /home/cyrus/work/c-sdks/3rd_party_libs/ncnn/toolchains/aarch64-linux-gnu.toolchain.cmake
-- CMAKE_INSTALL_PREFIX = /home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/install
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc
-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc - broken
CMake Error at /usr/local/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"/usr/bin/aarch64-linux-gnu-gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_65def/fast && /usr/bin/make -f CMakeFiles/cmTC_65def.dir/build.make CMakeFiles/cmTC_65def.dir/build
make[1]: Entering directory '/home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_65def.dir/testCCompiler.c.o
/usr/bin/aarch64-linux-gnu-gcc -march=armv8-a -mno-outline-atomics -o CMakeFiles/cmTC_65def.dir/testCCompiler.c.o -c /home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/CMakeFiles/CMakeTmp/testCCompiler.c
aarch64-linux-gnu-gcc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
CMakeFiles/cmTC_65def.dir/build.make:82: recipe for target 'CMakeFiles/cmTC_65def.dir/testCCompiler.c.o' failed
make[1]: *** [CMakeFiles/cmTC_65def.dir/testCCompiler.c.o] Error 1
make[1]: Leaving directory '/home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/CMakeFiles/CMakeTmp'
Makefile:138: recipe for target 'cmTC_65def/fast' failed
make: *** [cmTC_65def/fast] Error 2
Why is the compiler complaining about this: unrecognized command line option ‘-mno-outline-atomics’?
How can I properly enable the flag using CMake?
The outline-atomic feature was added with gcc 9.4.
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
Clearly, your compiler is too old and does not support it.
I use https://github.com/kewlbear/FFmpeg-iOS-build-script to compile ffmpeg,
but when i try to compile, for armv7s architecture i have next error
all other archs compile fine
clang: error: unable to execute command: Segmentation fault: 11 clang:
error: clang frontend command failed due to signal (use -v to see
invocation) Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM
3.6.0svn) Target: arm-apple-darwin14.3.0 Thread model: posix clang: note: diagnostic msg: PLEASE submit a bug report to
http://developer.apple.com/bugreporter/ and include the crash
backtrace, preprocessed source, and associated run script. clang:
note: diagnostic msg:
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed
source(s) and associated run script(s) are located at: clang: note:
diagnostic msg:
/var/folders/zk/wj2cn08s26x64nlzk3_kjnv80000gn/T/vp8-c6ec27.c clang:
note: diagnostic msg:
/var/folders/zk/wj2cn08s26x64nlzk3_kjnv80000gn/T/vp8-c6ec27.sh clang:
note: diagnostic msg:
******************** make: * [libavcodec/vp8.o] Error 254 make: * Waiting for unfinished jobs.... CC libavcodec/wmv2enc.o
Couple months ago all compiled without any errors.
Tried on couple versions of ffmpeg
Here is Clang -v
Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0 Thread model: posix
and xcode version is Version 6.3.1 (6D1002)
I think i found a solution, as you can understand from this article http://www.cocoanetics.com/2014/10/xcode-6-drops-armv7s/ xcode doesn't have armv7s support for now, so armv7s will use armv7 version and it must not reduce performance.