Skip to content

Instantly share code, notes, and snippets.

@benjaminjackson
Created May 12, 2014 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjaminjackson/597ac027fb1a1e088fcd to your computer and use it in GitHub Desktop.
Save benjaminjackson/597ac027fb1a1e088fcd to your computer and use it in GitHub Desktop.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/ben/.rbenv/versions/1.9.3-p448/bin/ruby extconf.rb
tar xzf /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/pHash-0.9.6.tar.gz 2>&1
env CXXFLAGS=' -pthread' CFLAGS=' -I/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/include -L/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib -L/usr/local/lib -x c++ ' LDFLAGS=' -L/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib -L/usr/local/lib -L. -L/Users/ben/.rbenv/versions/1.9.3-p448/lib ' ./configure --prefix=/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/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... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
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... 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... no
checking for /etc/SuSErelease... no
checking build system type... i386-apple-darwin13.1.0
checking host system type... i386-apple-darwin13.1.0
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... -D_THREAD_SAFE
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... 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... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert i386-apple-darwin13.1.0 file names to i386-apple-darwin13.1.0 format... func_convert_file_noop
checking how to convert i386-apple-darwin13.1.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for objdump... no
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... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm output from gcc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin13.1.0 dyld
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++... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fno-common -DPIC
checking if g++ PIC flag -fno-common -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin13.1.0 dyld
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... no
checking for jpeg_read_header in -ljpeg... no
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: executing depfiles commands
config.status: executing libtool commands
make || true 2>&1
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in src
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -D_THREAD_SAFE -I/usr/local/include -pthread -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.. -D_THREAD_SAFE -I/usr/local/include -pthread -ffast-math -O3 -MT pHash.lo -MD -MP -MF .deps/pHash.Tpo -c pHash.cpp -fno-common -DPIC -o pHash.o
pHash.cpp:415:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.
mv -f .deps/pHash.Tpo .deps/pHash.Plo
/bin/sh ../libtool --tag=CXX --mode=link g++ -pthread -ffast-math -O3 -no-undefined -L/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib -L/usr/local/lib -L. -L/Users/ben/.rbenv/versions/1.9.3-p448/lib -L/usr/local/lib -o libpHash.la -rpath /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib pHash.lo
libtool: link: ar cru .libs/libpHash.a pHash.o
libtool: link: ranlib .libs/libpHash.a
libtool: link: ( cd ".libs" && rm -f "libpHash.la" && ln -s "../libpHash.la" "libpHash.la" )
Making all in bindings
make[3]: Nothing to be done for `all-am'.
Making all in examples
g++ -DHAVE_CONFIG_H -I. -I.. -I../src -D_THREAD_SAFE -I/usr/local/include -pthread -ffast-math -O3 -MT test_texthash.o -MD -MP -MF .deps/test_texthash.Tpo -c -o test_texthash.o test_texthash.cpp
test_texthash.cpp:68:26: warning: format specifies type 'intmax_t' (aka 'long') but the argument has type 'off_t' (aka 'long long') [-Wformat]
printf(" %jd %jd %d\n", matches[j].first_index, matches[j].second_index,matches[j].length);
~~~ ^~~~~~~~~~~~~~~~~~~~~~
%lld
test_texthash.cpp:68:50: warning: format specifies type 'intmax_t' (aka 'long') but the argument has type 'off_t' (aka 'long long') [-Wformat]
printf(" %jd %jd %d\n", matches[j].first_index, matches[j].second_index,matches[j].length);
~~~ ^~~~~~~~~~~~~~~~~~~~~~~
%lld
2 warnings generated.
mv -f .deps/test_texthash.Tpo .deps/test_texthash.Po
/bin/sh ../libtool --tag=CXX --mode=link g++ -pthread -ffast-math -O3 -L/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib -L/usr/local/lib -L. -L/Users/ben/.rbenv/versions/1.9.3-p448/lib -L/usr/local/lib -o test_texthash test_texthash.o ../src/libpHash.la
libtool: link: g++ -pthread -ffast-math -O3 -o test_texthash test_texthash.o -Wl,-bind_at_load -L/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib -L/usr/local/lib -L. -L/Users/ben/.rbenv/versions/1.9.3-p448/lib ../src/.libs/libpHash.a -pthread
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
ld: warning: directory not found for option '-L/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib'
g++ -DHAVE_CONFIG_H -I. -I.. -I../src -D_THREAD_SAFE -I/usr/local/include -pthread -ffast-math -O3 -MT test_texthash2.o -MD -MP -MF .deps/test_texthash2.Tpo -c -o test_texthash2.o test_texthash2.cpp
mv -f .deps/test_texthash2.Tpo .deps/test_texthash2.Po
/bin/sh ../libtool --tag=CXX --mode=link g++ -pthread -ffast-math -O3 -L/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib -L/usr/local/lib -L. -L/Users/ben/.rbenv/versions/1.9.3-p448/lib -L/usr/local/lib -o test_texthash2 test_texthash2.o ../src/libpHash.la
libtool: link: g++ -pthread -ffast-math -O3 -o test_texthash2 test_texthash2.o -Wl,-bind_at_load -L/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib -L/usr/local/lib -L. -L/Users/ben/.rbenv/versions/1.9.3-p448/lib ../src/.libs/libpHash.a -pthread
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
ld: warning: directory not found for option '-L/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib'
g++ -DHAVE_CONFIG_H -I. -I.. -I../src -D_THREAD_SAFE -I/usr/local/include -pthread -ffast-math -O3 -MT test_imagephash.o -MD -MP -MF .deps/test_imagephash.Tpo -c -o test_imagephash.o test_imagephash.cpp
mv -f .deps/test_imagephash.Tpo .deps/test_imagephash.Po
/bin/sh ../libtool --tag=CXX --mode=link g++ -pthread -ffast-math -O3 -L/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib -L/usr/local/lib -L. -L/Users/ben/.rbenv/versions/1.9.3-p448/lib -L/usr/local/lib -o test_image test_imagephash.o ../src/libpHash.la
libtool: link: g++ -pthread -ffast-math -O3 -o test_image test_imagephash.o -Wl,-bind_at_load -L/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib -L/usr/local/lib -L. -L/Users/ben/.rbenv/versions/1.9.3-p448/lib ../src/.libs/libpHash.a -pthread
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
ld: warning: directory not found for option '-L/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib'
g++ -DHAVE_CONFIG_H -I. -I.. -I../src -D_THREAD_SAFE -I/usr/local/include -pthread -ffast-math -O3 -MT test_mhimagehash.o -MD -MP -MF .deps/test_mhimagehash.Tpo -c -o test_mhimagehash.o test_mhimagehash.cpp
mv -f .deps/test_mhimagehash.Tpo .deps/test_mhimagehash.Po
/bin/sh ../libtool --tag=CXX --mode=link g++ -pthread -ffast-math -O3 -L/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib -L/usr/local/lib -L. -L/Users/ben/.rbenv/versions/1.9.3-p448/lib -L/usr/local/lib -o test_mhimagehash test_mhimagehash.o ../src/libpHash.la
libtool: link: g++ -pthread -ffast-math -O3 -o test_mhimagehash test_mhimagehash.o -Wl,-bind_at_load -L/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib -L/usr/local/lib -L. -L/Users/ben/.rbenv/versions/1.9.3-p448/lib ../src/.libs/libpHash.a -pthread
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
ld: warning: directory not found for option '-L/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib'
make[2]: Nothing to be done for `all-am'.
make install || true 2>&1
Making install in src
.././install-sh -c -d '/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib'
/bin/sh ../libtool --mode=install /usr/bin/install -c libpHash.la '/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib'
libtool: install: /usr/bin/install -c .libs/libpHash.lai /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib/libpHash.la
libtool: install: /usr/bin/install -c .libs/libpHash.a /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib/libpHash.a
libtool: install: chmod 644 /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib/libpHash.a
libtool: install: ranlib /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib/libpHash.a
.././install-sh -c -d '/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/include'
/usr/bin/install -c -m 644 pHash.h '/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/include'
Making install in bindings
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
Making install in examples
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Nothing to be done for `install-exec-am'.
./install-sh -c -d '/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/include'
/usr/bin/install -c -m 644 pHash-config.h '/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/include'
./install-sh -c -d '/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib/pkgconfig'
/usr/bin/install -c -m 644 pHash.pc '/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1/ext/phashion_ext/lib/pkgconfig'
mv CImg.h ../include 2>&1
checking for sqlite3ext.h... *** 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=/Users/ben/.rbenv/versions/1.9.3-p448/bin/ruby
/Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
from /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
from extconf.rb:46:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/phashion-1.1.1 for inspection.
Results logged to /Users/ben/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/extensions/x86_64-darwin-13/1.9.1-static/phashion-1.1.1/gem_make.out
An error occurred while installing phashion (1.1.1), and Bundler cannot continue.
Make sure that `gem install phashion -v '1.1.1'` succeeds before bundling.
@sveiss
Copy link

sveiss commented Jul 11, 2014

For the benefit of anyone else Googling this error and finding only this hit, check mkmf.log. I was missing a 'brew install libjpeg'.

Yes, for a configure test checking for SQLite...

@andreas-venturini
Copy link

On Ubuntu install libjpeg-dev and libpng-dev

@westonplatter
Copy link

thanks for the question/solution. Added it to the pHashion README.md. https://github.com/westonplatter/phashion/pull/49/files#diff-04c6e90faac2675aa89e2176d2eec7d8R36

@wowawiwa
Copy link

wowawiwa commented Dec 9, 2014

I was missing both 'brew install libjpeg' and 'brew install libpng'

@pabelnl
Copy link

pabelnl commented May 9, 2016

Installing libjpeg-dev and libpng-dev did it for me, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment