4

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?

Lv Zhaoyang
  • 107
  • 1
  • 4
  • 10

7 Answers7

5

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

smac89
  • 39,374
  • 15
  • 132
  • 179
  • 3
    How is that going to help? The problem is the assembler being too old to assemble the instructions gcc is emitting. If your CPU supports FMA, `gcc -march=native` or `gcc -march=haswell` will emit FMA instructions. Using a lower `-march` setting that doesn't use FMA instructions (or `-mno-fma`) will cost you run-time performance, but that's not even what this answer is suggesting. – Peter Cordes Nov 23 '17 at 04:38
4

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

Community
  • 1
  • 1
Swagatika
  • 857
  • 1
  • 11
  • 32
  • This was the solution to successfully compile rgbdslam w ROS via ubuntu 12.04.05 i386 on a core i7 processor. – Jacksonkr Jan 28 '16 at 11:50
  • 1
    If you want to make a slower executable to work around an old assembler, you should first try `-mno-fma` and/or `-mno-avx2` to just disable FMA instructions but leave AVX enabled. – Peter Cordes Nov 23 '17 at 04:40
2

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

MonsieurBeilto
  • 878
  • 1
  • 11
  • 18
2

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

Sagar Chauhan
  • 5,715
  • 2
  • 22
  • 56
dasons
  • 493
  • 5
  • 12
  • This is the only good answer: upgrade your assembler to understand AVX2 / FMA instructions so you can create an executable that takes advantage of everything your CPU can do. (Preferably use a recent compiler version, too, that was released after your hardware so it's likely to know how to tune for it. e.g. gcc6.4 is a good choice these days, or the latest gcc7.x release if you're feeling adventurous.) – Peter Cordes Nov 23 '17 at 04:46
  • Also worth trying clang, which has its own built-in assembler so doesn't depend on binutils. In many cases it makes better code than gcc, especially for number-crunching. (It unrolls tiny loops by default.) – Peter Cordes Nov 23 '17 at 04:47
0

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++ .
Thorbjorn
  • 317
  • 2
  • 8
  • 1
    This is a good suggestion: `clang` has its own built-in assembler, and sometimes makes faster code than gcc. Especially a new version of clang should be better than an old gcc, especially if your gcc install is gimped by not being able to use FMA instructions. – Peter Cordes Nov 23 '17 at 04:49
0

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.

Boken
  • 4,825
  • 10
  • 32
  • 42
RBB
  • 309
  • 2
  • 13
  • That works if you want to make a slower binary that doesn't use FMA instructions. This is the worst solution, worse than upgrading your assembler, or using `-mno-fma` to just disable FMA without removing the AVX and `-mtune=native` effects of `-march=native`. – Peter Cordes Mar 25 '19 at 10:11
  • @PeterCordes Hi, thanks for the advice, but how to upgrading assembler? I am on a Linux server(Redhat). And in my case, my error message is shown as "no such instruction: 'shlx %edi, %edx,%edx' ", what's the best solution for my case in your opinion? Thanks in advance! – RBB Mar 26 '19 at 01:47
  • Install a new binutils to match the newer compiler that's emitting BMI2 instructions, or cross-compile binaries on a different machine. Or just live with your software running slower than it could. Or install `clang` if you don't want to touch an existing gcc + binutils install: clang has a built-in assembler and doesn't use `/usr/bin/as`. – Peter Cordes Mar 26 '19 at 02:02
-1

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.

dbrank0
  • 9,026
  • 2
  • 37
  • 55
  • Sorry, I am not a experienced programmer. I don't quite catch your idea. Could you explain it a bit more? – Lv Zhaoyang Jun 15 '13 at 18:40
  • I don't know how this is built, but try to get compiler/assembler to use -march=core-avx2. You will need to pass the switches when configuring (CPPFLAGS="-march=core-avx2) or just edit you buil scripts and add it. – dbrank0 Jun 16 '13 at 09:50
  • Nope, the problem is that the assembler is too old to support the FMA instructions the compiler is emitting. The only thing you could do with `-march` is disable new instructions and make a slower binary. – Peter Cordes Nov 23 '17 at 04:43