Error installing TinyTDS on OSX 10.6 via gem insta

2019-04-07 12:54发布

问题:

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.

回答1:

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


回答2:

You need to install freetds with homebrew

brew update  # always a good idea to update homebrew before installing anything!
brew install freetds


回答3:

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.



回答4:

In my case, installing Ruby 2.3.0 using brew install ruby worked. I got the idea from this question Cannot install tiny_tds on os.x 10.9.4.