c++ - (.text.write_float+0xf7d) : undefined reference to `quadmath_snprintf'

标签 c++ ubuntu makefile g++

我应该在 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

我有:
$ g++ -v
使用内置规范。
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) 


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

这是来自 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)

我什至尝试使用 -lquadmath 标志,但得到了同样的错误:
multithread:
        $(CC) -g $(CFLAGS) mmglm_spd_multithread.cpp -o ../bin/mmglm_spd_par -fopenmp -lquadmath -O3 $(LIB_PATH) $(INC_PATH)

我还安装了以下软件包:
 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

最佳答案

通过添加 -lquadmath 解决了问题在这一行的末尾:

LIB_PATH=  -llapack -lblas -lpthread -lgfortran  -lboost_system -lboost_filesystem -lquadmath

关于c++ - (.text.write_float+0xf7d) : undefined reference to `quadmath_snprintf' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39730418/

相关文章:

c++ - 如何在 C++ 中将消息发送到 azure IOT hub

c++ - setjmp 和 longjump 实现线程

c++ - 为什么我的makefile文件返回错误193?

c - 生成的依赖项与生成的文件

使用模块为 Fortran-90+ 进行 CMake 并行构建

c++ - 指针和 char*

c++ - 请解释为什么文件路径的开头有一个S?

ubuntu - GNOME 入门

c - Linux ubuntu下c中的execl命令

docker - 无根模式 Docker 守护程序在重新登录 (SSH) 后未运行