所以我试图在Ubuntu上安装pHash库。我已经安装了运行此命令的所有必需软件包:
apt-get install libavformat-dev libmpg123-dev libsamplerate-dev libsndfile-dev cimg-dev libavcodec-dev ffmpeg libswscale-dev
然后我运行./configure,一切似乎都没问题,我得到了这个:
francesco@francesco-VirtualBox:~$ cd '/home/francesco/Scrivania/pHash-0.9.6'
francesco@francesco-VirtualBox:~/Scrivania/pHash-0.9.6$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for /etc/gentoo-release... no
checking for /etc/redhat-release... no
checking for /etc/slackware-version... no
checking for /etc/debian_version... yes
checking for /etc/SuSErelease... no
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether ln -s works... yes
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
*** Configuring image hash ***
checking CImg.h usability... yes
checking CImg.h presence... yes
checking for CImg.h... yes
*** Configuring video Hash ***
checking whether FFmpeg is present... checking for avcodec_alloc_frame in -lavcodec... yes
checking for av_log_set_level in -lavutil... yes
checking for av_read_frame in -lavformat... yes
checking for sws_getContext in -lswscale... yes
*** Configuring audio hash ***
checking whether sndfile lib is present... checking for sf_readf_float in -lsndfile... yes
checking whether samplerate lib is present... checking for src_process in -lsamplerate... yes
checking whether libmpg123 is present... checking for mpg123_init in -lmpg123... yes
checking for png_create_read_struct in -lpng... yes
checking for jpeg_read_header in -ljpeg... yes
checking for fftw_plan_dft_r2c_1d in -lfftw3... no
checking for size_t... yes
checking for uint32_t... yes
checking for uint8_t... yes
checking for uint64_t... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating examples/Makefile
config.status: creating pHash.pc
config.status: creating bindings/Makefile
config.status: creating bindings/java/Makefile
config.status: creating config.h
config.status: creating pHash-config.h
config.status: pHash-config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
francesco@francesco-VirtualBox:~/Scrivania/pHash-0.9.6$ ^C
francesco@francesco-VirtualBox:~/Scrivania/pHash-0.9.6$
但是当我尝试make命令时,我得到了这些错误:
francesco@francesco-VirtualBox:~/Scrivania/pHash-0.9.6$ make
make all-recursive
make[1]: ingresso nella directory "/home/francesco/Scrivania/pHash-0.9.6"
Making all in src
make[2]: ingresso nella directory "/home/francesco/Scrivania/pHash-0.9.6/src"
/bin/bash ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -pthread -I/usr/local/include -I/usr/include/ffmpeg -Dcimg_use_png -Dcimg_use_jpeg -O2 -ffast-math -O3 -MT pHash.lo -MD -MP -MF .deps/pHash.Tpo -c -o pHash.lo pHash.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -pthread -I/usr/local/include -I/usr/include/ffmpeg -Dcimg_use_png -Dcimg_use_jpeg -O2 -ffast-math -O3 -MT pHash.lo -MD -MP -MF .deps/pHash.Tpo -c pHash.cpp -fPIC -DPIC -o .libs/pHash.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -pthread -I/usr/local/include -I/usr/include/ffmpeg -Dcimg_use_png -Dcimg_use_jpeg -O2 -ffast-math -O3 -MT pHash.lo -MD -MP -MF .deps/pHash.Tpo -c pHash.cpp -o pHash.o >/dev/null 2>&1
mv -f .deps/pHash.Tpo .deps/pHash.Plo
/bin/bash ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -pthread -I/usr/local/include -I/usr/include/ffmpeg -Dcimg_use_png -Dcimg_use_jpeg -O2 -ffast-math -O3 -MT audiophash.lo -MD -MP -MF .deps/audiophash.Tpo -c -o audiophash.lo audiophash.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -pthread -I/usr/local/include -I/usr/include/ffmpeg -Dcimg_use_png -Dcimg_use_jpeg -O2 -ffast-math -O3 -MT audiophash.lo -MD -MP -MF .deps/audiophash.Tpo -c audiophash.cpp -fPIC -DPIC -o .libs/audiophash.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -pthread -I/usr/local/include -I/usr/include/ffmpeg -Dcimg_use_png -Dcimg_use_jpeg -O2 -ffast-math -O3 -MT audiophash.lo -MD -MP -MF .deps/audiophash.Tpo -c audiophash.cpp -o audiophash.o >/dev/null 2>&1
mv -f .deps/audiophash.Tpo .deps/audiophash.Plo
/bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -pthread -I/usr/local/include -I/usr/include/ffmpeg -Dcimg_use_png -Dcimg_use_jpeg -O2 -ffast-math -O3 -MT ph_fft.lo -MD -MP -MF .deps/ph_fft.Tpo -c -o ph_fft.lo ph_fft.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -pthread -I/usr/local/include -I/usr/include/ffmpeg -Dcimg_use_png -Dcimg_use_jpeg -O2 -ffast-math -O3 -MT ph_fft.lo -MD -MP -MF .deps/ph_fft.Tpo -c ph_fft.c -fPIC -DPIC -o .libs/ph_fft.o
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -pthread -I/usr/local/include -I/usr/include/ffmpeg -Dcimg_use_png -Dcimg_use_jpeg -O2 -ffast-math -O3 -MT ph_fft.lo -MD -MP -MF .deps/ph_fft.Tpo -c ph_fft.c -o ph_fft.o >/dev/null 2>&1
mv -f .deps/ph_fft.Tpo .deps/ph_fft.Plo
/bin/bash ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -pthread -I/usr/local/include -I/usr/include/ffmpeg -Dcimg_use_png -Dcimg_use_jpeg -O2 -ffast-math -O3 -MT cimgffmpeg.lo -MD -MP -MF .deps/cimgffmpeg.Tpo -c -o cimgffmpeg.lo cimgffmpeg.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -pthread -I/usr/local/include -I/usr/include/ffmpeg -Dcimg_use_png -Dcimg_use_jpeg -O2 -ffast-math -O3 -MT cimgffmpeg.lo -MD -MP -MF .deps/cimgffmpeg.Tpo -c cimgffmpeg.cpp -fPIC -DPIC -o .libs/cimgffmpeg.o
cimgffmpeg.cpp: In function 'int ReadFrames(VFInfo*, cimg_library::CImgList<unsigned char>*, unsigned int, unsigned int)':
cimgffmpeg.cpp:103:9: warning: 'AVFrame* avcodec_alloc_frame()' is deprecated (declared at /usr/include/libavcodec/avcodec.h:3195) [-Wdeprecated-declarations]
pFrame=avcodec_alloc_frame();
^
cimgffmpeg.cpp:103:29: warning: 'AVFrame* avcodec_alloc_frame()' is deprecated (declared at /usr/include/libavcodec/avcodec.h:3195) [-Wdeprecated-declarations]
pFrame=avcodec_alloc_frame();
^
cimgffmpeg.cpp:108:29: warning: 'AVFrame* avcodec_alloc_frame()' is deprecated (declared at /usr/include/libavcodec/avcodec.h:3195) [-Wdeprecated-declarations]
AVFrame *pConvertedFrame = avcodec_alloc_frame();
^
cimgffmpeg.cpp:108:49: warning: 'AVFrame* avcodec_alloc_frame()' is deprecated (declared at /usr/include/libavcodec/avcodec.h:3195) [-Wdeprecated-declarations]
AVFrame *pConvertedFrame = avcodec_alloc_frame();
^
cimgffmpeg.cpp: In function 'int NextFrames(VFInfo*, cimg_library::CImgList<unsigned char>*)':
cimgffmpeg.cpp:257:9: warning: 'AVFrame* avcodec_alloc_frame()' is deprecated (declared at /usr/include/libavcodec/avcodec.h:3195) [-Wdeprecated-declarations]
pFrame=avcodec_alloc_frame();
^
cimgffmpeg.cpp:257:29: warning: 'AVFrame* avcodec_alloc_frame()' is deprecated (declared at /usr/include/libavcodec/avcodec.h:3195) [-Wdeprecated-declarations]
pFrame=avcodec_alloc_frame();
^
cimgffmpeg.cpp:260:29: warning: 'AVFrame* avcodec_alloc_frame()' is deprecated (declared at /usr/include/libavcodec/avcodec.h:3195) [-Wdeprecated-declarations]
AVFrame *pConvertedFrame = avcodec_alloc_frame();
^
cimgffmpeg.cpp:260:49: warning: 'AVFrame* avcodec_alloc_frame()' is deprecated (declared at /usr/include/libavcodec/avcodec.h:3195) [-Wdeprecated-declarations]
AVFrame *pConvertedFrame = avcodec_alloc_frame();
^
cimgffmpeg.cpp: In function 'float fps(const char*)':
cimgffmpeg.cpp:434:47: error: 'AVStream' has no member named 'r_frame_rate'
int num = (pFormatCtx->streams[videoStream]->r_frame_rate).num;
^
cimgffmpeg.cpp:435:47: error: 'AVStream' has no member named 'r_frame_rate'
int den = (pFormatCtx->streams[videoStream]->r_frame_rate).den;
^
Makefile:388: set di istruzioni per l'obiettivo "cimgffmpeg.lo" non riuscito
make[2]: *** [cimgffmpeg.lo] Errore 1
make[2]: uscita dalla directory "/home/francesco/Scrivania/pHash-0.9.6/src"
Makefile:419: set di istruzioni per l'obiettivo "all-recursive" non riuscito
make[1]: *** [all-recursive] Errore 1
make[1]: uscita dalla directory "/home/francesco/Scrivania/pHash-0.9.6"
Makefile:298: set di istruzioni per l'obiettivo "all" non riuscito
make: *** [all] Errore 2
francesco@francesco-VirtualBox:~/Scrivania/pHash-0.9.6$
有些人可以帮我理解错误吗?
答案 0 :(得分:2)
看起来库pHash
不再维护了。但是,如果使用库功能需要一些快速解决方案,则可以将其安装在兼容的Linux版本上。在这种情况下,可以设置一些虚拟服务器实例。
这个库对于Ubuntu 10.04来说太新了,因为它使用了2011-2013中引入的功能。
图书馆对于Ubuntu 14.04而言太旧了。
我能够在开箱即用的Ubuntu 12.10上构建库(也可以尝试12.04)。
方法文档:
# install libraries listed in the question
sudo apt-get install libavformat-dev libmpg123-dev libsamplerate-dev libsndfile-dev cimg-dev libavcodec-dev ffmpeg libswscale-dev
# some other libraries used by pHash can be also installed
sudo apt-get install libpng12-dev libjpeg62-dev libfftw3-dev
# configurate with custom install path
./configure --prefix=/home/username/dev/
make
make install
# build test application providing header and library path
g++ phash-test.cpp -I../include -L../lib -lpHash -o phash-test
# run test application providing library search path
LD_LIBRARY_PATH=/home/username/dev/lib:$LD_LIBRARY_PATH ./phash-test
答案 1 :(得分:0)
这是pHash中的一个错误,就像那样简单。例如,此警告
cimgffmpeg.cpp: In function 'int ReadFrames(VFInfo*, cimg_library::CImgList<unsigned char>*, unsigned int, unsigned int)':
cimgffmpeg.cpp:103:9: warning: 'AVFrame* avcodec_alloc_frame()' is deprecated (declared at /usr/include/libavcodec/avcodec.h:3195) [-Wdeprecated-declarations]
已经显示代码使用了不应使用的功能,这通常是在功能被其他功能替换时的情况。这通常是未维护的代码的标志。然后,你最终得到错误
cimgffmpeg.cpp:434:47: error: 'AVStream' has no member named 'r_frame_rate'
这意味着代码编写的AVStream
类型的版本不是提供的版本。
您应该检查pHash更新,也许新版本已经修复了这些问题。另外,检查他们的错误跟踪系统,也许某人已根据错误修正或解决方法报告了此问题。