Uelb
Uelb

Reputation: 4093

Cannot install/make freetds OS X Yosemite

I am trying to install the gem tiny_tds on my Macbook, so I first tried to install the freetds dependency by running brew install freetds. However, it doesn't work and I get an error that makes no sense to me :

libtool: link: clang -D_THREAD_SAFE -g -O2 -I/usr/local/opt/openssl/include -Wdeclaration-after-statement -o .libs/bsqldb bsqldb.o  -L/usr/local/opt/openssl/lib ../dblib/.libs/libsybdb.dylib ../replacements/.libs/libreplacements.a -lssl -lcrypto /usr/local/Cellar/libiconv/1.13.1/lib/libiconv.dylib
libtool: link: clang -D_THREAD_SAFE -g -O2 -I/usr/local/opt/openssl/include -Wdeclaration-after-statement -o .libs/datacopy datacopy.o  -L/usr/local/opt/openssl/lib ../dblib/.libs/libsybdb.dylib ../replacements/.libs/libreplacements.a -lssl -lcrypto /usr/local/Cellar/libiconv/1.13.1/lib/libiconv.dylib
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

I also tried to compile the freetds from the source, and I also got an error:

/bin/sh ../../libtool --tag=CC   --mode=link gcc -D_THREAD_SAFE  -g -O2 -Wdeclaration-after-statement   -o tsql tsql.o ../tds/libtds.la ../replacements/libreplacements.la  -liconv  -lncurses  -lreadline
libtool: link: gcc -D_THREAD_SAFE -g -O2 -Wdeclaration-after-statement -o tsql tsql.o  ../tds/.libs/libtds.a ../replacements/.libs/libreplacements.a /usr/local/Cellar/libiconv/1.13.1/lib/libiconv.dylib -lncurses -lreadline
Undefined symbols for architecture x86_64:
  "_iconv", referenced from:
      _tds_iconv_open in libtds.a(iconv.o)
      _tds_iconv in libtds.a(iconv.o)
      _tds_iconv_fread in libtds.a(iconv.o)
     (maybe you meant: _tds_iconv_close, _tds_iconv , _tds_iconv_open , _tds_iconv_get , _tds_iconv_free , _tds_iconv_alloc , _tds_iconv_from_collate , _tds_iconv_fread )
  "_iconv_close", referenced from:
      _tds_iconv_open in libtds.a(iconv.o)
      _tds_iconv_info_init in libtds.a(iconv.o)
      _tds_iconv_close in libtds.a(iconv.o)
      _tds_iconv in libtds.a(iconv.o)
      _tds_iconv_get_info in libtds.a(iconv.o)
      _tds_srv_charset_changed_num in libtds.a(iconv.o)
      _tds_set_iconv_name in libtds.a(iconv.o)
      ...
     (maybe you meant: _tds_iconv_close)
  "_iconv_open", referenced from:
      _tds_iconv_open in libtds.a(iconv.o)
      _tds_iconv_info_init in libtds.a(iconv.o)
      _tds_iconv in libtds.a(iconv.o)
      _tds_set_iconv_name in libtds.a(iconv.o)
     (maybe you meant: _tds_iconv_open)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [tsql] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

I do not really understand why I cannot compile freetds on my machine and I would be glad if someone helped me !

Thank you in advance.

Upvotes: 1

Views: 634

Answers (1)

Uelb
Uelb

Reputation: 4093

I actually found a solution to my problem ! Apparently, Libiconv was installed as a dependency to another program by brew. But this installation was not compiled for my architecture so not working properly. I had to uninstall the brew version of libiconv and reinstall it manually.

brew uninstall libiconv
brew install libiconv
brew install freetds

I am not sure it is necessary to reinstall libiconv via brew as it is supposed to be part of the Mac OS now. Hope this helps people who have the same problem.

Upvotes: 1

Related Questions