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 am trying to use a c++ ARM 32-bit library on a Jetson Tx2, which is an ARM 64-bit linux machine. When I try to compile some of the sample code provided with the library I get the following compilation error:
/usr/bin/ld: skipping incompatible /home/nvidia/libroyale/bin/libroyale.so
when searching for -lroyale
/usr/bin/ld: cannot find -lroyale
collect2: error: ld returned 1 exit status
CMakeFiles/sampleCameraInfo.dir/build.make:94: recipe for target
'sampleCameraInfo' failed
make[2]: *** [sampleCameraInfo] Error 1
CMakeFiles/Makefile2:67: recipe for target
'CMakeFiles/sampleCameraInfo.dir/all' failed
make[1]: *** [CMakeFiles/sampleCameraInfo.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
I assume that this error is because the 32-bit library is somehow incompatible with a 64-bit machine.
I have been browsing other StackOverflow forums on similar issues, and in accordance with those forum recommendations added the -m32 flag to CXXFLAGS and LDFLAGS when I compile. However, I then get the following error:
g++: error: unrecognized command line option ‘-m32’
CMakeFiles/sampleCameraInfo.dir/build.make:62: recipe for target
'CMakeFiles/sampleCameraInfo.dir/sampleCameraInfo.cpp.o' failed
make[2]: *** [CMakeFiles/sampleCameraInfo.dir/sampleCameraInfo.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target
'CMakeFiles/sampleCameraInfo.dir/all' failed
make[1]: *** [CMakeFiles/sampleCameraInfo.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Some other StackOverflow threads said that in order to use the -m32 flag, one has to run the command:
sudo apt-get install g++-multilib
I don't think that the installation is working correctly, as I'm getting the following errors:
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
g++-multilib:armhf : Depends: cpp:armhf (>= 4:5.3.1-1ubuntu1) but it is
not going to be installed
Depends: gcc-multilib:armhf (>= 4:5.3.1-1ubuntu1) but it is not going to be installed
Depends: g++:armhf (>= 4:5.3.1-1ubuntu1) but it is not going to be installed
Depends: g++-5-multilib:armhf (>= 5.3.1-3~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Any suggestions would be very much appreciated. Thanks!
UPDATE: I realized that the -m32 flag is only supported on x86 linux machines. Does anyone know if there is some equivalent for ARM machines?
I had a look at the GCC documentation, especially on the following pages:
https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/x86-Options.html
https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/AArch64-Options.html
Looks like for the GNU compilers x86 is one type of CPU; you can create 16-, 32- or 64-bit code for this CPU type.
However it also looks like for the GNU compilers 32-bit ARM CPUs and 64-bit ARM CPUs are two completely different CPU types.
Therefore compiling for 32-bit ARM with a 64-bit ARM compiler is the same as compiling for x86 with an ARM compiler: It won't work.
Of course the 32-bit library will not be accepted; an ARM compiler would not accept a x86 library, either.
I download the source code of asterisk on my macbook pro, which the OS X version is 10.9 ,then following the README.txt to compile it, but it failed ,and then I tried almost all the release version, but all the compiled results are the same, the compile error is as following,please help me to check it ,and how can I compile it on Mavericks; Appreciate!
ranlib libmxml.a gcc -o menuselect menuselect.o strcompat.o
menuselect_stub.o mxml/libmxml.a Generating input for menuselect
... menuselect/menuselect --check-deps menuselect.makeopts
menuselect/menuselect --check-deps menuselect.makeopts
Generating embedded module rules ...
[CC] stereorize.c ->
stereorize.o error: invalid value '6' in '-O6' make[1]: *
[stereorize.o] Error 1 make: [utils] Error 2
"-O4" nor "-O3" work...
sh-3.2# make ASTCFLAGS="-O4" [LD] chan_iax2.o iax2-parser.o iax2-provision.o -> chan_iax2.so
ld: lto: could not merge in
iax2-parser.o because 'Linking globals named 'ast_tvdiff_sec': symbol
multiply defined!', using libLTO version 'LLVM version 3.3svn, from
Apple Clang 5.0 (build 500.2.79)' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: * [chan_iax2.so] Error 1
make: * [channels] Error 2
I'm working with Point Cloud Library. It's mostly in C++ When I compile it, gives such error:
[ 0%] Building CXX object common/CMakeFiles/pcl_common.dir/src/intersections.cpp.o
In file included from /home/lv/pcl-trunk/common/include/pcl/point_types.h:301:0,
from /home/lv/pcl-trunk/common/include/pcl/common/impl/common.hpp:41,
from /home/lv/pcl-trunk/common/include/pcl/common/common.h:186,
from /home/lv/pcl-trunk/common/include/pcl/common/intersections.h:41,
from /home/lv/pcl-trunk/common/src/intersections.cpp:38:
/home/lv/pcl-trunk/common/include/pcl/impl/point_types.hpp:1009:68: warning: ‘SHOT’ is deprecated [-Wdeprecated-declarations]
/tmp/ccRLy4Re.s: Assembler messages:
/tmp/ccRLy4Re.s:2488: Error: no such instruction: `vfmadd312ss (%r9),%xmm2,%xmm1'
/tmp/ccRLy4Re.s:2638: Error: no such instruction: `vfmadd312ss (%rdx),%xmm2,%xmm1'
/tmp/ccRLy4Re.s:3039: Error: no such instruction: `vfmadd312ss (%rax,%r11,4),%xmm5,%xmm1'
/tmp/ccRLy4Re.s:3402: Error: no such instruction: `vfmadd312ss (%rax,%r11,4),%xmm5,%xmm1'
/tmp/ccRLy4Re.s:3534: Error: no such instruction: `vfmadd312ss (%rax,%rdx,4),%xmm1,%xmm2'
/tmp/ccRLy4Re.s:3628: Error: no such instruction: `vfmadd312ss (%rax,%rdx,4),%xmm1,%xmm2'
/tmp/ccRLy4Re.s:6103: Error: no such instruction: `vfmadd312ss (%r11),%xmm0,%xmm4'
/tmp/ccRLy4Re.s:6121: Error: no such instruction: `vfmadd312ss (%r11,%rbx,4),%xmm0,%xmm3'
/tmp/ccRLy4Re.s:6131: Error: no such instruction: `vfmadd312ss (%r11,%rbp,4),%xmm0,%xmm2'
/tmp/ccRLy4Re.s:6135: Error: no such instruction: `vfmadd312ss (%r11,%r13,4),%xmm0,%xmm1'
/tmp/ccRLy4Re.s:6344: Error: no such instruction: `vfmadd312ss (%r10),%xmm0,%xmm1'
/tmp/ccRLy4Re.s:11760: Error: no such instruction: `vfnmadd312ss (%rdx),%xmm0,%xmm0'
/tmp/ccRLy4Re.s:13976: Error: no such instruction: `vfmadd312ss (%rdi),%xmm0,%xmm1'
/tmp/ccRLy4Re.s:14125: Error: no such instruction: `vfmadd312ss (%rdx),%xmm0,%xmm1'
make[2]: *** [common/CMakeFiles/pcl_common.dir/src/intersections.cpp.o] Error 1
make[1]: *** [common/CMakeFiles/pcl_common.dir/all] Error 2
make: *** [all] Error 2
Could anyone tell me how to read these errors and give me some suggestions to solve?
You can use the command below to see what is your CPU (for the compiler):
gcc -march=native -Q --help=target | grep march
Then you can add your cpu type in the ccmake CMAKE_CXX_FLAGS option, for me:
CMAKE_CXX_FLAGS = -march=corei7-avx
You can add -march=native -mno-avx This worked for me.
In my CMakeLists.txt, I added the above to the CMAKE_CXX_FLAGS :
SET(CMAKE_CXX_FLAGS "-ggdb -O3 -fPIC -std=c++0x -march=native -mno-avx")
[Source can be found in this page.]
I faced this issue when trying to install glove.
The problem I faced was resolved by upgrading the g++ version installed in my ubuntu 14.04 machine.
My original g++ version was 4.6.4 and I upgraded it to the g++-5 (5.4.1 when I upgraded it).
There are error message from assembler, which means assembler doesn't know these assembly code, for example vfmadd312ss.
This happens when compiler generate some CPU only assembly code, for example intel E5 with arch core-avx2 have extra instruction set advanced vector extensions, but if "as" is tool old to know the new CPUs, this error would happen.
Try a new version Binutils, the latest is 2.29 now.
If you compile code from another tool, for example bazel, make sure it will call the new "as".
Have you tried using a different compiler?
I had assembler errors in a project using Point Cloud Library. It was possibly due to using Ubuntu 12.04 on an core i7 processor (see https://github.com/uzh-rpg/rpg_svo/issues/7).
I was able to compile by installing the 'clang' compiler
sudo apt-get install clang
and then running cmake with:
cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .
I have met the same error messages,
I removed the -march=native from CXXFLAGS and CFLAGS in my makefile,
it works in my case. But since you didn't put out your makefile, I am not sure this will works in your case, any way you can have a try.
You probably need to enable advanced vector extensions when compiling (and use toolchain that supports this). Try -march=core-avx2 or something similar.
If you compiled library yourself, it is possible you need to configure it to not use AVX.
I am having problems with compiling code on my Mac (OS X, 10.6.5).
The code uses f2c.
I don't understand the error, and would really appreciate any help. I wondered if it might be a problem with my compiler, and just in case I reinstalled Xcode, which installs a new g++ compiler. But I still get the same error.
Here's the error:
cc1plus: error: /include: not a directory
cc1plus: error: /lib: not a directory
make: *** [Task1.o] Error 1
Thanks!
This may be an error in the installation of your gcc compiler. It seems it may be looking for includes in /usr/include, but it is missing the first part of the directory. Try executing:
$ gcc -v
to see what directories the gcc you're using has by default. In my case, I see
--prefix=/usr
as one of the options.