Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing TinyTDS on OSX 10.6 via gem install tiny_tds

I have been trying to install the TinyTDS gem on a Macbook with OSX 10.6. I was successful in installing Free TDS -- confirmed that it works via:

tsql -H SERVER -p 1433 -U username.

The error I'm getting from gem install tiny_tds is:

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

        /Users/jason/.rvm/rubies/ruby-1.9.3-p194/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.

I've tried specifying the TDS lib and include dirs (/usr/local/lib and /usr/local/include) without luck. I've tried reinstalling FreeTDS from source manually as well as via homebrew, but that made no difference.

I've seen a few similar issues posted, but they seem to reference an issue with locating iconv libraries which I appear to be moving beyond.

Any suggestions or references I may have overlooked? Thanks in advance.

like image 270
Jaypoc Avatar asked Aug 20 '12 18:08

Jaypoc


3 Answers

Same problem on Ubuntu 14.04 resolved with:

sudo apt-get install freetds-dev

gem install tiny_tds

Log output:

Building native extensions.  This could take a while...
/home/david/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:73: warning: Insecure world writable dir /mnt/datapart/david in PATH, mode 040777
Successfully installed tiny_tds-0.6.1
Parsing documentation for tiny_tds-0.6.1
Installing ri documentation for tiny_tds-0.6.1
Done installing documentation for tiny_tds after 0 seconds
1 gem installed
like image 168
David Avatar answered Nov 01 '22 21:11

David


You need to install freetds with homebrew

brew update  # always a good idea to update homebrew before installing anything!
brew install freetds
like image 26
ganeshran Avatar answered Nov 01 '22 22:11

ganeshran


In my case, it seems the symlinks were not configured correctly, and using "brew link freetds" threw errors which required opening up some permissions. I tried just about everything else, and this is finally what worked:

devMac:0.95.18 Me$ sudo chown -R $USER /usr/local/share/doc/freetds/images
devMac:0.95.18 Me$ sudo chown -R $USER /usr/local/share/doc/freetds/reference
devMac:0.95.18 Me$ sudo chown -R $USER /usr/local/share/doc/freetds/userguide
devMac:0.95.18 Me$ sudo chown -R $USER /usr/local/share/man/man5
devMac:0.95.18 Me$ brew link --overwrite freetds
Linking /usr/local/Cellar/freetds/0.95.18... 2812 symlinks created
devMac:0.95.18 Me$ sudo gem install tiny_tds 
Building native extensions.  This could take a while...
Successfully installed tiny_tds-0.6.2
Parsing documentation for tiny_tds-0.6.2
Installing ri documentation for tiny_tds-0.6.2
Done installing documentation for tiny_tds after 0 seconds
1 gem installed

Disclaimer: I am in the early stages of learning this framework and do not have an understanding of the repercussions of using overwrite or changing these permissions.

like image 42
Dave Avatar answered Nov 01 '22 22:11

Dave