Linking "New" library leads to a floating point exception at startup

Hello,

linking unnecessary libraries might be a bad idea anyways, but I would like to find out why it is a bad idea.

When building stand-alone ROOT applications, it is necessary to explicitly link some libraries in addition to the ones provided by “root-config --glibs”, for example the ASImage library when using TASImages. Consequently, I tried to simply link all installed ROOT libraries, which did work using root 5.34.12.

However, running root 6.08.02 under archlinux, building with gcc 6.2.1 and linking the “New” library (libNew.so) produces the following floating point exception on startup of the compiled excecutable:

[code] *** Break *** floating point exception

===========================================================
There was a crash.
This is the entire stack trace of all threads:

#0 0x00007fb359ccfd6a in waitpid () from /lib/libc.so.6
#1 0x00007fb359c570fb in do_system () from /lib/libc.so.6
#2 0x00007fb35dca7f91 in TUnixSystem::StackTrace() () from /usr/lib/root/libCore.so
#3 0x00007fb35dcaa8fc in TUnixSystem::DispatchSignals(ESignals) () from /usr/lib/root/libCore.so
#4
#5 0x00007fb35dc5b641 in TClass::TDeclNameRegistry::AddQualifiedName(char const*) () from /usr/lib/root/libCore.so
#6 0x00007fb35dc5d62b in TClass::Init(char const*, short, std::type_info const*, TVirtualIsAProxy*, char const*, char const*, int, int, ClassInfo_t*, bool) () from /usr/lib/root/libCore.so
#7 0x00007fb35dc6760f in TClass::TClass(char const*, short, bool) () from /usr/lib/root/libCore.so
#8 0x00007fb354e11dfd in TCling::GenerateTClass(char const*, bool, bool) () from /usr/lib/root/libCling.so
#9 0x00007fb35dc612f5 in TClass::AddRule(char const*) () from /usr/lib/root/libCore.so
#10 0x00007fb35dc61445 in ?? () from /usr/lib/root/libCore.so
#11 0x00007fb35dc616f3 in TClass::ReadRules() () from /usr/lib/root/libCore.so
#12 0x00007fb35db21663 in TROOT::InitInterpreter() () from /usr/lib/root/libCore.so
#13 0x00007fb35db21836 in ROOT::Internal::GetROOT2() () from /usr/lib/root/libCore.so
#14 0x00007fb35aa791c6 in operator delete(void*) () from /usr/lib/root/libNew.so
#15 0x00007fb35dc22438 in TClassTable::Add(char const*, short, std::type_info const&, TClass* ()(), int) () from /usr/lib/root/libCore.so
#16 0x00007fb35dc730b6 in ROOT::TGenericClassInfo::TGenericClassInfo(char const
, int, char const*, int, ROOT::Internal::TInitBehavior const*, TClass* (*)(), int) () from /usr/lib/root/libCore.so
#17 0x00007fb35db880ba in ROOT::GenerateInitInstance() () from /usr/lib/root/libCore.so
#18 0x00007fb35db1aa00 in ?? () from /usr/lib/root/libCore.so
#19 0x00007fb35e5c74fa in call_init.part () from /lib64/ld-linux-x86-64.so.2
#20 0x00007fb35e5c760b in _dl_init () from /lib64/ld-linux-x86-64.so.2
#21 0x00007fb35e5b8daa in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#22 0x0000000000000001 in ?? ()
#23 0x00007fff3dd57d6f in ?? ()
#24 0x0000000000000000 in ?? ()

The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum http://root.cern.ch/forum.
Only if you are really convinced it is a bug in ROOT then please submit a
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.

#5 0x00007fb35dc5b641 in TClass::TDeclNameRegistry::AddQualifiedName(char const*) () from /usr/lib/root/libCore.so
#6 0x00007fb35dc5d62b in TClass::Init(char const*, short, std::type_info const*, TVirtualIsAProxy*, char const*, char const*, int, int, ClassInfo_t*, bool) () from /usr/lib/root/libCore.so
#7 0x00007fb35dc6760f in TClass::TClass(char const*, short, bool) () from /usr/lib/root/libCore.so
#8 0x00007fb354e11dfd in TCling::GenerateTClass(char const*, bool, bool) () from /usr/lib/root/libCling.so
#9 0x00007fb35dc612f5 in TClass::AddRule(char const*) () from /usr/lib/root/libCore.so
#10 0x00007fb35dc61445 in ?? () from /usr/lib/root/libCore.so
#11 0x00007fb35dc616f3 in TClass::ReadRules() () from /usr/lib/root/libCore.so
#12 0x00007fb35db21663 in TROOT::InitInterpreter() () from /usr/lib/root/libCore.so
#13 0x00007fb35db21836 in ROOT::Internal::GetROOT2() () from /usr/lib/root/libCore.so
#14 0x00007fb35aa791c6 in operator delete(void*) () from /usr/lib/root/libNew.so
#15 0x00007fb35dc22438 in TClassTable::Add(char const*, short, std::type_info const&, TClass* ()(), int) () from /usr/lib/root/libCore.so
#16 0x00007fb35dc730b6 in ROOT::TGenericClassInfo::TGenericClassInfo(char const
, int, char const*, int, ROOT::Internal::TInitBehavior const*, TClass* (*)(), int) () from /usr/lib/root/libCore.so
#17 0x00007fb35db880ba in ROOT::GenerateInitInstance() () from /usr/lib/root/libCore.so
#18 0x00007fb35db1aa00 in ?? () from /usr/lib/root/libCore.so
#19 0x00007fb35e5c74fa in call_init.part () from /lib64/ld-linux-x86-64.so.2
#20 0x00007fb35e5c760b in _dl_init () from /lib64/ld-linux-x86-64.so.2
#21 0x00007fb35e5b8daa in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#22 0x0000000000000001 in ?? ()
#23 0x00007fff3dd57d6f in ?? ()
#24 0x0000000000000000 in ?? ()
=========================================================== [/code]

I compiled an “empty” cxx file:

int main(int argc, char **argv)
{
	return 0;
}[/code]

Compiling:
[code]g++ -I/usr/include/root -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"LibraryDebugProject.d" -MT"LibraryDebugProject.o" -o "LibraryDebugProject.o" "../LibraryDebugProject.cxx"

Linking:

g++ -L/usr/lib/root `root-config --glibs` -o "LibraryDebugProject" ./LibraryDebugProject.o -lNew;

So what exactly is causing this problem?

Hi,

The trace is pointing to the registration in the ROOT type system of a class with dictionary probably at startup but it is hard to say w/o debugging symbols. Do you happen to have a recipe to reproduce it? Can you double check that your executable is compiled with -fPIC?

Cheers,
D

Hi,

thank you for getting back to me so quickly.

Literally all it takes for me to reproduce is to compile an “empty” cxx file, linking the “New” library. I have attached a suitable cxx file. Unfortunately, I cannot attach the compile.sh I used, so here is the command:

`root-config --cxx --cflags` -g3 -O0 -fPIC -W -Wall -o NewLibraryTest NewLibraryTest.cxx `root-config --glibs` -lNew

If I try to run the resulting executable, I get the floating point exception posted above. If I do not link -lNew, everything is fine and the executable exits gracefully. If I try to link any other library (e.g. -lASImage), everthing is fine as well.
NewLibraryTest.cxx (25 Bytes)

Hi,

what do you have in the source of libNew? Can you share something I can compile too?

Cheers,
D

To the best of my knowledge, as of today, libNew is broken in ROOT 6 and it is a well known deficiency.

Hi,

libNew is the one provided by root, i.e. root-6.08.02/lib/libNew.so, so I guess you should be able to compile.

Thank you Pepe, I didn’t know that, but it explains the result.