Kitt-AI/snowboy

Makefile:73: recipe for target '_snowboydetect.so' failed

Sammysedo opened this issue · 1 comments

Hello everyone,

I'm trying to manually compile snowboy and generate a shared library file _snowboydetect.so on 64-bit Ubuntu 16.04. I previously compiled this on my Raspberry without issues, but since I am using my laptop as my main project machine, I figured doing this on my laptop would be feasible. I'm using Python3.7 and Anaconda virtual environment (gcc version 8.4.0).

When running make in snowboy/swig/Python3, I'm getting the following output which terminates the process:

make

g++ -I../../ -O3 -fPIC -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++0x  -shared snowboy-detect-swig.o \
../..//lib/aarch64-ubuntu1604/libsnowboy-detect.a -L/home/robotics/anaconda3/envs/speechControl/lib/python3.7/config-3.7m-x86_64-linux-gnu -L/home/robotics/anaconda3/envs/speechControl/lib -lpython3.7m -lcrypt -lpthread -ldl  -lutil -lrt -lm  -lm -ldl -lf77blas -lcblas -llapack -latlas -o _snowboydetect.so
/usr/bin/ld: ../..//lib/aarch64-ubuntu1604/libsnowboy-detect.a(snowboy-detect.o): Relocations in generic ELF (EM: 183)
/usr/bin/ld: ../..//lib/aarch64-ubuntu1604/libsnowboy-detect.a(snowboy-detect.o): Relocations in generic ELF (EM: 183)
/usr/bin/ld: ../..//lib/aarch64-ubuntu1604/libsnowboy-detect.a(snowboy-detect.o): Relocations in generic ELF (EM: 183)
/usr/bin/ld: ../..//lib/aarch64-ubuntu1604/libsnowboy-detect.a(snowboy-detect.o): Relocations in generic ELF (EM: 183)
../..//lib/aarch64-ubuntu1604/libsnowboy-detect.a: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
Makefile:73: recipe for target '_snowboydetect.so' failed
make: *** [_snowboydetect.so] Error 1

I'm completely buzzed on what's causing this. Also, changing SNOWBOYDETECTFILE to $(TOPDIR)/lib/ubuntu64/libsnowboy-detect.a yields the following:

lto1: fatal error: bytecode stream in file ‘snowboy-detect-swig.o’ generated with LTO version 8.1 instead of the expected 7.3
compilation terminated.
lto-wrapper: fatal error: g++ returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
Makefile:73: recipe for target '_snowboydetect.so' failed
make: *** [_snowboydetect.so] Error 1

Any help regarding this matter would be much appreciated.

Fixed by changing SNOWBOYDETECTFILE to $(TOPDIR)/lib/ubuntu64/libsnowboy-detect.a and compiling without link time optimization:

CXXFLAGS += -std=c++0x -fno-lto