rails-sqlserver / tiny_tds

TinyTDS - Simple and fast FreeTDS bindings for Ruby using DB-Library.
Other
605 stars 191 forks source link

No such file or directory tiny_tds.so (CentOS) #399

Open Insood opened 6 years ago

Insood commented 6 years ago

Before submitting an issue please check these first!

If none of these help. Please fill out the following:

Environment

Operating System centos-release-7-4.1708.el7.centos.x86_64 (Linux 113aad881d1e 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 20 20:32:50 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux)

TinyTDS Version and Information

version 2.1.0, built natively

FreeTDS Version Version: freetds v1.00.21 freetds.conf directory: /usr/local/etc MS db-lib source compatibility: no Sybase binary compatibility: no Thread safety: yes iconv library: yes TDS version: 7.3 iODBC: no unixodbc: no SSPI "trusted" logins: no Kerberos: no OpenSSL: yes GnuTLS: no MARS: no

Description

Hello, I'm trying to upgrade my rails app to the latest version of rails, ruby, and to have it run on the latest version of CentOS. I've setup a docker image to handle setting up the environment, etc, and one of the steps that's performed is to pull in FreeTDS and compile it so that later the tiny_tds gem has something to work with.

Dockerfiles here

I can do bundle install just fine (I've provided a small snippet in the gist of the tiny_tds building just fine natively), but when I go to run anything (when in the interactive Docker shell or when just running the docker container), I get the following error:

rirb(main):001:0> require 'tiny_tds'
LoadError: libsybdb.so.5: cannot open shared object file: No such file or directory - /opt/rh/rh-ruby24/root/usr/local/lib64/gems/ruby/tiny_tds-2.1.0/tiny_tds/tiny_tds.so
    from /opt/rh/rh-ruby24/root/usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:59:in `require'
    from /opt/rh/rh-ruby24/root/usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:59:in `require'
    from /opt/rh/rh-ruby24/root/usr/local/share/gems/gems/tiny_tds-2.1.0/lib/tiny_tds.rb:60:in `<top (required)>'
    from /opt/rh/rh-ruby24/root/usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:135:in `require'
    from /opt/rh/rh-ruby24/root/usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    from /opt/rh/rh-ruby24/root/usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:40:in `require'
    from (irb):1
    from /opt/rh/rh-ruby24/root/usr/bin/irb:11:in `<main>'
irb(main):002:0> 

Which is odd because there is a file /opt/rh/rh-ruby24/root/usr/local/lib64/gems/ruby/tiny_tds-2.1.0/tiny_tds/tiny_tds.so:

[root@113aad881d1e rails_test]# ls -l /opt/rh/rh-ruby24/root/usr/local/lib64/gems/ruby/tiny_tds-2.1.0/tiny_tds/           
total 108
-rwxr-xr-x. 1 root root 109680 Dec 11 23:02 tiny_tds.so
[root@113aad881d1e rails_test]# 

Here's the output of make & make install for freetds

metaskills commented 6 years ago

Could it be similar to this issue? https://github.com/rails-sqlserver/tiny_tds/issues/396#issuecomment-344225690

Insood commented 6 years ago

Hey - I think it's just an issue with the location of libsybdb.so.5

tiny_tds thinks that libsybdb.so.5 lives in /lib/

[root@113aad881d1e tiny_tds]# ldd tiny_tds.so 
    linux-vdso.so.1 =>  (0x00007ffe3a01e000)
    libruby.so.2.4 => /opt/rh/rh-ruby24/root/usr/lib64/libruby.so.2.4 (0x00007f3f38dec000)
    libsybdb.so.5 => /lib/libsybdb.so.5 (0x00007f3f38b7b000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f3f3895f000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f3f3875b000)

After compiling freetds, it lives in two places:

[root@113aad881d1e tiny_tds]# find /. -name libsybdb.so.5
/./usr/local/lib/libsybdb.so.5
/./freetds-1.00.21/src/dblib/.libs/libsybdb.so.5

( user local is where it's configured to be installed - ./configure --prefix=/usr/local --with-tdsver=7.3 )

Weird that tiny_tds thinks that it's in /lib/

Since this is a docker file and it's a brand new install - what should I do? I don't want to do a symlink since that seems dirty.

metaskills commented 6 years ago

Maybe something to do with the way you installed FreeTDS for CentOS?

stevelake commented 6 years ago

I was getting a similar issue and it got resolved with installing a newer version of tiny_tds. I have these 2 now:

tiny_tds (1.3.0 x86-mingw32, 1.0.5 x86-mingw32)

From: Ken Collins [mailto:notifications@github.com] Sent: 12 December 2017 01:08 To: rails-sqlserver/tiny_tds tiny_tds@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [rails-sqlserver/tiny_tds] No such file or directory tiny_tds.so (CentOS) (#399)

Maybe something to do with the way you installed FreeTDS for CentOS?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/rails-sqlserver/tiny_tds/issues/399#issuecomment-350911388, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AV6dUB6juqLeaJE_bfrEw9P6Uq4HncvCks5s_dHegaJpZM4Q-MrU.

sevk commented 3 years ago

图片

E:/Ruby27/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in require': cannot load such file -- tiny_tds (LoadError) from E:/Ruby27/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:inrequire' from t.rb:2:in `

'

ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [i386-mingw32]

tiny_tds (2.1.3 ruby x86-mingw32)

OS 名称: Microsoft® Windows Server® 2008 Enterprise OS 版本: 6.0.6001 Service Pack 1 Build 6001