Problem loading a compiled shared library with gSystem->Load

I have a shared library (libHighLevelObjects) that I compiled myself, and I have root v5.26.00 installed globally (not compiled or installed by me). When I attempt to load this library using gSystem->Load, I get a segfault:

me@host:~$ uname -a
Linux host 2.6.18-238.5.1.el5 #1 SMP Tue Mar 1 18:58:43 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

me@host:~$ root-config --version --svn-revision --arch --platform --features
5.26/00 31878 linux linuxasimage astiff builtin_afterimage builtin_ftgl builtin_freetype builtin_glew builtin_pcre builtin_zlib cint5 cintex dcache exceptions fftw3 genvector krb5 ldap mathmore memstat minuit2 opengl python reflex roofit shadowpw shared ssl table tmva unuran xft xml xrootd thread

me@host:~$ file `which root`
/cdf/code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/bin/root: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped

me@host:~$ file libHighLevelObjects.so.0.0.0
libHighLevelObjects.so.0.0.0: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped

me@host:~$ root -l
****************************
* Welcome to ROOT v5.26/00 *
****************************

root [0] gSystem.Load("libHighLevelObjects")

 *** Break *** segmentation violation



===========================================================
There was a crash (#7 0xf795ae73 in SigHandler(ESignals) () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCore.so).
This is the entire stack trace of all threads:
===========================================================
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x0059b833 in __waitpid_nocancel () from /lib/libc.so.6
#2  0x0054019b in do_system () from /lib/libc.so.6
#3  0x00679ead in system () from /lib/libpthread.so.0
#4  0xf795828d in TUnixSystem::Exec(char const*) () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCore.so
#5  0xf795ede4 in TUnixSystem::StackTrace() () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCore.so
#6  0xf795adc9 in TUnixSystem::DispatchSignals(ESignals) () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCore.so
#7  0xf795ae73 in SigHandler(ESignals) () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCore.so
#8  0xf7959f8e in sighandler(int) () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCore.so
#9  <signal handler called>
#10 0xf6b4dc35 in bmud::Streamer () at objects/dict_HighLevelObjects.C:8498
#11 0xffb480c8 in ?? ()
#12 0xf5e6f399 in _init () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libGraf3d.so
#13 0x004f9423 in _dl_init_internal () from /lib/ld-linux.so.2
#14 0x004fcdfb in dl_open_worker () from /lib/ld-linux.so.2
#15 0x004f8f56 in _dl_catch_error () from /lib/ld-linux.so.2
#16 0x004fc5a2 in _dl_open () from /lib/ld-linux.so.2
#17 0x006669bd in dlopen_doit () from /lib/libdl.so.2
#18 0x004f8f56 in _dl_catch_error () from /lib/ld-linux.so.2
#19 0x006662ec in _dlerror_run () from /lib/libdl.so.2
#20 0x00666a3f in dlopen
GLIBC_2.0 () from /lib/libdl.so.2
#21 0xf71c332c in G__dlopen () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCint.so
#22 0xf71c6f1c in G__shl_load () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCint.so
#23 0xf712c3d4 in G__loadfile () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCint.so
#24 0xf79401ba in TCint::Load(char const*, bool) () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCore.so
#25 0xf78c58c1 in TSystem::Load(char const*, char const*, bool) () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCore.so
#26 0xf7958b13 in TUnixSystem::Load(char const*, char const*, bool) () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCore.so
#27 0xf7ac35fc in G__G__Base2_237_0_120(G__value*, char const*, G__param*, int) () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCore.so
#28 0xf707a7d6 in Cint::G__ExceptionWrapper(int (*)(G__value*, char const*, G__param*, int), G__value*, char*, G__param*, int) () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCint.so
#29 0xf7135bdf in G__execute_call () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCint.so
#30 0xf7135f34 in G__call_cppfunc () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCint.so
#31 0xf711399b in G__interpret_func () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCint.so
#32 0xf70ff541 in G__getfunction () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCint.so
#33 0xf7204679 in G__getstructmem () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCint.so
#34 0xf71fa130 in G__getvariable () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCint.so
#35 0xf70d058b in G__getitem () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCint.so
#36 0xf70d28b7 in G__getexpr () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCint.so
#37 0xf7168aaf in G__exec_statement () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCint.so
#38 0xf70bad50 in G__exec_tempfile_core () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCint.so
#39 0xf70bc396 in G__exec_tempfile_fp () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCint.so
#40 0xf717ddd5 in G__process_cmd () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCint.so
#41 0xf7940755 in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCore.so
#42 0xf785cb58 in TApplication::ProcessLine(char const*, bool, int*) () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCore.so
#43 0xf6cc219c in TRint::HandleTermInput() () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libRint.so
#44 0xf6cc0235 in TTermInputHandler::Notify() () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libRint.so
#45 0xf6cc2c44 in TTermInputHandler::ReadNotify() () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libRint.so
#46 0xf7956899 in TUnixSystem::CheckDescriptors() () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCore.so
#47 0xf795b514 in TUnixSystem::DispatchOneEvent(bool) () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCore.so
#48 0xf78c283e in TSystem::InnerLoop() () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCore.so
#49 0xf78c2649 in TSystem::Run() () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCore.so
#50 0xf785cd27 in TApplication::Run(bool) () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libCore.so
#51 0xf6cc0bf9 in TRint::Run(bool) () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libRint.so
#52 0x08048de1 in main ()
===========================================================


The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#10 0xf6b4dc35 in bmud::Streamer () at objects/dict_HighLevelObjects.C:8498
#11 0xffb480c8 in ?? ()
#12 0xf5e6f399 in _init () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libGraf3d.so
#13 0x004f9423 in _dl_init_internal () from /lib/ld-linux.so.2
#14 0x004fcdfb in dl_open_worker () from /lib/ld-linux.so.2
#15 0x004f8f56 in _dl_catch_error () from /lib/ld-linux.so.2
#16 0x004fc5a2 in _dl_open () from /lib/ld-linux.so.2
#17 0x006669bd in dlopen_doit () from /lib/libdl.so.2
#18 0x004f8f56 in _dl_catch_error () from /lib/ld-linux.so.2
#19 0x006662ec in _dlerror_run () from /lib/libdl.so.2
#20 0x00666a3f in dlopen
GLIBC_2.0 () from /lib/libdl.so.2
===========================================================


Root > 

I have a sneaking suspicion that this could be due to a difference in compiler version between the installed root (gcc 3.4.6, I think) and the library I compiled (gcc 4.1.2). Can someone more conversant with the ROOT internals comfirm or deny this?

Regards,
Jon

#10 0xf6b4dc35 in bmud::Streamer () at objects/dict_HighLevelObjects.C:8498 #11 0xffb480c8 in ?? () #12 0xf5e6f399 in _init () from /mnt/autofs/cdf/cdf.code/cdfsoft/products/root/v5_26_00-GCC_3_4_6/Linux+2.6/lib/libGraf3d.soThere is no good reason for the ROOT library to be calling your ‘bmud::Streamer’, so yes I suspect that the problem is the compiler version.

between the installed root (gcc 3.4.6, I *think*) and the library I compiled (gcc 4.1.2).Indeed … it is very unlikely that a library built with 3.4.6 and a library build with 4.1.2 will work properly (the gcc ABI have changed in between). I strongly recommend that you use the same compiler for both.

Cheers,
Philippe.

Hi Philippe,
I have found and fixed the problem. There turns out to be a bug in the version of libtool that is installed with Scientific Linux 5, such that it attempts to link in the 64-bit C runtime when building a 32 bit library…
Regards,
Jon