Compile errors with Assembler messages - c++

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.

Related

SeaBIOS cannot be compiled for qemu on Andriod/Termux

When I tried to compile SeaBIOS version 1.14 with a little touch of SMBIOS cpu speed modifications I got 3 errors, and a warning, here's the errors and warnings I got
clang-14: error: unknown argument: '-mpreferred-stack-boundary=2'
clang-14: error: unsupported option '-freg-struct-return' for target 'armv7a-unknown-linux-android24'
clang-14: error: the clang compiler does not support '-march=i386'
clang-14: warning: optimization flag '-fno-merge-constants' is not supported [-Wignored-optimization-argument]
make: *** [Makefile:141: out/src/misc.o] Error 1
SeaBIOS is an x86 program, and you appear to be trying to compile it with a compiler that creates Arm binaries. You need to use an x86 compiler (possibly a cross-compiler, if you really want to compile it on an Arm host).

c++: error: unrecognized command line option ‘-std=c++17’

[ 25%] Building CXX object CMakeFiles/linreg-dlib.dir/linreg_dlib.cc.o
/usr/bin/c++ -I/home/jeong/다운로드/dlib-master -I"/home/jeong/바탕화면/9781789955330_Code/Chapter01/dlib_samples/path to dlib install dir/include" -std=c++17 -msse3 -fopenmp -Wall -Wextra -o CMakeFiles/linreg-dlib.dir/linreg_dlib.cc.o -c /home/jeong/바탕화면/9781789955330_Code/Chapter01/dlib_samples/linreg_dlib.cc
c++: error: unrecognized command line option ‘-std=c++17’
make[2]: *** [CMakeFiles/linreg-dlib.dir/linreg_dlib.cc.o] error 1
make[2]: Leaving directory `/home/jeong/바탕화면/9781789955330_Code/Chapter01/dlib_samples'
make[1]: *** [CMakeFiles/linreg-dlib.dir/all] error 2
make[1]: Leaving directory `/home/jeong/바탕화면/9781789955330_Code/Chapter01/dlib_samples'
make: *** [all] error 2
c++: error: unrecognized command line option ‘-std=c++17’
I am running the practice code using the dlib library.
It runs until'cmake', but the above error appears during'make' process. Need to update gcc?
The gcc version is shown below.
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
How to do it if you need to update the version
I wonder.
The GCC releases page (https://www.gnu.org/software/gcc/releases.html) says that gcc 4.8.5 was released on June 23, 2015.
The GCC developers are really good, but shipping C++17 support two years before C++17 was completed is beyond good.
That compiler may support -std=c++1z for some C++17 features, though.
As others have mentioned your compiler is too old for C++17.
It sounds like you are on either RHEL 7 or CentOS 7. Those OSes support installation of "Developer Toolsets" with newer versions of the compiler and toolchain (in addition to the standard system compiler).
This might be an option for you.
For RHEL 7 see: https://access.redhat.com/documentation/en-us/red_hat_developer_toolset/10/
For CentOS see: https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/

gRPC installation fails at "make"

I am following the Built From Source instructions to install grpc
$ git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc
success
$ cd grpc
success
$ git submodule update --init
success
$ make
fails after building a few source files
third_party/boringssl/crypto/rand/urandom.c:62:2: error: #error "system call number for getrandom is not the expected value"
#error "system call number for getrandom is not the expected value"
^
In file included from /usr/include/x86_64-linux-gnu/sys/syscall.h:31:0,
from third_party/boringssl/crypto/rand/urandom.c:32:
third_party/boringssl/crypto/rand/urandom.c: In function ‘init_once’:
third_party/boringssl/crypto/rand/urandom.c:128:15: error: ‘__NR_getrandom’ undeclared (first use in this function)
syscall(SYS_getrandom, &dummy, sizeof(dummy), GRND_NONBLOCK);
^
third_party/boringssl/crypto/rand/urandom.c:128:15: note: each undeclared identifier is reported only once for each function it appears in
third_party/boringssl/crypto/rand/urandom.c: In function ‘fill_with_entropy’:
third_party/boringssl/crypto/rand/urandom.c:258:21: error: ‘__NR_getrandom’ undeclared (first use in this function)
r = syscall(SYS_getrandom, out, len, 0 /* no flags */);
^
Makefile:2564: recipe for target '/home/usrnm/grpc/objs/opt/third_party/boringssl/crypto/rand/urandom.o' failed
make: *** [/home/usrnm/grpc/objs/opt/third_party/boringssl/crypto/rand/urandom.o] Error 1
OS: Linux 4.4.0-0 SMP Debian 4.4.16-1
GCC version: gcc (Debian 4.9.2-10) 4.9.2
I couldn't find any open issues or any help about this error on the internet.
You might have better luck without the embedded BoringSSL. Try building with:
EMBED_OPENSSL=false make
If you get errors about missing packages, make sure you have libssl-dev installed.
The problem seems to happen while compiling boringssl . We use the version given by $ git submodule, which at the time of this writing is be2ee342d3781ddb954f91f8a7e660c6f59e87e5 third_party/boringssl (version_for_cocoapods_7.0-526-gbe2ee342). Are you able to compile boringssl on its own?

luarocks 'gcc-plugin.h' build error

I am trying to use torch together with the hdf5 package. I am trying to install it via luarocks install hdf5 but during the build phase I get an error regarding the gcc-plugin header. (gcc relies on clang backend). The complete error message is:
luarocks install --local hdf5
Installing https://luarocks.org/hdf5-2.0.0-1.src.rock...
Using https://luarocks.org/hdf5-2.0.0-1.src.rock... switching to 'build' mode
Warning: variable CFLAGS was not passed in build_variables
gcclua-config.h:1:10: fatal error: 'gcc-plugin.h' file not found
#include "gcc-plugin.h"
^
1 error generated.
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -c -o gcclua.o -Iplugin/include -fPIC -O2 -Wall -Wformat-security -I/usr/local/Cellar/lua/5.2.4_3/include gcclua.c
gcclua.c:7:10: fatal error: 'gcc-plugin.h' file not found
#include "gcc-plugin.h"
^
1 error generated.
make[2]: *** [gcclua.o] Error 1
make[1]: *** [gcc] Error 2
make: *** [gcc-lua] Error 2
Just to give more information, I am relying on
gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
xcrun: error: couldn't stat toolchain: '/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.11.xctoolchain' (errno=No such file or directory)
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Does anybody has maybe a hint how to fix this issue?
Every help is greatly appreciated!!!
In addition to gcc, you need the headers, which on Linux you can get with sudo apt-get install gcc-4.8-plugin-dev. If you're on a different OS or version of gcc, just substitute the appropriate package manager / gcc version number.
gcc-plugin.h is a part of GCC, so I think you'll really need to install gcc to get that. Clang provides a gcc-compatible front-end script but that merely presents a command-line driver with compatible flags.
You should be able to install GCC using Homebrew: https://apple.stackexchange.com/a/86588
I bet you tried to work on a CS287-16 class :). I have contacted the developer of this library who wasn't that easy to do something to solve the problem. Apparently he has no friends who have a Mac PC... As a workaround I could suggest you to use a Docker container with Linux in it to run Lua scripts. That's what I have ended up with...
Here's the Docker image I was talking about: https://github.com/aoboturov/cs287-16-lua. You could build it yourself and the just run as a Docker container :)

Newbie question f2c compilation problem: cc1plus error: /include: not a directory What does this mean?

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.