Skip to content

"Cannot load such file -- tiny_tds/tiny_tds" (version 1.1.0, version 1.0.0 is OK) #330

Closed
@bradder555

Description

@bradder555

Using Windows 7, Enterprise, with MS-SQL 2014 64-bit developer running locally

Using ruby 2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32] and
gem 2.4.5.1

SQL server authentication is enabled,
Named pipes and TCP is enabled,

tiny_tds installed (i get the exact same issue with the 32 bit version):

> gem list | grep tiny_tds
tiny_tds (1.1.0 x64-mingw32)

FreeTDS is installed:

>tsql -C
Compile-time settings (established with the "configure" script)
                            Version: freetds v1.00.9
             freetds.conf directory: c:
     MS db-lib source compatibility: no
        Sybase binary compatibility: no
                      Thread safety: yes
                      iconv library: no
                        TDS version: 7.0
                              iODBC: no
                           unixodbc: no
              SSPI "trusted" logins: yes
                           Kerberos: no
                            OpenSSL: yes
                             GnuTLS: no
                               MARS: no

from irb i require tiny_tds and get:

irb(main):001:0> require 'tiny_tds'
LoadError: cannot load such file -- tiny_tds/tiny_tds
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/tiny_tds-1.1.0-x64-mingw32/lib/tiny_tds.rb:22:in `rescue in <top (required)>'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/tiny_tds-1.1.0-x64-mingw32/lib/tiny_tds.rb:25:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
        from (irb):1
        from C:/RailsInstaller/Ruby2.2.0/bin/irb:11:in `<main>'

I modified the tiny_tds.rb file to get an idea of what is going on:

if RUBY_PLATFORM =~ /mingw|mswin/ && RUBY_VERSION =~ /(\d+.\d+)/
  ver = Regexp.last_match(1)
  # Set the PATH environment variable, so that the DLLs can be found.
  old_path = ENV['PATH']
  begin
    print "begin \n"
    # Do the same host consolidation as in extconf.rb
    ports_dir = RbConfig::CONFIG['host'].gsub('i686-pc-mingw32', 'i686-w64-mingw32')
    ENV['PATH'] = "#{File.expand_path("../../ports/#{ports_dir}/bin", __FILE__)};#{old_path}"
	print "ENV['PATH'] = ... \n"
	print "require \"tiny_tds/#{ver}/tiny_tds \n"
    require "tiny_tds/#{ver}/tiny_tds"
  rescue LoadError
	print "LoadError \n"
    require 'tiny_tds/tiny_tds'
  ensure
	print "ensure \n"
    ENV['PATH'] = old_path
  end
else

and get this:

irb(main):004:0> require 'tiny_tds'
begin
ENV['PATH'] = ...
require "tiny_tds/2.2/tiny_tds
LoadError
ensure
begin
ENV['PATH'] = ...
require "tiny_tds/2.2/tiny_tds
LoadError
ensure
LoadError: cannot load such file -- tiny_tds/tiny_tds
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/tiny_tds-1.1.0-x64-mingw32/lib/tiny_tds.rb:26:in `rescue in <top (required)>'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/tiny_tds-1.1.0-x64-mingw32/lib/tiny_tds.rb:30:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
        from (irb):4
        from C:/RailsInstaller/Ruby2.2.0/bin/irb:11:in `<main>'
irb(main):005:0>

The path "tiny_tds/2.2/tiny_tds" contains:
tiny_tds.so

The tiny_tds folder contains:

  • 2.0 (folder, contains tiny_tds.so)
  • 2.1 (folder, contains tiny_tds.so)
  • 2.2 (folder, contains tiny_tds.so)
  • 2.3 (folder, contains tiny_tds.so)
  • 2.4 (folder, contains tiny_tds.so)
  • bin.rb
  • client.rb
  • error.rb
  • result.rb
  • version.rb

So not sure what i'm missing? is there meant to be a compilation step when importing the gem? because that doesn't appear to be happening

If I uninstall and reinstall:

>gem uninstall tiny_tds
Remove executables:
        defncopy, tsql

in addition to the gem? [Yn]  y
Removing defncopy
Removing tsql
Successfully uninstalled tiny_tds-1.1.0-x64-mingw32

>gem install tiny_tds
Fetching: tiny_tds-1.1.0-x86-mingw32.gem (100%)
Successfully installed tiny_tds-1.1.0-x86-mingw32
Parsing documentation for tiny_tds-1.1.0-x86-mingw32
Installing ri documentation for tiny_tds-1.1.0-x86-mingw32
Done installing documentation for tiny_tds after 1 seconds
1 gem installed

if i go irb and require, i get exactly the same issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions