Nokogiri 1.13.3 Gem Install Failure Termux - nokogiri

Here's the thing:
I used this this script trying to install Metasploit 6.
But Nokogiri can't find libm.so.6
I've tried ln -s /system/lib64/libm.so $PREFIX/lib/libm.so.6 to solve this problem,but it didn't work
After some troubleshooting,I think Nokogiri might not completely installed.
I'm not sure about which part I've missed.
pls help
Device:Realme X50
OS:Android 10
$ gem install nokogiri --platform=ruby -- --use-system-libraries
current directory: /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/nokogiri-1.13.3/ext/nokogiri
/data/data/com.termux/files/usr/bin/ruby -I /data/data/com.termux/files/usr/lib/ruby/3.1.0 -r ./siteconf20220228-27822-xbzj3s.rb extconf.rb --use-system-libraries
checking for whether -std=c99 is accepted as CFLAGS... yes
checking for whether -Wno-declaration-after-statement is accepted as CFLAGS... yes
checking for whether -g is accepted as CFLAGS... yes
checking for whether -Winline is accepted as CFLAGS... yes
checking for whether -Wmissing-noreturn is accepted as CFLAGS... yes
Building nokogiri using system libraries.
checking for gzdopen() in -lz... yes
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
checking for libxml-2.0 using `pkg_config`... yes: ["-I/data/data/com.termux/files/usr/include/libxml2 ", "-L/data/data/com.termux/files/usr/lib", "-lxml2"]
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... yes
checking for exsltFuncRegister() in -lexslt... yes
Using mini_portile version 2.8.0
---------- IMPORTANT NOTICE ----------
Building Nokogiri with a packaged version of libgumbo-1.0.0-nokogiri.
Configuration options: --enable-shared --disable-static
[]
Copying gumbo-parser files into tmp/aarch64-unknown-linux-android/ports/libgumbo/1.0.0-nokogiri/gumbo-parser...
Running 'compile' for libgumbo 1.0.0-nokogiri... ERROR, review '/data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/nokogiri-1.13.3/ext/nokogiri/tmp/aarch64-unknown-linux-android/ports/libgumbo/1.0.0-nokogiri/compile.log' to see what happened. Last lines are:
========================================================================
aarch64-linux-android-clang -fPIC -g -std=c99 -Wall -c -o foreign_attrs.o foreign_attrs.c
aarch64-linux-android-clang -fPIC -g -std=c99 -Wall -c -o parser.o parser.c
parser.c:540:10: warning: cast to smaller integer type 'GumboInsertionMode' from 'void *' [-Wvoid-pointer-to-enum-cast]
return (GumboInsertionMode) modes->data[(modes->length - 1)];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
aarch64-linux-android-clang -fPIC -g -std=c99 -Wall -c -o string_buffer.o string_buffer.c
aarch64-linux-android-clang -fPIC -g -std=c99 -Wall -c -o string_piece.o string_piece.c
aarch64-linux-android-clang -fPIC -g -std=c99 -Wall -c -o svg_attrs.o svg_attrs.c
aarch64-linux-android-clang -fPIC -g -std=c99 -Wall -c -o svg_tags.o svg_tags.c
aarch64-linux-android-clang -fPIC -g -std=c99 -Wall -c -o tag.o tag.c
aarch64-linux-android-clang -fPIC -g -std=c99 -Wall -c -o tag_lookup.o tag_lookup.c
aarch64-linux-android-clang -fPIC -g -std=c99 -Wall -c -o token_buffer.o token_buffer.c
aarch64-linux-android-clang -fPIC -g -std=c99 -Wall -c -o tokenizer.o tokenizer.c
aarch64-linux-android-clang -fPIC -g -std=c99 -Wall -c -o utf8.o utf8.c
aarch64-linux-android-clang -fPIC -g -std=c99 -Wall -c -o util.o util.c
aarch64-linux-android-clang -fPIC -g -std=c99 -Wall -c -o vector.o vector.c
ar rv libgumbo.a ascii.o attribute.o char_ref.o error.o foreign_attrs.o parser.o string_buffer.o string_piece.o svg_attrs.o svg_tags.o tag.o tag_lookup.o token_buffer.o tokenizer.o utf8.o util.o vector.o
make: ar: No such file or directory
make: *** [Makefile:30: libgumbo.a] Error 127
========================================================================
*** 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=/data/data/com.termux/files/usr/bin/$(RUBY_BASE_NAME)
--help
--clean
--prevent-strip
--enable-system-libraries
--disable-system-libraries
--use-system-libraries
--enable-system-libraries
--disable-system-libraries
--use-system-libraries
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-z-dir
--without-z-dir
--with-z-include
--without-z-include=${z-dir}/include
--with-z-lib
--without-z-lib=${z-dir}/lib
--with-zlib
--without-zlib
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
--with-xml2lib
--without-xml2lib
--with-libxml2-dir
--without-libxml2-dir
--with-libxml2-include
--without-libxml2-include=${libxml2-dir}/include
--with-libxml2-lib
--without-libxml2-lib=${libxml2-dir}/lib
--with-libxml2lib
--without-libxml2lib
--with-libxml-2.0-dir
--without-libxml-2.0-dir
--with-libxml-2.0-include
--without-libxml-2.0-include=${libxml-2.0-dir}/include
--with-libxml-2.0-lib
--without-libxml-2.0-lib=${libxml-2.0-dir}/lib
--with-libxml-2.0-config
--without-libxml-2.0-config
--with-pkg-config
--without-pkg-config
--with-xml2lib
--without-xml2lib
--with-xslt-dir
--without-xslt-dir
--with-xslt-include
--without-xslt-include=${xslt-dir}/include
--with-xslt-lib
--without-xslt-lib=${xslt-dir}/lib
--with-xsltlib
--without-xsltlib
--with-exslt-dir
--without-exslt-dir
--with-exslt-include
--without-exslt-include=${exslt-dir}/include
--with-exslt-lib
--without-exslt-lib=${exslt-dir}/lib
--with-exsltlib
--without-exsltlib
--enable-cross-build
--disable-cross-build
/data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/mini_portile2-2.8.0/lib/mini_portile2/mini_portile.rb:460:in `block in execute': Failed to complete compile task (RuntimeError)
from /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/mini_portile2-2.8.0/lib/mini_portile2/mini_portile.rb:426:in `chdir'
from /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/mini_portile2-2.8.0/lib/mini_portile2/mini_portile.rb:426:in `execute'
from extconf.rb:968:in `compile'
from /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/mini_portile2-2.8.0/lib/mini_portile2/mini_portile.rb:187:in `cook'
from extconf.rb:528:in `block (2 levels) in process_recipe'
from extconf.rb:309:in `chdir'
from extconf.rb:309:in `chdir_for_build'
from extconf.rb:528:in `block in process_recipe'
from <internal:kernel>:90:in `tap'
from extconf.rb:427:in `process_recipe'
from extconf.rb:927:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/extensions/aarch64-linux-android/3.1.0/nokogiri-1.13.3/mkmf.log
extconf failed, exit code 1

Sorry for the late response.
I've had a similar issue while installing Rails.
I've fixed this by installing pkg-config and binutils like so:
pkg install pkg-config binutils && gem install pkg-config
If you get missing gumbo, install it by typing pkg install gumbo-parser.
Hope this helps.

Related

gem install pg for ruby on rails

Postgresql will not install on OSX
here is my data below
n error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that gem install pg -v '0.18.4' succeeds before bundling.
chriss-MacBook-Pro:shine chriswilson$ bundle exec install
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 file2
install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 ... fileN directory
install -d [-v] [-g group] [-m mode] [-o owner] directory ...
chriss-MacBook-Pro:shine chriswilson$ gem install pg -v '0.18.4'
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /Users/chriswilson/.rvm/gems/ruby-2.3.0/gems/pg-0.18.4/ext
/Users/chriswilson/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160902-1617-e1qwb1.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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
--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/chriswilson/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/chriswilson/.rvm/gems/ruby-2.3.0/extensions/x86_64-darwin-15/2.3.0/pg-0.18.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/chriswilson/.rvm/gems/ruby-2.3.0/gems/pg-0.18.4 for inspection.
Results logged to /Users/chriswilson/.rvm/gems/ruby-2.3.0/extensions/x86_64-darwin-15/2.3.0/pg-0.18.4/gem_make.out
chriss-MacBook-Pro:shine chriswilson$ gem install pg -v '0.18.4'
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /Users/chriswilson/.rvm/gems/ruby-2.3.0/gems/pg-0.18.4/ext
/Users/chriswilson/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160902-1643-jfhxyo.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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
--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/chriswilson/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/chriswilson/.rvm/gems/ruby-2.3.0/extensions/x86_64-darwin-15/2.3.0/pg-0.18.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/chriswilson/.rvm/gems/ruby-2.3.0/gems/pg-0.18.4 for inspection.
Results logged to /Users/chriswilson/.rvm/gems/ruby-2.3.0/extensions/x86_64-darwin-15/2.3.0/pg-0.18.4/gem_make.out
find_executable: checking for pg_config... -------------------- no
--------------------
find_header: checking for libpq-fe.h... -------------------- no
"gcc -o conftest -I/Users/chriswilson/.rvm/rubies/ruby-2.3.0/include/ruby-2.3.0/x86_64-darwin15 -I/Users/chriswilson/.rvm/rubies/ruby-2.3.0/include/ruby-2.3.0/ruby/backward -I/Users/chriswilson/.rvm/rubies/ruby-2.3.0/include/ruby-2.3.0 -I. -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe conftest.c -L. -L/Users/chriswilson/.rvm/rubies/ruby-2.3.0/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -lruby.2.3.0 -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"gcc -E -I/Users/chriswilson/.rvm/rubies/ruby-2.3.0/include/ruby-2.3.0/x86_64-darwin15 -I/Users/chriswilson/.rvm/rubies/ruby-2.3.0/include/ruby-2.3.0/ruby/backward -I/Users/chriswilson/.rvm/rubies/ruby-2.3.0/include/ruby-2.3.0 -I. -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'libpq-fe.h' file not found
#include <libpq-fe.h>
^
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
/* end */
--------------------
This basically means that you're missing a library or program on your setup. I've had this issue a couple of times now so here are a few different things to try (hopefully one of them will work for you):
Install a common missing library:
brew install libpqxx
gem install pg
Reinstall postgres (not ideal I know):
brew uninstall postgresql
brew install postgresql
gem install pg
Explicitly define path of pg_config:
1) Get location of pg_config
which pg_config
2) pass that path into gem install
gem install pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config
Try this it will work
sudo apt-get install -y libpq-dev build-essential postgresql-server-dev-all libpgsql-ruby postgresql ruby-dev && gem install pg

Exception while installing rails

I am getting following exception while installing rails in Opensuse.
Version of Ruby is ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux-gnu]
/usr/lib64/ruby/gems/2.1.0/gems/nokogiri-1.6.8/test/xslt/test_custom_functions.rb
/usr/lib64/ruby/gems/2.1.0/gems/nokogiri-1.6.8/test/xslt/test_exception_handling.rb
/usr/lib64/ruby/gems/2.1.0/gems/nokogiri-1.6.8/test_all
Building native extensions. This could take a while...
current directory: /usr/lib64/ruby/gems/2.1.0/gems/nokogiri-1.6.8/ext/nokogiri
/usr/bin/ruby.ruby2.1 -r ./siteconf20160625-7943-34np6o.rb extconf.rb
Using pkg-config version 1.1.7
checking if the C compiler accepts ... *** 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}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby.ruby2.1
--help
--clean
/usr/lib64/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/lib64/ruby/2.1.0/mkmf.rb:571:in `block in try_compile'
from /usr/lib64/ruby/2.1.0/mkmf.rb:522:in `with_werror'
from /usr/lib64/ruby/2.1.0/mkmf.rb:571:in `try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from /usr/lib64/ruby/2.1.0/mkmf.rb:621:in `with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:414:in `<main>'
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
Building has failed. See above output for more information on the failure.
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/lib64/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/nokogiri-1.6.8/mkmf.log
extconf failed, exit code 1
Content of mkmf.log is follows:
gcc -o conftest -I/usr/include/ruby-2.1.0/x86_64-linux-gnu -I/usr/include /ruby-2.1.0/ruby/backward -I/usr/include/ruby-2.1.0 -I. -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fno-strict-aliasing -fPIC conftest.c -L. -L/usr/lib64 -L. -fstack-protector -rdynamic -Wl,-export-dynamic -lruby2.1 -lpthread -ldl -lcrypt -lm -lc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */

OSX-10.9.5 and Nokogiri RubyGem 1.6.7.1

I have the following situation WRT nokogiri on my MacBook pro running OSX-10.9.5 and having X-Code 6.2 together with the associated command line tools installed.
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future
sudo gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2
Building native extensions with: '--with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2'
This could take a while...
Successfully installed nokogiri-1.6.7.1
Parsing documentation for nokogiri-1.6.7.1
Installing ri documentation for nokogiri-1.6.7.1
Done installing documentation for nokogiri after 13 seconds
1 gem installed
However, immediately thereafter this happens:
bundle config build.nokogiri --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2
bundle update
. . .
Installing nokogiri 1.6.7.1 (was 1.6.7) with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/opt/local/bin/ruby2.2 -r ./siteconf20151230-65520-1ws37n2.rb extconf.rb --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2
checking if the C compiler accepts ... *** 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
--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=/opt/local/bin/$(RUBY_BASE_NAME)2.2
--help
--clean
/opt/local/lib/ruby2.2/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /opt/local/lib/ruby2.2/2.2.0/mkmf.rb:571:in `block in try_compile'
from /opt/local/lib/ruby2.2/2.2.0/mkmf.rb:522:in `with_werror'
from /opt/local/lib/ruby2.2/2.2.0/mkmf.rb:571:in `try_compile'
from extconf.rb:80:in `nokogiri_try_compile'
from extconf.rb:87:in `block in add_cflags'
from /opt/local/lib/ruby2.2/2.2.0/mkmf.rb:619:in `with_cflags'
from extconf.rb:86:in `add_cflags'
from extconf.rb:336:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/byrnejb/Projects/hll_th/hll_th_proforma/libexec/bundle/lib/gems/nokogiri-1.6.7.1 for inspection.
Results logged to /Users/byrnejb/Projects/hll_th/hll_th_proforma/libexec/bundle/lib/extensions/x86_64-darwin-13/2.2.0/nokogiri-1.6.7.1/gem_make.out
. . .
Checking the mkmf log of the bundler failed build reveals this:
cat .//libexec/bundle/lib/extensions/x86_64-darwin-13/2.2.0/nokogiri-1.6.7.1/mkmf.log
"/usr/bin/clang -o conftest -I/opt/local/include/ruby-2.2.0/x86_64-darwin13 -I/opt/local/include/ruby-2.2.0/ruby/backward -I/opt/local/include/ruby-2.2.0 -I. -I/opt/local/include -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -pipe -Os -fno-common conftest.c -L/opt/local/lib -L. -L/opt/local/lib -L. -L/opt/local/lib -Wl,-headerpad_max_install_names -fstack-protector -L/opt/local/lib -arch x86_64 -lruby.2.2.0 -lpthread -ldl -lobjc "
dyld: Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /opt/local/lib/libJPEG.dylib
in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
clang: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly!
clang: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
While the successful gem build mkmf log shows this:
cat /opt/local/lib/ruby2.2//gems/2.2.0/extensions/x86_64-darwin-13/2.2.0/nokogiri-1.6.7.1/mkmf.log
"/usr/bin/clang -o conftest -I/opt/local/include/ruby-2.2.0/x86_64-darwin13 -I/opt/local/include/ruby-2.2.0/ruby/backward -I/opt/local/include/ruby-2.2.0 -I. -I/opt/local/include -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -pipe -Os -fno-common conftest.c -L/opt/local/lib -L. -L/opt/local/lib -L. -L/opt/local/lib -Wl,-headerpad_max_install_names -fstack-protector -L/opt/local/lib -arch x86_64 -lruby.2.2.0 -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
Looking for xcodebuild reveals this:
sudo find / -name xcodebuild
Password:
/Applications/Xcode.app/Contents/Developer/usr/bin/
/Developer-3.2.6/usr/bin/xcodebuild
/private/var/root/Library/Caches/xcodebuild
/usr/bin/xcodebuild
which xcodebuild
/usr/bin/xcodebuild
And checking xcode-select -p shows this:
xcode-select -p
/Applications/Xcode.app/Contents/Developer
Respecting the dyld error:
dyld: Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /opt/local/lib/libJPEG.dylib
I have verified that there is no environment variable called DYLD_LIBRARY_PATH. But neither is there an /opt/local/lib/libJPEG.dylib. There is an /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib however.
Does anyone have any idea what is going on with the bundler build?
I am so tired of this recurring nonsense with building nokogiri on OSX.
Your problem seems similar to what specified in https://www.alfresco.com/blogs/developer/2012/12/11/homebrew-share-thumbnails-and-previews-on-os-x/
The resolution could be re-link the images dylib:
$ cd /opt/local/lib
$ rm libgif.dylib
$ ln -s path/to/libGIF libGIF.dylib
$ rm libjpeg.dylib
$ ln -s path/to/libJPEG libJPEG.dylib
$ rm libtiff.dylib
$ ln -s path/to/libTIFF libTIFF.dylib
$ rm libpng.dylib
$ ln -s path/to/libPng libPng.dylib

Installing Wit gem causes obscure Ruby error

I created a brand new Rails app and added gem wit to the Gemfile. Now, when I run bundle install, I get this error. In Googling to find a solution, I came across four different possibilities but none of them apply to my dev environment (OSX 10.9.5, Brew 0.9.5). Has anyone solved this issue?
Links:
The compiler failed to generate an executable file. (RuntimeError)
https://github.com/CocoaPods/CocoaPods/issues/1727
https://github.com/copiousfreetime/hitimes/issues/26
https://teamtreehouse.com/forum/rails-gem-wont-install-properly
...
Using turbolinks 2.5.2
Using uglifier 2.5.3
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/user/.rvm/rubies/ruby-2.1-head/bin/ruby -r ./siteconf20141204-96223-d2ceuv.rb extconf.rb
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 12.7M 100 12.7M 0 0 741k 0 0:00:17 0:00:17 --:--:-- 723k
checking for main() in -lsox... *** 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
--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/user/.rvm/rubies/ruby-2.1-head/bin/ruby
--with-wit-dir
--without-wit-dir
--with-wit-include
--without-wit-include=${wit-dir}/include
--with-wit-lib
--without-wit-lib=${wit-dir}/lib
--with-soxlib
--without-soxlib
/Users/user/.rvm/rubies/ruby-2.1-head/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/user/.rvm/rubies/ruby-2.1-head/lib/ruby/2.1.0/mkmf.rb:541:in `try_link0'
from /Users/user/.rvm/rubies/ruby-2.1-head/lib/ruby/2.1.0/mkmf.rb:556:in `try_link'
from /Users/user/.rvm/rubies/ruby-2.1-head/lib/ruby/2.1.0/mkmf.rb:742:in `try_func'
from /Users/user/.rvm/rubies/ruby-2.1-head/lib/ruby/2.1.0/mkmf.rb:973:in `block in have_library'
from /Users/user/.rvm/rubies/ruby-2.1-head/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from /Users/user/.rvm/rubies/ruby-2.1-head/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /Users/user/.rvm/rubies/ruby-2.1-head/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/user/.rvm/rubies/ruby-2.1-head/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from /Users/user/.rvm/rubies/ruby-2.1-head/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/user/.rvm/rubies/ruby-2.1-head/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from /Users/user/.rvm/rubies/ruby-2.1-head/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from /Users/user/.rvm/rubies/ruby-2.1-head/lib/ruby/2.1.0/mkmf.rb:968:in `have_library'
from extconf.rb:33:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/user/.rvm/gems/ruby-2.1-head/gems/wit-1.0.5 for inspection.
Results logged to /Users/user/.rvm/gems/ruby-2.1-head/extensions/x86_64-darwin-13/2.1.0/wit-1.0.5/gem_make.out
An error occurred while installing wit (1.0.5), and Bundler cannot continue.
Make sure that `gem install wit -v '1.0.5'` succeeds before bundling.
Here is the output for mkmf.log
$ cat /Users/user/.rvm/gems/ruby-2.1-head/extensions/x86_64-darwin-13/2.1.0/wit-1.0.5/mkmf.log
"/usr/bin/clang -o conftest -I/Users/user/.rvm/rubies/ruby-2.1-head/include/ruby-2.1.0/x86_64-darwin13.0 -I/Users/user/.rvm/rubies/ruby-2.1-head/include/ruby-2.1.0/ruby/backward -I/Users/user/.rvm/rubies/ruby-2.1-head/include/ruby-2.1.0 -I. -I/Users/user/.rvm/gems/ruby-2.1-head/gems/wit-1.0.5/ext/wit/libwit/include -I/Users/user/.rvm/rubies/ruby-2.1-head/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wextra-tokens -fno-common -pipe conftest.c -L. -L/Users/user/.rvm/rubies/ruby-2.1-head/lib -L/Users/user/.rvm/gems/ruby-2.1-head/gems/wit-1.0.5/ext/wit/libwit/lib -L/Users/user/.rvm/rubies/ruby-2.1-head/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -lwit -lsox -lcurl -lruby.2.1.0 -lpthread -lgmp -ldl -lobjc "
ld: library not found for -lsox
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
I got this problem solved by reinstalling X-Code's Command Line tools: xcode-install --select

Trying to install Passenger on OS X 10.7 with Xcode (4.3.2) installed giving error: "You have to install development tools first."

I'm trying to install Passenger on OS X 10.7 with Xcode (4.3.2) installed is giving me the error: "You have to install development tools first."
That doesn't make sense to me, why isn't it finding the proper requirements? I have installed Xcode from the Apple store.
Is there a list of the actual requirements it needs, instead of this generic message? Or is there a workaround that anyone knows about that would help me get going with passenger on OSX Lion? Thanks!
Exeptions details:
cd ext/libev/ && make libev.la
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -g -O2 -O3 -c -o ev.lo ev.c
gcc -DHAVE_CONFIG_H -I. -g -O2 -O3 -c ev.c -o ev.o
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -g -O2 -O3 -c -o event.lo event.c
gcc -DHAVE_CONFIG_H -I. -g -O2 -O3 -c event.c -o event.o
/bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 -O3 -version-info 3:0 -o libev.la -rpath /usr/local/lib ev.lo event.lo -lm
mkdir .libs
ar cru .libs/libev.a ev.o event.o
ranlib .libs/libev.a
creating libev.la
(cd .libs && rm -f libev.la && ln -s ../libev.la libev.la)
g++ ext/common/LoggingAgent/Main.cpp -o agents/PassengerLoggingAgent -Iext -Iext/common -Iext/libev -D_REENTRANT -I/usr/local/include -DHASH_NAMESPACE="__gnu_cxx" -DHASH_FUN_H="<ext/hash_fun.h>" -DHAS_ALLOCA_H -DHAS_SFENCE -DHAS_LFENCE -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long -Wno-missing-field-initializers -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS ext/common/libpassenger_common.a ext/common/libboost_oxt.a ext/libev/.libs/libev.a -lcurl -lz -lpthread
cd 'ext/ruby/ruby-1.9.2-x86_64-macosx/' && /Users/victorstan/.rvm/wrappers/ruby-1.9.2-p290#contact-monkey/ruby '/Users/victorstan/.rvm/gems/ruby-1.9.2-p290#contact-monkey/gems/passenger-3.0.12/ext/ruby/extconf.rb'
checking for alloca.h... *** /Users/victorstan/.rvm/gems/ruby-1.9.2-p290#contact-monkey/gems/passenger-3.0.12/ext/ruby/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=/Users/victorstan/.rvm/gems/ruby-1.9.2-p290#contact-monkey/gems/passenger-3.0.12/ext/ruby
--curdir
--ruby=/Users/victorstan/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
/Users/victorstan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/victorstan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
from /Users/victorstan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:834:in `block in have_header'
from /Users/victorstan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
from /Users/victorstan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
from /Users/victorstan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/victorstan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
from /Users/victorstan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/victorstan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from /Users/victorstan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
from /Users/victorstan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:833:in `have_header'
from /Users/victorstan/.rvm/gems/ruby-1.9.2-p290#contact-monkey/gems/passenger-3.0.12/ext/ruby/extconf.rb:36:in `<main>'
rake aborted!
Command failed with status (1): [cd 'ext/ruby/ruby-1.9.2-x86_64-macosx/' &&...]
Tasks: TOP => nginx => native_support => ext/ruby/ruby-1.9.2-x86_64-macosx//passenger_native_support.bundle => ext/ruby/ruby-1.9.2-x86_64-macosx//Makefile
You probably need to install Xcode Command Line Tools
In the past this was an optional item in the Xcode install package. Apple now separates them (for whatever reason)
In XCode 4.3.2, you can install the command-line developer tools from XCode's Preferences, under "Downloads".

Resources