What should I fix in the Makefile?

jalal@klein:~/computer_vision/mmglm_neuroimage_private-master/lib/c++/src$ make
g++ -g -Wall -Wextra -Wunreachable-code -static mmglm_spd_multithread.cpp -o ../bin/mmglm_spd_par -fopenmp -O3 -llapack -lblas -lpthread -lgfortran  -lboost_system -lboost_filesystem -I ../lib/armadillo-3.930.2/include/
mmglm_spd_multithread.cpp: In function ‘int main(int, char**)’:
mmglm_spd_multithread.cpp:117:10: warning: unused variable ‘length’ [-Wunused-variable]
   size_t length=0;//initializing length as a counter
          ^
/usr/lib/gcc/x86_64-linux-gnu/5/libgomp.a(target.o): In function `gomp_target_init':
(.text+0xba): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.a(write.o): In function `write_float':
(.text.write_float+0xb2): undefined reference to `signbitq'
/usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.a(write.o): In function `write_float':
(.text.write_float+0xbf): undefined reference to `finiteq'
/usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.a(write.o): In function `write_float':
(.text.write_float+0x133): undefined reference to `quadmath_snprintf'
/usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.a(write.o): In function `write_float':
(.text.write_float+0x254): undefined reference to `finiteq'
/usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.a(write.o): In function `write_float':
(.text.write_float+0xaff): undefined reference to `isnanq'
/usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.a(write.o): In function `write_float':
(.text.write_float+0xb83): undefined reference to `quadmath_snprintf'
/usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.a(write.o): In function `write_float':
(.text.write_float+0xf7d): undefined reference to `quadmath_snprintf'
/usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.a(write.o): In function `write_float':
(.text.write_float+0x10d8): undefined reference to `quadmath_snprintf'
collect2: error: ld returned 1 exit status
Makefile:13: recipe for target 'multithread' failed
make: *** [multithread] Error 1

I have: $ g++ -v Using built-in specs.

COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.2' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.2) 

and

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:    16.04
Codename:   xenial

Here's the related lines from Makefile:

CC= g++
CFLAGS= -Wall -Wextra -Wunreachable-code -static
#-static
#INC_PATH=  -I ../lib/armadillo-7.100.3/include/
INC_PATH=  -I ../lib/armadillo-3.930.2/include/
LIB_PATH=  -llapack -lblas -lpthread -lgfortran  -lboost_system -lboost_filesystem
#LIB_PATH= -DARMA_DONT_USE_WRAPPER 
#lrefblas
all: multithread mmglm show_arma_mx armabin2asciifull armabinequaltotxt
multithread_fast:
        $(CC) -g $(CFLAGS) mmglm_spd_multithread_fast.cpp -o ../bin/mmglm_spd_par_fast -fopenmp -O3 $(LIB_PATH) $(INC_PATH)
multithread:
        $(CC) -g $(CFLAGS) mmglm_spd_multithread.cpp -o ../bin/mmglm_spd_par -fopenmp -O3 $(LIB_PATH) $(INC_PATH)

I even tried having -lquadmath flag but got the same error:

multithread:
        $(CC) -g $(CFLAGS) mmglm_spd_multithread.cpp -o ../bin/mmglm_spd_par -fopenmp -lquadmath -O3 $(LIB_PATH) $(INC_PATH)

I also have the following packages installed:

 2043  sudo apt-get install liblapack-dev 
 2044  sudo apt-get install liblapacke
 2045  sudo apt-get install liblapacke-dev
 2046  sudo apt-get install libblas-dev 
 2048  sudo apt-get install gfortran
 2049  sudo apt-get install libatlas-base-dev 
 2050  sudo apt-get install liblapack3
 2052  sudo apt-get install libarmadillo-dev
 2056  sudo apt-get install libarmadillo6
 2057  sudo apt-get install libarmadillo6-dbgsym
 2071  sudo apt-get install libboost-dev
 2077  sudo apt-get install libboost-system-dev
 2080  sudo apt-get install libboost-filesystem-dev
share|improve this question
    
Did you read the warning? – Lightness Races in Orbit Sep 27 '16 at 17:02
    
I see in answers they say do this extern "C" { #include "quadmath.h" } but I am not sure where and how! gcc.gnu.org/ml/gcc-help/2011-06/msg00148.html – Mona Jalal Sep 27 '16 at 17:04
1  
-lm? ________ – cjhanks Sep 27 '16 at 17:07
    
@cjhanks if you mean ` $(CC) -g $(CFLAGS) mmglm_spd_multithread.cpp -o ../bin/mmglm_spd_par -fopenmp -lm -O3 $(LIB_PATH) $(INC_PATH)` no it didn't help! – Mona Jalal Sep 27 '16 at 17:08
1  
Since its libgfortran that needs these symbols, you need to add -lquadmath after -lgfortran – nos Sep 27 '16 at 17:40
up vote 1 down vote accepted

Solved the problem by adding -lquadmath at the end of this line:

LIB_PATH=  -llapack -lblas -lpthread -lgfortran  -lboost_system -lboost_filesystem -lquadmath
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.