[freetds] tsql Memory fault on HP-UX

James K. Lowden jklowden at freetds.org
Sat May 9 19:07:20 EDT 2009

Kitt, Jeffrey wrote:
> Thanks for the suggestion. I tried to recompile freetds using the
> --disable-libiconv option in the configure step.  I received the
> following warning messages during Make.
> ld: (Warning) Cannot hide undefined symbol "tds_sys_iconv_open". Symbol
> was referenced from file .libs/libct.lax/libtds.a/iconv.o
> My C coding skills are very weak but I'm going to guess that this needs
> to be fixed in the base code.  

Maybe, kinda sorta.  

I'm not going to be much help, not knowing much about HP-UX.  I know
Frediano has built FreeTDS on that OS, so we know it works sometimes.  For
starters, I'd start over: rm -rf; tar -x; configure; make.  See if that

If not, cf. http://www.docs.hp.com/en/B3901-90024/ch02s25.html.

What we have here is a linker error, always the toughest build-time
problem.  You're using HP's linker.  I don't know any more about what it
means by a "hidden symbol" than you see on above-linked page. 

The link options are generated by libtool.  It could be that the version
we're using doesn't make your version of the linker happy.   

$ find build -name \*.a | xargs nm -o | grep tds_sys_iconv_open | while
read F; do basename "$F"; done | grep -vw U
libct.a:iconv.o:00000000 T tds_sys_iconv_open
libsybdb.a:iconv.o:00000000 T tds_sys_iconv_open
libtdsodbc.a:iconv.o:00000000 T tds_sys_iconv_open
libtdssrv.a:iconv.o:00000000 T tds_sys_iconv_open
libreplacements.a:iconv.o:00000000 T tds_sys_iconv_open

As you can see, each API library provides tds_sys_iconv_open(). (The
dynamic libraries don't export it because it's not part of the API.)  Most
important, it's defined by libreplacements.a.  

> gcc -D_REENTRANT -pthread -g -O2 -Wdeclaration-after-statement -o tsql
> tsql.o  ../tds/.libs/libtds.a ../replacements/.libs/libreplacements.a
> -lxnet  
> ld: Unsatisfied hidden symbol "tds_sys_iconv_open". Symbol was
> referenced from file ../tds/.libs/libtds.a[iconv.o]
> 3 errors.
> collect2: ld returned 1 exit status

libreplacements is correctly the last FreeTDS library in the command.  Its
job is to "fill in" anything needed by the things that come before it, and
override anything provided by things that come after.   

My guess: on your system libtds.a doesn't define tds_sys_iconv_open(), and
libreplacements.a does, but the linker refuses to use it because it's

If I were trying to solve this, I would go back to the command that
creates libtds.a.  I'd putz with the -B options in above-referenced
documentation, and use nm(1) or similar to make sure tds_sys_iconv_open()
isn't hidden.  Then I'd link tsql.  Then the client API shared objects. 
I'd probably keep a sed script around for next time, too.  ;-) 

If you get it to work and can show both the working and nonworking
commands, it would help others if you'd post that information here.  



More information about the FreeTDS mailing list