Closed styrken closed 1 year ago
@styrken before installing ibm_db gem, have you installed dsdriver or clidriver ? Can you please let me know where libdb2.so is located ?
Hello @praveen-db2
It's located here: /data/dsdriver/lib/libdb2.so
I have set environment variable IBM_DB_HOME
to /data/dsdriver
@styrken why are you using dsdriver client ? Actually ibm_db gem auto installs required clidriver. Can you try uninstalling dsdriver (if its not needed for you) along with unset IBM_DB_HOME and install ibm_db gem.
Hi @praveen-db2,
I can't answer of why we are using the dsdriver instead id clidriver, might just be the wrong package installed by the sysadmin.
I have removed $IBM_DB_HOME and now the output is slightly different.
Installing ibm_db 5.1.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/rts/app/vendor/bundle/ruby/3.0.0/gems/ibm_db-5.1.0/ext
/usr/bin/ruby -I /usr/share/rubygems -r ./siteconf20221116-898122-5kczkq.rb extconf.rb
extconf.rb:70: warning: already initialized constant DOWNLOADLINK
extconf.rb:45: warning: previous definition of DOWNLOADLINK was here
extconf.rb:194: warning: already initialized constant IBM_DB_HOME
extconf.rb:21: warning: previous definition of IBM_DB_HOME was here
extconf.rb:196: warning: already initialized constant IBM_DB_INCLUDE
extconf.rb:177: warning: previous definition of IBM_DB_INCLUDE was here
extconf.rb:197: warning: already initialized constant IBM_DB_LIB
extconf.rb:178: warning: previous definition of IBM_DB_LIB was here
Detected 64-bit Ruby
Detected platform - linux x86 64
Environment variable IBM_DB_HOME is not set. Downloading and setting up the DB2 client driver
checking for SQLConnect() in -ldb2... yes
checking for gil_release_version.h... yes
checking for unicode_support_version.h... yes
creating Makefile
extconf.rb:306:in `libpathflag': uninitialized constant Config (NameError)
Did you mean? RbConfig
CONFIG
from /usr/share/ruby/mkmf.rb:2297:in `create_makefile'
from extconf.rb:322:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/rts/app/vendor/bundle/ruby/3.0.0/extensions/x86_64-linux/3.0.0/ibm_db-5.1.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/rts/app/vendor/bundle/ruby/3.0.0/gems/ibm_db-5.1.0 for inspection.
Results logged to /home/rts/app/vendor/bundle/ruby/3.0.0/extensions/x86_64-linux/3.0.0/ibm_db-5.1.0/gem_make.out
An error occurred while installing ibm_db (5.1.0), and Bundler cannot continue.
Make sure that `gem install ibm_db -v '5.1.0' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
ibm_db
Actually that might because of ruby 3 removed Config
in favor of RbConfig
. (Can't remember excatly when). I think it was fixed in 5.2.0 of this gem.
When using version 5.2.0 of this gem i get another error:
ERROR: Error installing ibm_db:
ERROR: Failed to build gem native extension.
current directory: /home/rts/.local/share/gem/ruby/gems/ibm_db-5.2.0/ext
/usr/bin/ruby -I /usr/share/rubygems -r ./siteconf20221116-898362-ovxmw1.rb extconf.rb
extconf.rb:70: warning: already initialized constant DOWNLOADLINK
extconf.rb:45: warning: previous definition of DOWNLOADLINK was here
extconf.rb:194: warning: already initialized constant IBM_DB_HOME
extconf.rb:21: warning: previous definition of IBM_DB_HOME was here
extconf.rb:196: warning: already initialized constant IBM_DB_INCLUDE
extconf.rb:177: warning: previous definition of IBM_DB_INCLUDE was here
extconf.rb:197: warning: already initialized constant IBM_DB_LIB
extconf.rb:178: warning: previous definition of IBM_DB_LIB was here
Detected 64-bit Ruby
Detected platform - linux x86 64
Environment variable IBM_DB_HOME is not set. Downloading and setting up the DB2 client driver
creating gil_release_version.h
creating unicode_support_version.h
checking for SQLConnect() in -ldb2... yes
checking for gil_release_version.h... yes
checking for unicode_support_version.h... yes
creating Makefile
current directory: /home/rts/.local/share/gem/ruby/gems/ibm_db-5.2.0/ext
make DESTDIR\= clean
rm -f
rm -f ibm_db.so *.o *.bak mkmf.log .*.time
current directory: /home/rts/.local/share/gem/ruby/gems/ibm_db-5.2.0/ext
make DESTDIR\=
gcc -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -DRUBY_EXTCONF_H=\"unicode_support_version.h\" -I/home/rts/.local/share/gem/ruby/gems/ibm_db-5.2.0/ext/../lib/clidriver/include -fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -o ibm_db.o -c ibm_db.c
ibm_db.c:106: warning: "STRCASECMP" redefined
#define STRCASECMP strcasecmp
In file included from /usr/include/ruby/ruby.h:27,
from /usr/include/ruby.h:38,
from ibm_db.c:21:
/usr/include/ruby/internal/ctype.h:52: note: this is the location of the previous definition
#define STRCASECMP st_locale_insensitive_strcasecmp
ibm_db.c: In function ‘ruby_ibm_db_init_globals’:
ibm_db.c:400:3: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
memset(ibm_db_globals->__ruby_conn_err_msg, '\0', DB2_MAX_ERR_MSG_LEN);
^~~~~~
ibm_db.c:401:3: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
memset(ibm_db_globals->__ruby_stmt_err_msg, '\0', DB2_MAX_ERR_MSG_LEN);
^~~~~~
ibm_db.c:402:3: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
memset(ibm_db_globals->__ruby_conn_err_state, '\0', SQL_SQLSTATE_SIZE + 1);
^~~~~~
ibm_db.c:403:3: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
memset(ibm_db_globals->__ruby_stmt_err_state, '\0', SQL_SQLSTATE_SIZE + 1);
^~~~~~
ibm_db.c: In function ‘_ruby_ibm_db_free_conn_struct’:
ibm_db.c:490:7: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]
int rc;
^~
ibm_db.c: In function ‘ibm_Ruby_Thread_Call’:
ibm_db.c:699:5: warning: implicit declaration of function ‘rb_thread_call_without_gvl’; did you mean ‘rb_thread_wait_for’? [-Wimplicit-function-declaration]
rb_thread_call_without_gvl(func, data1, ubf, data2);
^~~~~~~~~~~~~~~~~~~~~~~~~~
rb_thread_wait_for
ibm_db.c: In function ‘_ruby_ibm_db_free_stmt_handle_and_resources’:
ibm_db.c:717:7: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]
int rc;
^~
ibm_db.c: In function ‘_ruby_ibm_db_clear_stmt_err_cache’:
ibm_db.c:1997:3: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
memset(IBM_DB_G(__ruby_stmt_err_msg), '\0', DB2_MAX_ERR_MSG_LEN);
^~~~~~
ibm_db.c:1998:3: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
memset(IBM_DB_G(__ruby_stmt_err_state), '\0', SQL_SQLSTATE_SIZE + 1);
^~~~~~
ibm_db.c: In function ‘_ruby_ibm_db_connect_helper2’:
ibm_db.c:2302:31: warning: argument to ‘sizeof’ in ‘memset’ call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess]
memset(server, 0, sizeof(server));
^
ibm_db.c:2358:41: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
handleAttr_args->valuePtr = (SQLPOINTER)(enable_numeric_literals);
^
ibm_db.c: In function ‘_ruby_ibm_db_connect_helper’:
ibm_db.c:2535:26: warning: comparison between pointer and integer
if(helper_args-> entry == NULL)
^~
ibm_db.c: In function ‘_ruby_ibm_db_clear_conn_err_cache’:
ibm_db.c:2763:3: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
memset(IBM_DB_G(__ruby_conn_err_msg), '\0', DB2_MAX_ERR_MSG_LEN);
^~~~~~
ibm_db.c:2764:3: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
memset(IBM_DB_G(__ruby_conn_err_state), '\0', SQL_SQLSTATE_SIZE + 1);
^~~~~~
ibm_db.c: In function ‘ibm_db_createDBNX’:
ibm_db.c:3250:9: warning: unused variable ‘return_value’ [-Wunused-variable]
VALUE return_value = Qnil;
^~~~~~~~~~~~
ibm_db.c: In function ‘ibm_db_autocommit’:
ibm_db.c:3323:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
handleAttr_args->valuePtr = (SQLPOINTER)autocommit;
^
ibm_db.c: In function ‘_ruby_ibm_db_do_prepare’:
ibm_db.c:5666:9: error: format not a string literal and no format arguments [-Werror=format-security]
rb_warn( RSTRING_PTR(error) );
^~~~~~~
ibm_db.c: In function ‘ibm_db_exec’:
ibm_db.c:5806:11: error: format not a string literal and no format arguments [-Werror=format-security]
rb_warn( RSTRING_PTR(error) );
^~~~~~~
ibm_db.c: In function ‘ibm_db_execute’:
ibm_db.c:7017:7: error: format not a string literal and no format arguments [-Werror=format-security]
rb_warn( RSTRING_PTR(error) );
^~~~~~~
ibm_db.c: In function ‘ibm_db_result’:
ibm_db.c:9274:5: error: format not a string literal and no format arguments [-Werror=format-security]
rb_warn( RSTRING_PTR(error) );
^~~~~~~
ibm_db.c: In function ‘ibm_db_result_cols’:
ibm_db.c:10116:9: warning: unused variable ‘ret_val’ [-Wunused-variable]
VALUE ret_val = Qnil;
^~~~~~~
ibm_db.c: In function ‘ibm_db_set_option’:
ibm_db.c:10565:11: error: format not a string literal and no format arguments [-Werror=format-security]
rb_warn( RSTRING_PTR(error) );
^~~~~~~
ibm_db.c:10575:11: error: format not a string literal and no format arguments [-Werror=format-security]
rb_warn( RSTRING_PTR(error) );
^~~~~~~
ibm_db.c: In function ‘ibm_db_server_info’:
ibm_db.c:11240:12: warning: passing argument 1 of ‘RB_NIL_P’ makes integer from pointer without a cast [-Wint-conversion]
if(NIL_P(&connection))
^~~~~~~~~~~
In file included from /usr/include/ruby/internal/arithmetic/long.h:42,
from /usr/include/ruby/internal/arithmetic/int.h:26,
from /usr/include/ruby/internal/arithmetic/char.h:23,
from /usr/include/ruby/internal/arithmetic.h:23,
from /usr/include/ruby/ruby.h:25,
from /usr/include/ruby.h:38,
from ibm_db.c:21:
/usr/include/ruby/internal/special_consts.h:128:16: note: expected ‘VALUE’ {aka ‘long unsigned int’} but argument is of type ‘VALUE *’ {aka ‘long unsigned int *’}
RB_NIL_P(VALUE obj)
~~~~~~^~~
ibm_db.c:11243:17: warning: the comparison will always evaluate as ‘false’ for the address of ‘connection’ will never be NULL [-Waddress]
if(&connection == NULL)
^~
ibm_db.c: At top level:
ibm_db.c:48:13: warning: ‘_ruby_ibm_db_set_decfloat_rounding_mode_client’ declared ‘static’ but never defined [-Wunused-function]
static int _ruby_ibm_db_set_decfloat_rounding_mode_client(SQLHANDLE hdbc);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ibm_db.c: In function ‘ibm_Ruby_Thread_Call’:
ibm_db.c:709:3: warning: control reaches end of non-void function [-Wreturn-type]
}
^
ibm_db.c: In function ‘_ruby_ibm_db_connect_helper2’:
ibm_db.c:2431:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
At top level:
ibm_db.c:2589:12: warning: ‘_ruby_ibm_db_set_decfloat_rounding_mode_client_helper’ defined but not used [-Wunused-function]
static int _ruby_ibm_db_set_decfloat_rounding_mode_client_helper(_rounding_mode *rnd_mode, conn_handle *conn_res ) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make: *** [Makefile:245: ibm_db.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/rts/.local/share/gem/ruby/gems/ibm_db-5.2.0 for inspection.
Results logged to /home/rts/.local/share/gem/ruby/extensions/x86_64-linux/3.0.0/ibm_db-5.2.0/gem_make.out
@styrken for earlier error, can you try setting environment variable LD_LIBRARY_PATH
to /data/dsdriver/lib/
and also set IBM_DB_HOME
to /data/dsdriver/
then try installing latest ibm_db gem version 5.3.2
@styrken for earlier error, can you try setting environment variable
LD_LIBRARY_PATH
to/data/dsdriver/lib/
and also setIBM_DB_HOME
to/data/dsdriver/
then try installing ibm_db gem
@praveen-db2 Gives same result unfortunately (both on 5.1.0 and 5.2..0)
@styrken for earlier error, can you try setting environment variable
LD_LIBRARY_PATH
to/data/dsdriver/lib/
and also setIBM_DB_HOME
to/data/dsdriver/
then try installing ibm_db gem@praveen-db2 Gives same result unfortunately (both on 5.1.0 and 5.2..0)
Use latest version 5.3.2
Thank you @praveen-db2, version 5.3.2 installed successfully without setting either LD_LIBRARY_PATH or IBM_DB_HOME.
Running
gem install ibm_db -v '5.2.0'
under rubyruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]
seems to fail.Logfile:
Am i missing some dependencies?