The Error
$ sudo 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
HomeBrew
The above error occurs even after a
$ brew install freetds
Manual Installation
$ tar zxf freetds-stable.tgz
$ cd freetds-0.91
$ ./configure
$ make
$ sudo make install
It appears to be missing the following file in /usr/local/lib/
:
Instead I have the following files:
libsybdb.a
libsybdb.dylib
libsybdb.la
Research
- https://github.com/Homebrew/homebrew/issues/24550
- ROR + Unable to install tiny_tds
I solved this problem by explicitly specifying the 64 bit architecture:
$ brew install freetds
$ sudo ARCHFLAGS="-arch x86_64" gem install tiny_tds
The reason is that during the gem building process, mkmf will try to look for 32 bit version of freetds, which is not available. The error message in mkmf.log
said:
ld: warning: ignoring file /usr/local/lib/libsybdb.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libsybdb.dylib
Undefined symbols for architecture i386:
"_tdsdbopen", referenced from:
_t in conftest-a13287.o
ld: symbol(s) not found for architecture i386
Solution
This was resolved by simply adding /opt/chef/embedded/bin
to my $PATH
$ sudo nano ~/.bashrc
File Contents after change
export PATH="/opt/chef/embedded/bin:$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
Update $PATH
$ source ~/.bashrc
Install the gem (Make sure you've install freetds
using one of the above methods)
$ sudo gem install tiny_tds
SPECIAL NOTE: This assumes you've installed the chef
$ curl -L https://www.opscode.com/chef/install.sh | sudo bash
Reference:
- http://www.getchef.com/chef/install/
Apparently the command to install is below:
$ sudo gem install tiny_tds -- --with-freetds-include=/usr/local/freetds/include --with-iconv-include=/opt/chef/embedded/include --with-freetds-lib=/usr/local/freetds/lib