[freetds] Segfault or Preload... why?

Michael Higgins linux at evolone.org
Tue Jun 23 12:08:43 EDT 2009

So for over a year I've had to keep my system stable by refusing updated libraries. Finally, I updated to all current relevant libs and bins and suffered for it.

The goal is perl -> MSSQL via ODBC.

FreeTDS, of course, with unixODBC and perl DBD::ODBC.

Perl Test::More does PERL_DL_NONLAZY=1 before any tests. This actually hides the failures by loading everything up before it's called (I guess), so unless you are actually *using* the ODBC connection, the problem never shows.

However, with DBIx-Class, the DBI connect is hidden deep in code and there's no way to use that environment variable to get it working. After more than a week of hair-pulling, I discovered /etc/ld.so.preload and put /usr/lib/libtdsodbc.so in it.

Now it works. From what little I understand, unixODBC should be loading this file:
ldd /usr/lib/libodbc.so
	linux-gate.so.1 =>  (0xb80b8000)
	/usr/lib/libtdsodbc.so (0xb7ff6000)
	libltdl.so.3 => /usr/lib/libltdl.so.3 (0xb7fd7000)
	libpthread.so.0 => /lib/libpthread.so.0 (0xb7fbf000)
	libc.so.6 => /lib/libc.so.6 (0xb7e76000)
	libodbcinst.so.1 => /usr/lib/libodbcinst.so.1 (0xb7e66000)
	librt.so.1 => /lib/librt.so.1 (0xb7e5d000)
	libdl.so.2 => /lib/libdl.so.2 (0xb7e59000)
	/lib/ld-linux.so.2 (0xb80b9000)

But, unless I 'preload' it, I get a segfault in /usr/lib/libtdsodbc.so.

Can anyone on *this* list explain why that might be? 

I hear that this can actually work "out of the box", so probably there is something Gentoo should be doing differently in the compile scripts, but I'm out of my league when it comes to, like, compiler flags and linking.


 |\  /|        |   |          ~ ~  
 | \/ |        |---|          `|` ?
 |    |ichael  |   |iggins    \^ /

More information about the FreeTDS mailing list