westonplatter / phashion

Ruby wrapper around pHash, the perceptual hash library for detecting duplicate multimedia files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to install phashion 1.2.0

Blokh opened this issue · comments

Greetings, I've got issues installing phashion gem on Ubuntu 20.04.
( after installing all the necessary dependencies )

Is anyone able to help me with this issue?

`blokh@blokh-ThinkPad-P15-Gen-1:~/erated/core$ gem install phashion -v '1.2.0' --verbose
HEAD https://rubygems.org/api/v1/dependencies
200 OK
GET https://rubygems.org/api/v1/dependencies?gems=phashion
200 OK
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/.document
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/.gitignore
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/.travis.yml
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/CHANGES.md
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/Gemfile
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/LICENSE
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/README.md
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/Rakefile
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/ext/phashion_ext/extconf.rb
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/ext/phashion_ext/pHash-0.9.6.tar.gz
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/ext/phashion_ext/phashion_ext.c
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/lib/phashion.rb
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/lib/phashion/version.rb
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/phashion.gemspec
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/gif/Broccoli_Super_Food.gif
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/helper.rb
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/jpg/86x86-0a1e.jpeg
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/jpg/86x86-83d6.jpeg
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/jpg/86x86-a855.jpeg
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/jpg/Broccoli_Super_Food.100px.jpg
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/jpg/Broccoli_Super_Food.bounding-box.jpg
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/jpg/Broccoli_Super_Food.bw.jpg
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/jpg/Broccoli_Super_Food.color-corrected.jpg
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/jpg/Broccoli_Super_Food.horizontal-flip.jpg
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/jpg/Broccoli_Super_Food.jpg
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/jpg/Broccoli_Super_Food.lossy.jpg
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/jpg/Broccoli_Super_Food.rotate5cw.jpg
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/jpg/avatar.jpg
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/jpg/b32aade8c590e2d776c24f35868f0c7a588f51e1.jpeg
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/jpg/df9cc82f5b32d7463f36620c61854fde9d939f7f.jpeg
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/jpg/e7397898a7e395c2524978a5e64de0efabf08290.jpeg
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/png/Broccoli_Super_Food.png
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/png/grass.png
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/png/linux.png
/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/test/test_phashion.rb
Building native extensions. This could take a while...
current directory: /home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/ext/phashion_ext
["/home/blokh/.rvm/rubies/ruby-2.5.5/bin/ruby", "-I", "/home/blokh/.rvm/rubies/ruby-2.5.5/lib/ruby/site_ruby/2.5.0", "-r", "./siteconf20210330-77373-watoea.rb", "extconf.rb"]
tar xzf /home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/ext/phashion_ext/pHash-0.9.6.tar.gz 2>&1
env CXXFLAGS=' -pthread' CFLAGS=' -I/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/ext/phashion_ext/include -L/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/ext/phashion_ext/lib -L/usr/local/lib -x c++ ' LDFLAGS=' -L/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/ext/phashion_ext/lib -L/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic' ./configure --prefix=/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/ext/phashion_ext --disable-audio-hash --disable-video-hash --disable-shared --with-pic 2>&1
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
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... no
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... unsupported
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... no
checking whether pthreads work with -pthreads... no
checking whether pthreads work with -mthreads... no
checking for the pthreads library -lpthread... no
checking whether pthreads work with --thread-safe... no
checking whether pthreads work with -mt... no
checking for pthread-config... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... no
checking for sys/types.h... no
checking for sys/stat.h... no
checking for stdlib.h... no
checking for string.h... no
checking for memory.h... no
checking for strings.h... no
checking for inttypes.h... no
checking for stdint.h... no
checking for unistd.h... no
checking whether ln -s works... yes
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for non-GNU ld... /bin/ld
checking if the linker (/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 /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 for gcc option to produce PIC... -DPIC
checking if gcc PIC flag -DPIC works... no
checking if gcc static flag works... no
checking if gcc supports -c -o file.o... no
checking if gcc supports -c -o file.o... (cached) no
checking if we can lock with hard links... yes
checking whether the gcc linker (/bin/ld -m elf_x86_64) supports shared libraries... yes
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... no
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /bin/ld -m elf_x86_64
checking if the linker (/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/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 (/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... no
checking CImg.h presence... no
checking for CImg.h... no
checking whether CImg.h is in the current or src directory.... 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... unsigned int
checking for uint8_t... unsigned char
checking for uint64_t... no
configure: error:

*** Required type uint64_t not found.
pHash requires 64-bit integers for video and image hashes.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/blokh/.rvm/rubies/ruby-2.5.5/bin/$(RUBY_BASE_NAME)
Traceback (most recent call last):
4: from extconf.rb:14:in <main>' 3: from extconf.rb:14:in chdir'
2: from extconf.rb:22:in block in <main>' 1: from extconf.rb:22:in chdir'
extconf.rb:24:in `block (2 levels) in

': 'env CXXFLAGS=' -pthread' CFLAGS=' -I/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/ext/phashion_ext/include -L/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/ext/phashion_ext/lib -L/usr/local/lib -x c++ ' LDFLAGS=' -L/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/ext/phashion_ext/lib -L/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic' ./configure --prefix=/home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/ext/phashion_ext --disable-audio-hash --disable-video-hash --disable-shared --with-pic 2>&1' failed (RuntimeError)
ERROR: Error installing phashion:
ERROR: Failed to build gem native extension.

current directory: /home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0/ext/phashion_ext

/home/blokh/.rvm/rubies/ruby-2.5.5/bin/ruby -I /home/blokh/.rvm/rubies/ruby-2.5.5/lib/ruby/site_ruby/2.5.0 -r ./siteconf20210330-77373-watoea.rb extconf.rb
Building has failed. See above output for more information on the failure.
extconf failed, exit code 1

Gem files will remain installed in /home/blokh/.rvm/gems/ruby-2.5.5/gems/phashion-1.2.0 for inspection.
Results logged to /home/blokh/.rvm/gems/ruby-2.5.5/extensions/x86_64-linux/2.5.0/phashion-1.2.0/gem_make.out

blokh@blokh-ThinkPad-P15-Gen-1:~/erated/core$ sudo apt install libjpeg-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libjpeg-dev is already the newest version (8c-2ubuntu8).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

blokh@blokh-ThinkPad-P15-Gen:/erated/core$ sudo apt install libpng-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libpng-dev is already the newest version (1.6.37-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

blokh@blokh-ThinkPad-P15-Gen:/erated/core$ sudo apt install sqlite3
Reading package lists... Done
Building dependency tree
Reading state information... Done
sqlite3 is already the newest version (3.31.1-4ubuntu0.2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
`

I just attempted to gem install phashion under Ruby v3.1.2p20 on MacOs Big Sur and it also failed to compile the extension.

@westonplatter did you get my email re offer to help fix installation/compilation issues - may have gone to your spam folder? Short answer is I had to install & use gcc-10 locally to get tests to pass. Note the tests in GitHub workflow use gcc-10 and default installation for @Blokh (OP's OS & mine too) is gcc-9.

@MatzFan solution works! Spent over a week trying to get this to work on Ubuntu 22 which was compiling initially with gcc-12 after switching to gcc-10 everything works fine.