kubo / ruby-oci8

Ruby-oci8 - Oracle interface for ruby
Other
169 stars 75 forks source link

Failed to build gem native extension #204

Closed keeshqs closed 5 years ago

keeshqs commented 5 years ago

Hi Kubo,

Hope you're doing well.

We'd like to ask for your assistance in installing OCI8 as we're encountering issues with the installation of the plugin.

Installation Steps: _1. cd /opt/sensu/embedded/bin _2. export LD_LIBRARY_PATH=/opt/oracle/instantclient_18_3:$LD_LIBRARYPATH _3. ./gem install --local /opt/sensu/embedded/bin/ruby-oci8-2.2.5.1.gem__

We were able to install OCI8 on several Redhat servers successfully before following the steps above but this time we are getting the error message below ~ . The only difference is that this time we are using an instant client and not a full client. We are currently in Prod and this is blocking us in proceeding with the deployment. Hope you can help us on the matter. Thanks in advance and appreciate your response.

Building native extensions. This could take a while... ERROR: Error installing /opt/sensu/embedded/bin/ruby-oci8-2.2.5.1.gem: ERROR: Failed to build gem native extension.

current directory: /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.5.1/ext/oci8

/opt/sensu/embedded/bin/ruby -r ./siteconf20180926-13086-3zkv9t.rb extconf.rb checking for load library path... LD_LIBRARY_PATH... checking /opt/oracle/instantclient_18_3... yes /opt/oracle/instantclient_18_3/libclntsh.so.18.1 looks like an instant client. checking for cc... ok

checking for gcc... yes checking for LP64... yes checking for sys/types.h... yes checking for ruby header... ok checking for OCIEnvCreate() in oci.h... yes checking for OCI_MAJOR_VERSION in oci.h... 18 checking for OCI_MINOR_VERSION in oci.h... 3 checking for localtime_r()... yes checking for dladdr()... yes checking for dlmodinfo()... no checking for dlgetname()... no checking for ruby/thread.h... yes checking for rb_class_superclass() in ruby.h... yes checking for rb_thread_call_without_gvl() in ruby/thread.h... yes checking for rb_sym2str() in ruby.h... yes checking for plthook... plthook_elf.c creating extconf.h creating Makefile

current directory: /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.5.1/ext/oci8 make "DESTDIR=" clean

current directory: /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.5.1/ext/oci8 make "DESTDIR=" compiling oci8lib.c compiling env.c compiling error.c compiling oci8.c compiling ocihandle.c compiling connection_pool.c compiling stmt.c compiling bind.c compiling metadata.c compiling attr.c compiling lob.c compiling oradate.c compiling ocinumber.c compiling ocidatetime.c compiling object.c compiling apiwrap.c compiling encoding.c compiling oranumber_util.c compiling thread_util.c compiling util.c compiling plthook_elf.c compiling hook_funcs.c linking shared-object oci8lib_240.so /usr/bin/ld: unrecognized option '--compress-debug-sections=zlib' /usr/bin/ld: use the --help option for usage information collect2: error: ld returned 1 exit status make: *** [oci8lib_240.so] Error 1

make failed, exit code 2

Gem files will remain installed in /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.5.1 for inspection. Results logged to /opt/sensu/embedded/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0/ruby-oci8-2.2.5.1/gem_make.out

kubo commented 5 years ago

Could you check /opt/sensu/embedded/lib/ruby/2.4.0/x86_64-linux/rbconfig.rb? If --compress-debug-sections=zlib is in the file, remove the linker option.

keeshqs commented 5 years ago

Hi Kubo,

Thank you for your response.

We have removed the linker from this line as suggested:

CONFIG["DLDFLAGS"] = "-Wl,-rpath,/opt/sensu/embedded/lib -L/opt/sensu/embedded/lib -Wl,--compress-debug-sections=zlib -L/opt/sensu/embedded/lib -Wl,-R/opt/sensu/embedded/lib"

but we are still getting the same error during installation ~

[admin@xxxx000 bin]$ /opt/sensu/embedded/bin/gem install --local /opt/sensu/embedded/bin/ruby-oci8-2.2.5.1.gem Building native extensions. This could take a while... ERROR: Error installing /opt/sensu/embedded/bin/ruby-oci8-2.2.5.1.gem: ERROR: Failed to build gem native extension.

current directory: /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.5.1/ext/oci8

/opt/sensu/embedded/bin/ruby -r ./siteconf20180927-43636-100m6ti.rb extconf.rb checking for load library path... LD_LIBRARY_PATH... checking /opt/oracle/instantclient_18_3... yes /opt/oracle/instantclient_18_3/libclntsh.so.18.1 looks like an instant client. checking for cc... ok checking for gcc... yes checking for LP64... yes checking for sys/types.h... yes checking for ruby header... ok checking for OCIEnvCreate() in oci.h... yes checking for OCI_MAJOR_VERSION in oci.h... 18 checking for OCI_MINOR_VERSION in oci.h... 3 checking for localtime_r()... yes checking for dladdr()... yes checking for dlmodinfo()... no checking for dlgetname()... no checking for ruby/thread.h... yes checking for rb_class_superclass() in ruby.h... yes checking for rb_thread_call_without_gvl() in ruby/thread.h... yes checking for rb_sym2str() in ruby.h... yes checking for plthook... plthook_elf.c creating extconf.h creating Makefile

current directory: /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.5.1/ext/oci8 make "DESTDIR=" clean

current directory: /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.5.1/ext/oci8 make "DESTDIR=" compiling oci8lib.c compiling env.c compiling error.c compiling oci8.c compiling ocihandle.c compiling connection_pool.c compiling stmt.c compiling bind.c compiling metadata.c compiling attr.c compiling lob.c compiling oradate.c compiling ocinumber.c compiling ocidatetime.c compiling object.c compiling apiwrap.c compiling encoding.c compiling oranumber_util.c compiling thread_util.c compiling util.c compiling plthook_elf.c compiling hook_funcs.c linking shared-object oci8lib_240.so /usr/bin/ld: cannot find : No such file or directory collect2: error: ld returned 1 exit status make: *** [oci8lib_240.so] Error 1

make failed, exit code 2

Gem files will remain installed in /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.5.1 for inspection. Results logged to /opt/sensu/embedded/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0/ruby-oci8-2.2.5.1/gem_make.out

kubo commented 5 years ago

Could you remove -Wl,--compress-debug-sections=zlib? Not only --compress-debug-sections=zlib but -Wl, also.

keeshqs commented 5 years ago

It did fix the issue - were able to load the plugin. Thanks so much for your prompt response! Really appreciate!