Ошибка установки pHash в Ubuntu

Поэтому я пытался установить библиотеки pHash в Ubuntu. Я установил все необходимые пакеты с помощью этой команды:

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$

Некоторые могут помочь мне понять, что не так?

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
2

Другие решения

Это ошибка в 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, возможно, более новая версия уже устраняет эти проблемы. Кроме того, проверьте их систему отслеживания ошибок, возможно, кто-то уже сообщил об этой проблеме с соответствующим исправлением или обходным решением.

0

По вопросам рекламы [email protected]