0

We're using activerecord-sqlserver-adapter adapter for Rails 4 to talk to a SQL Server DB. This adapter requires the tiny_tds gem. In order to install tiny_tds, you need freetds installed on your system because it's used during the compiling for the gem.

On my system I have installed RVM and homebrew. I have brew install freetds and confirmed that it works by tsql -C and have actually connected to the SQL Server. From my understanding, that means freetds is "installed" on my machine and works.

However, everytime I do a gem install tiny_tds if complains about freetds is missing

I have tried several of the parameter options to "link" to the proper files, but nothing seems to work for me. I've already spent several hours googling and looking over the gem author's writings. Some other developers I'm working with have this functioning, but I'm setting up a new environment and for some reason can't get it working. They've already looked into it as well and are not sure what the issue is.

It seems that the installation of the tiny_tds gem just doesn't know that freetds is actually installed on the system.

On a sidenote, I've also looked at mini_portile and it didn't work properly either...since I've already spent several hours down the current path, I want to figure this out before I switch over to investigating mini_portile.

Here's the output of the install:

$ gem install tiny_tds
Building native extensions.  This could take a while...
ERROR:  Error installing tiny_tds:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... yes
checking for sybfront.h... yes
checking for sybdb.h... yes
checking for tdsdbopen() in -lsybdb... no
-----
freetds is missing.
-----
*** 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}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
    --enable-lookup
    --disable-lookup
    --with-iconv-dir
    --without-iconv-dir
    --with-iconv-include
    --without-iconv-include=${iconv-dir}/include
    --with-iconv-lib
    --without-iconv-lib=${iconv-dir}/
    --with-freetds-dir
    --without-freetds-dir
    --with-freetds-include
    --without-freetds-include=${freetds-dir}/include
    --with-freetds-lib
    --without-freetds-lib=${freetds-dir}/
    --with-iconvlib
    --without-iconvlib
    --with-sybdblib
    --without-sybdblib


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/tiny_tds-0.6.2 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/tiny_tds-0.6.2/ext/tiny_tds/gem_make.out
Dan L
  • 4,319
  • 5
  • 41
  • 74

2 Answers2

0

Finally resolved this. Forgot to install Ruby via RVM after I installed RVM, and this was causing all the issues.

If you get weird errors similar to the above, do a rvm list to see if you even have any Rubies installed, and then do a which ruby on your terminal (Mac) to see if you are indeed using the RVM Ruby.

Dan L
  • 4,319
  • 5
  • 41
  • 74
0

You can pass the location of the freetds lib to the gem command like this:

gem install tiny_tds -- --with-freetds-dir=/opt/homebrew/Cellar/freetds/1.2.21
eikes
  • 4,811
  • 2
  • 31
  • 31