In order to use TMapFile I link the application with “-lNew”
For example the simple program test.cpp
#include <stdio.h>
void test()
{
printf("Hello world\n");
}
#ifndef __CINT__
int main(int argc, char *argv[])
{
test();
}
#endif
compiled with
$ g+ -o test test.cpp -std=c+11 `root-config --new --cflags --glibs`
The program work without any issue with rootn.exe
$ rootn.exe test.cpp
Using the compiled program, Immediately it break
$ ./test
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0 0x00007fcba046ddbc in waitpid () from /lib64/libc.so.6
#1 0x00007fcba03f0cc2 in do_system () from /lib64/libc.so.6
#2 0x00007fcba43f522f in TUnixSystem::StackTrace() () from /home/daq/root/lib/libCore.so
#3 0x00007fcba43f797c in TUnixSystem::DispatchSignals(ESignals) () from /home/daq/root/lib/libCore.so
#4 <signal handler called>
#5 0x00007fcba04e5f5b in __strstr_sse42 () from /lib64/libc.so.6
#6 0x00007fcb9b6547dc in TCling::RegisterModule(char const*, char const**, char const**, char const*, char const*, void (*)(), std::vector<std::pair<std::string, int>, std::allocator<std::pair<std::string, int> > > const&, char const**, bool) () from /home/daq/root/lib/libCling.so
#7 0x00007fcba427d05a in TROOT::InitInterpreter() () from /home/daq/root/lib/libCore.so
#8 0x00007fcba427d3e6 in ROOT::Internal::GetROOT2() () from /home/daq/root/lib/libCore.so
#9 0x00007fcba3d627ac in TMapFile::WhichMapFile(void*) () from /home/daq/root/lib/libRIO.so
#10 0x00007fcba3d6283e in (anonymous namespace)::FreeIfTMapFile(void*) () from /home/daq/root/lib/libRIO.so
#11 0x00007fcba4d56295 in operator delete(void*) () from /home/daq/root/lib/libNew.so
#12 0x00007fcba4281744 in TROOT::RegisterModule(char const*, char const**, char const**, char const*, char const*, void (*)(), std::vector<std::pair<std::string, int>, std::allocator<std::pair<std::string, int> > > const&, char const**) () from /home/daq/root/lib/libCore.so
#13 0x00007fcba3a136c5 in (anonymous namespace)::TriggerDictionaryInitialization_libNet_Impl() () from /home/daq/root/lib/libNet.so
#14 0x00007fcba4f684c3 in _dl_init_internal () from /lib64/ld-linux-x86-64.so.2
#15 0x00007fcba4f5a1aa in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#16 0x0000000000000001 in ?? ()
#17 0x00007ffdae355ee0 in ?? ()
#18 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 0x00007fcba04e5f5b in __strstr_sse42 () from /lib64/libc.so.6
#6 0x00007fcb9b6547dc in TCling::RegisterModule(char const*, char const**, char const**, char const*, char const*, void (*)(), std::vector<std::pair<std::string, int>, std::allocator<std::pair<std::string, int> > > const&, char const**, bool) () from /home/daq/root/lib/libCling.so
#7 0x00007fcba427d05a in TROOT::InitInterpreter() () from /home/daq/root/lib/libCore.so
#8 0x00007fcba427d3e6 in ROOT::Internal::GetROOT2() () from /home/daq/root/lib/libCore.so
#9 0x00007fcba3d627ac in TMapFile::WhichMapFile(void*) () from /home/daq/root/lib/libRIO.so
#10 0x00007fcba3d6283e in (anonymous namespace)::FreeIfTMapFile(void*) () from /home/daq/root/lib/libRIO.so
#11 0x00007fcba4d56295 in operator delete(void*) () from /home/daq/root/lib/libNew.so
#12 0x00007fcba4281744 in TROOT::RegisterModule(char const*, char const**, char const**, char const*, char const*, void (*)(), std::vector<std::pair<std::string, int>, std::allocator<std::pair<std::string, int> > > const&, char const**) () from /home/daq/root/lib/libCore.so
#13 0x00007fcba3a136c5 in (anonymous namespace)::TriggerDictionaryInitialization_libNet_Impl() () from /home/daq/root/lib/libNet.so
#14 0x00007fcba4f684c3 in _dl_init_internal () from /lib64/ld-linux-x86-64.so.2
#15 0x00007fcba4f5a1aa in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#16 0x0000000000000001 in ?? ()
#17 0x00007ffdae355ee0 in ?? ()
#18 0x0000000000000000 in ?? ()
===========================================================
Fatal in <operator delete>: storage area overwritten
aborting
Aborted (core dumped)
without --new the program work without any issues
compiled with
>g++ -o test test.cpp -std=c++11 `root-config --cflags --glibs`
>./test
Hello world
>
Thanks
Federico