Unable to `gem install tiny_tds` OS X Mavericks

喜欢而已 提交于 2019-12-07 09:03:09

问题


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

回答1:


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



回答2:


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



来源:https://stackoverflow.com/questions/24394476/unable-to-gem-install-tiny-tds-os-x-mavericks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!