Closed ensslen closed 7 years ago
Could you run the following commands?
$ echo "int main { return 0; }" > main.c
$ gcc -o main main.c
$ ./main
$ echo $?
0
If it fails, you need to install workable C compiler.
If the above command works, could you run the following commands?
$ echo "int main { return 0; }" > main.c
$ gcc -o main main.c -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC -fstack-protector -rdynamic -Wl,-export-dynamic -m64 -lpthread -lrt -ldl -lcrypt -lm -lc
$ ./main
$ echo $?
0
I guess the the second command fails. If the gcc complains that some options are unsupported, remove them until the gcc works.
Fix rbconfig.rb
Run the following command to get the directory containing rbconfig.rb
.
$ ruby -r rbconfig -e "p RbConfig::CONFIG['rubyarchdir']"
Look into rbconfig.rb
and erase options which are removed in the previous step.
As @kubo suggested there was no gcc installed.
sudo yum install gcc
fixed my problem so that gem install ruby-oci8
worked correctly.
Thank you so much for your assistance, and for your software in the first place.
"gem install ruby-oci8" is failing on my AWS amzn-ami-hvm-2016.09 linux VMs. Easily reproducable on a fresh VM with nothing but the instant-client unzipped, the paths set, and ruby-devel installed.
Thanks for the help.
mkmf_log.txt gem_make_out.txt
Console output:
[root@ip-172-31-11-121 ~]# gem install ruby-oci8 Building native extensions. This could take a while... ERROR: Error installing ruby-oci8: ERROR: Failed to build gem native extension.
checking for load library path... LD_LIBRARY_PATH...
/opt/oracle/instantclient_12_1/libclntsh.so.12.1 looks like an instant client. checking for cc... 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/ruby2.0 --with-instant-client --without-instant-client /usr/share/ruby/2.0/mkmf.rb:434:in'
try_do': RuntimeError (RuntimeError) from /usr/share/ruby/2.0/mkmf.rb:519:in
try_link0' from /usr/share/ruby/2.0/mkmf.rb:817:intry_run' from /usr/local/share/ruby/gems/2.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:635:in
check_cc' from /usr/local/share/ruby/gems/2.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:625:ininit' from /usr/local/share/ruby/gems/2.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:1005:in
initialize' from /usr/local/share/ruby/gems/2.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:318:innew' from /usr/local/share/ruby/gems/2.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:318:in
get' from extconf.rb:22:in `Error Message: The compiler failed to generate an executable file. You have to install development tools first.
Backtrace: /usr/share/ruby/2.0/mkmf.rb:434:in'
try_do' /usr/share/ruby/2.0/mkmf.rb:519:in
try_link0' /usr/share/ruby/2.0/mkmf.rb:817:intry_run' /usr/local/share/ruby/gems/2.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:635:in
check_cc' /usr/local/share/ruby/gems/2.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:625:ininit' /usr/local/share/ruby/gems/2.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:1005:in
initialize' /usr/local/share/ruby/gems/2.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:318:innew' /usr/local/share/ruby/gems/2.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:318:in
get' extconf.rb:22:in `See:
Gem files will remain installed in /usr/local/share/ruby/gems/2.0/gems/ruby-oci8-2.2.3 for inspection. Results logged to /usr/local/share/ruby/gems/2.0/gems/ruby-oci8-2.2.3/ext/oci8/gem_make.out
Ruby-devel is installed [root@ip-172-31-11-121 oci8]# yum info ruby-devel Loaded plugins: priorities, update-motd, upgrade-helper Installed Packages Name : ruby-devel Arch : noarch Epoch : 1 Version : 2.0 Release : 0.3.amzn1 Size : 0.0
Repo : installed From repo : amzn-main Summary : A Ruby development environment URL : https://www.ruby-lang.org/ License : (Ruby or BSD) and Public Domain Description : Header files and libraries for building an extension library for : Ruby or an application embedding Ruby.
Diagnostics: [root@ip-172-31-11-121 oci8]# file
which ruby
/usr/bin/ruby: symbolic link to /etc/alternatives/ruby [root@ip-172-31-11-121 oci8]# ruby --version ruby 2.0.0p648 (2015-12-16) [x86_64-linux] [root@ip-172-31-11-121 oci8]# ruby -r rbconfig -e "p RbConfig::CONFIG['host']" "x86_64-redhat-linux-gnu" [root@ip-172-31-11-121 oci8]# ruby -r rbconfig -e "p RbConfig::CONFIG['CC']" "gcc" [root@ip-172-31-11-121 oci8]# ruby -r rbconfig -e "p RbConfig::CONFIG['CFLAGS']" "-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC" [root@ip-172-31-11-121 oci8]# ruby -r rbconfig -e "p RbConfig::CONFIG['LDSHARED']" "gcc -shared" [root@ip-172-31-11-121 oci8]# ruby -r rbconfig -e "p RbConfig::CONFIG['LDFLAGS']" "-L. -fstack-protector -rdynamic -Wl,-export-dynamic" [root@ip-172-31-11-121 oci8]# ruby -r rbconfig -e "p RbConfig::CONFIG['DLDLAGS']" nil [root@ip-172-31-11-121 oci8]# ruby -r rbconfig -e "p RbConfig::CONFIG['LIBS']" "-lpthread -lrt -ldl -lcrypt -lm " [root@ip-172-31-11-121 oci8]# ruby -r rbconfig -e "p RbConfig::CONFIG['GNU_LD']" "yes" [root@ip-172-31-11-121 oci8]# file $LD_LIBRARY_PATH/libclntsh.* /opt/oracle/instantclient_12_1/libclntsh.so: symbolic link to libclntsh.so.12.1 /opt/oracle/instantclient_12_1/libclntsh.so.12.1: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped