Compile errors with Assembler messages

2020-03-27 01:42发布

问题:

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?

回答1:

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



回答2:

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.]



回答3:

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).



回答4:

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".



回答5:

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.



回答6:

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.



回答7:

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++ .