Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to `gem install tiny_tds` OS X Mavericks

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/:

  • libsybdb.so

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
like image 295
abc123 Avatar asked Nov 29 '22 07:11

abc123


1 Answers

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
like image 198
zhengyue Avatar answered Dec 26 '22 06:12

zhengyue