0

我正在尝试在 ubuntu 上安装 pHash 库,我安装了 libfftw3 和所有必需的库。当我运行 ./configure 命令时一切正常,但是当我尝试运行“make”命令时,总是出现此错误:未定义对“fftw_init_threads”的引用。

制作命令:

g551683@sst-p1310007fl:~/Documents/pHash-0.2.9.6$ make
make  all-recursive
make[1]: Entering directory '/home/g551683/Documents/pHash-0.2.9.6'
Making all in src
make[2]: Entering directory '/home/g551683/Documents/pHash-0.2.9.6/src'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/g551683/Documents/pHash-0.2.9.6/src'
Making all in bindings
make[2]: Entering directory '/home/g551683/Documents/pHash-0.2.9.6/bindings'
make[3]: Entering directory '/home/g551683/Documents/pHash-0.2.9.6/bindings'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/g551683/Documents/pHash-0.2.9.6/bindings'
make[2]: Leaving directory '/home/g551683/Documents/pHash-0.2.9.6/bindings'
Making all in examples
make[2]: Entering directory '/home/g551683/Documents/pHash-0.2.9.6/examples'
/bin/sh ../libtool --tag=CXX   --mode=link g++  -O2 -ffast-math -O3  -L/usr/local/lib -lssl -lcrypto -o test_texthash test_texthash.o ../src/libpHash.la -lmpg123 -lsamplerate -lsndfile -lswscale -lavformat -lavutil -lavcodec   -lpng -ljpeg -lfftw3
libtool: link: g++ -O2 -ffast-math -O3 -o .libs/test_texthash test_texthash.o  -L/usr/local/lib ../src/.libs/libpHash.so -lssl -lcrypto /usr/local/lib/libmpg123.so /usr/lib/x86_64-linux-gnu/libltdl.so -ldl /usr/local/lib/libsamplerate.so -lsndfile -lswscale -lavformat -lavutil -lavcodec /usr/local/lib/libpng16.so -lz /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/local/lib/libfftw3.a -lm
test_texthash.o: In function `_GLOBAL__sub_I_main':
test_texthash.cpp:(.text.startup+0x1b1): undefined reference to `fftw_init_threads'
collect2: error: ld returned 1 exit status
Makefile:323: recipe for target 'test_texthash' failed
make[2]: *** [test_texthash] Error 1
make[2]: Leaving directory '/home/g551683/Documents/pHash-0.2.9.6/examples'
Makefile:419: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/g551683/Documents/pHash-0.2.9.6'
Makefile:298: recipe for target 'all' failed
make: *** [all] Error 2

有人可以帮我解决这个错误!

4

1 回答 1

3

文档中

首先,使用并行复杂转换的程序应该-lfftw3_threads -lfftw3 -lm在 Unix 上链接,或者-lfftw3_omp -lfftw3 -lm如果您使用 OpenMP 编译。您还需要链接到负责系统上线程的任何库(例如-lpthread,在 GNU/Linux 上),或者包括启用 OpenMP 的任何编译器标志(例如-fopenmp,使用 gcc)。

您没有链接到该fftw3_threads库,也没有链接到该pthread库。

于 2020-02-28T12:34:39.837 回答