Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TMapFile can't work #13511

Closed
1 task
huagenxu opened this issue Aug 23, 2023 · 18 comments
Closed
1 task

TMapFile can't work #13511

huagenxu opened this issue Aug 23, 2023 · 18 comments
Assignees
Labels
Milestone

Comments

@huagenxu
Copy link

Check duplicate issues.

  • Checked for duplicates

Description

Dear Rooters,

Indeed I used the TMapFile together with TApplication to realize the online monitoring for my DAQ. After having tried many combinations of ROOT and ubuntu versions, finally it worked with ROOT 6.12.06 on Ubuntu 16.04.7 LTS (gcc 5.4.0).

The main problem is remaining with the TMapFile which requires -lNew to be included in the makefile. Once this works, the TApplication just doesn't work with error message of segmentation fault or violation. Or vice versa, TApplication works but TMapFile doesn't work.

In order to repeat the errors, I collected the three ROOT example macros (as attached) and created a makefile to compile them. In the Makefile, the option of --new or -lNew have been added. One can include them or comment them out.

On Ubuntu 20.04.1 LTS (gcc 9.4.0), with ROOT version from 6.12.06 to 6.28.04, none of the combinations got to work. For instance, when the TMapFile works with ROOT 6.12.06, then the TApplication returns an error of "Segmentation violation".

With a newer ROOT, e.g. 6.28.04, the TApplication works but the TMapFile got the error message


Error in TMapFile::TMapFile : no memory mapped file capability available
Use rootn.exe or link application against "-lNew"


Could you guys have a look at this problem and find out what happened or may find a solution? Many thanks in advance.

Huagen Xu from FZ Juelich, IKP
root_examples.zip

Reproducer

As attached, there are three Macro files plus one Makefile. Those three files are all the ROOT examples to demostrate how the TMapFile as well as the TApplication work. To reproduce the problem described above, one could follow the tipps below.

  1. Unzip the file into a local directory
  2. Open a terminal and cd to the unzipped directory, type "make" to compile the files
  3. Run "./appdemo" in a terminal to check whether TApplication works properly
  4. Run "./hisprod" in a termianl to check whether the TMapFile will be created
  5. Assuming the "hisprod" works and creates a "hsimple.map" file, run "./hisplot" in a new Terminal to check whether the TMapFile and TApplication could work together

In the Makefile, it is required to have the link of -lNew or --new for running TMapFile. With different combinations of ROOT and operating versions, the error message might be different.

ROOT version

Ubuntu 20.04.2 LTS
ROOT 6.12.06 to 6.28.04

Installation method

both of compiling and binary package

Operating system

Ubuntu

Additional context

No response

@pcanal
Copy link
Member

pcanal commented Aug 24, 2023

the TApplication works but the TMapFile got the error message

That is the 'correct' behavior, libNew is indeed required for TMapFile

Once this works, the TApplication just doesn't work with error message of segmentation fault or violation.

Can you copy/paste the entire output in that case?

@huagenxu
Copy link
Author

huagenxu commented Aug 25, 2023

With ROOT 6.12.06 on Ubuntu 20.04.2 LTS, the output of running ./hisprod is as following,

huagen@ikp191:~/Codes/root_debug$ ./hisprod 
Memory mapped file:   hsimple.map
Title:                Demo memory mapped file with histograms
Option:               CREATE
Mapped Memory region: 0x7fad65114000 - 0x7fad65209000 (0.96 MB)
Current breakval:     0x7fad6511f000
Object               Class                Size      
hpx                  TH1F                 1024      
hpxpy                TH2F                 8971      
hprof                TProfile             8584     

The output of running ./hisplot in another terminal is listed below,

huagen@ikp191:~/Codes/root_debug$ ./hisplot 

 *** Break *** segmentation violation

===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007f7e7ce9fc3a in __GI___wait4 (pid=6666, stat_loc=stat_loc
entry=0x7ffedba85938, options=options
entry=0, usage=usage
entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:27
#1  0x00007f7e7ce9fbfb in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc
entry=0x7ffedba85938, options=options
entry=0) at waitpid.c:38
#2  0x00007f7e7ce0ef67 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:172
#3  0x00007f7e7dcd1ff5 in TUnixSystem::Exec (shellcmd=<optimized out>, this=0x5573d91fe848) at /home/huagen/root/6.12.06/source/core/unix/src/TUnixSystem.cxx:2118
#4  TUnixSystem::StackTrace (this=0x5573d91fe848) at /home/huagen/root/6.12.06/source/core/unix/src/TUnixSystem.cxx:2412
#5  0x00007f7e7dccf2dc in TUnixSystem::DispatchSignals (this=0x5573d91fe848, sig=kSigSegmentationViolation) at /home/huagen/root/6.12.06/source/core/unix/src/TUnixSystem.cxx:3643
#6  <signal handler called>
#7  0x00007f7e798e7375 in cling::Value::Value (other=..., this=0x5573da647f58) at /home/huagen/root/6.12.06/source/interpreter/cling/include/cling/Interpreter/Value.h:175
#8  llvm::SmallVectorTemplateBase<cling::Value, false>::push_back (Elt=..., this=0x5573da647f38) at /home/huagen/root/6.12.06/source/interpreter/llvm/src/include/llvm/ADT/SmallVector.h:221
#9  TClingCallFunc::SetArg (this=0x5573da647f08, param=140732583677033) at /home/huagen/root/6.12.06/source/core/metacling/src/TClingCallFunc.cxx:2254
#10 0x00007f7e7db9ad97 in TInterpreter::CallFunc_SetArg<char> (arg=0x7ffedba88c69 "X11", func=0x5573da647f08, this=0x5573d927fe38) at /home/huagen/root/6.12.06/build/include/TInterpreter.h:343
#11 TInterpreter::CallFunc_SetArgImpl<char const*, char const*> (head=<optimized out>, func=0x5573da647f08, this=0x5573d927fe38) at /home/huagen/root/6.12.06/build/include/TInterpreter.h:345
#12 TInterpreter::CallFunc_SetArguments<char const*, char const*> (func=0x5573da647f08, this=0x5573d927fe38) at /home/huagen/root/6.12.06/build/include/TInterpreter.h:355
#13 TMethodCall::SetParams<char const*, char const*> (this=<optimized out>) at /home/huagen/root/6.12.06/build/include/TMethodCall.h:106
#14 TPluginHandler::ExecPluginImpl<char const*, char const*> (this=0x5573da070668) at /home/huagen/root/6.12.06/build/include/TPluginManager.h:159
#15 TPluginHandler::ExecPlugin<char const*, char const*> (nargs=2, this=0x5573da070668) at /home/huagen/root/6.12.06/build/include/TPluginManager.h:174
#16 TApplication::LoadGraphicsLibs (this=<optimized out>) at /home/huagen/root/6.12.06/source/core/base/src/TApplication.cxx:680
#17 0x00007f7e7db9c45e in TApplication::InitializeGraphics (this=0x5573da058cf8) at /home/huagen/root/6.12.06/source/core/base/src/TApplication.cxx:277
#18 TApplication::InitializeGraphics (this=0x5573da058cf8) at /home/huagen/root/6.12.06/source/core/base/src/TApplication.cxx:267
#19 0x00007f7e7db9ea79 in TApplication::TApplication (this=0x5573da058cf8, appClassName=0x5573d8bb4309 "app", argc=0x0, argv=0x0, numOptions=0) at /home/huagen/root/6.12.06/source/core/base/src/TApplication.cxx:194
#20 0x00005573d8bb2cb6 in main ()
===========================================================


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.
===========================================================
#7  0x00007f7e798e7375 in cling::Value::Value (other=..., this=0x5573da647f58) at /home/huagen/root/6.12.06/source/interpreter/cling/include/cling/Interpreter/Value.h:175
#8  llvm::SmallVectorTemplateBase<cling::Value, false>::push_back (Elt=..., this=0x5573da647f38) at /home/huagen/root/6.12.06/source/interpreter/llvm/src/include/llvm/ADT/SmallVector.h:221
#9  TClingCallFunc::SetArg (this=0x5573da647f08, param=140732583677033) at /home/huagen/root/6.12.06/source/core/metacling/src/TClingCallFunc.cxx:2254
#10 0x00007f7e7db9ad97 in TInterpreter::CallFunc_SetArg<char> (arg=0x7ffedba88c69 "X11", func=0x5573da647f08, this=0x5573d927fe38) at /home/huagen/root/6.12.06/build/include/TInterpreter.h:343
#11 TInterpreter::CallFunc_SetArgImpl<char const*, char const*> (head=<optimized out>, func=0x5573da647f08, this=0x5573d927fe38) at /home/huagen/root/6.12.06/build/include/TInterpreter.h:345
#12 TInterpreter::CallFunc_SetArguments<char const*, char const*> (func=0x5573da647f08, this=0x5573d927fe38) at /home/huagen/root/6.12.06/build/include/TInterpreter.h:355
#13 TMethodCall::SetParams<char const*, char const*> (this=<optimized out>) at /home/huagen/root/6.12.06/build/include/TMethodCall.h:106
#14 TPluginHandler::ExecPluginImpl<char const*, char const*> (this=0x5573da070668) at /home/huagen/root/6.12.06/build/include/TPluginManager.h:159
#15 TPluginHandler::ExecPlugin<char const*, char const*> (nargs=2, this=0x5573da070668) at /home/huagen/root/6.12.06/build/include/TPluginManager.h:174
#16 TApplication::LoadGraphicsLibs (this=<optimized out>) at /home/huagen/root/6.12.06/source/core/base/src/TApplication.cxx:680
#17 0x00007f7e7db9c45e in TApplication::InitializeGraphics (this=0x5573da058cf8) at /home/huagen/root/6.12.06/source/core/base/src/TApplication.cxx:277
#18 TApplication::InitializeGraphics (this=0x5573da058cf8) at /home/huagen/root/6.12.06/source/core/base/src/TApplication.cxx:267
#19 0x00007f7e7db9ea79 in TApplication::TApplication (this=0x5573da058cf8, appClassName=0x5573d8bb4309 "app", argc=0x0, argv=0x0, numOptions=0) at /home/huagen/root/6.12.06/source/core/base/src/TApplication.cxx:194
#20 0x00005573d8bb2cb6 in main ()
===========================================================


huagen@ikp191:~/Codes/root_debug$ 

@pcanal
Copy link
Member

pcanal commented Aug 28, 2023

I noticed that the code you upload contains:

gROOT->Reset();

This call is only valid when used in an unnamed macro. In all other scenario it has the potential of being harmful (undo/reset too many things). Please try again after removing those lines.

@pcanal
Copy link
Member

pcanal commented Aug 28, 2023

In addition on my version of Ubuntu the default linker behavior is to drop library that it deems 'not neededbecause there is no explicit symbol requested. libNew` is such a library. And indeed in my case doing:

ldd ./hisprod | grep libNew

shows nothing.

To fix this I use this line in your Makefile:

ROOTGLIBS     = $(shell root-config --glibs)  -Wl,--no-as-needed  -lNew

And after that it works perfectly.

@pcanal pcanal changed the title TMapFile can't work together with TApplication TMapFile can't work ~~together with TApplication~~ Aug 28, 2023
@pcanal pcanal changed the title TMapFile can't work ~~together with TApplication~~ TMapFile can't work Aug 28, 2023
@pcanal
Copy link
Member

pcanal commented Aug 28, 2023

Note that all ROOT application will have a TApplication object where you explicit request one or not and thus this is actually unrelated to your problem.

@huagenxu
Copy link
Author

Many thanks for your effort, I would try your tipps on different Ubuntu system and update to you soon.

@huagenxu
Copy link
Author

huagenxu commented Sep 7, 2023

Compiling the codes with

ROOTGLIBS     = $(shell root-config --glibs)  -Wl,--no-as-needed  -lNew

( gRoot->Reset() was removed)
The results of the OS and Root versions, only Root 6.11.02 and 6.12.04 work on Ubuntu 16.04.1.

OS: Ubuntu 16.04.1
ROOT: 6.14.06 (compiled); TMapFile: failed; TApplication: works
ROOT: 6.11.02 (binary); TMapFile: works; TApplication: works
ROOT: 6.12.04 (binary); TMapFile: works; TApplication: works
ROOT: 6.13.08 (binary); TMapFile: failed; TApplication: works
ROOT: 6.14.06 (binary); TMapFile: failed; TApplication: works
ROOT: 6.16.00 (binary); TMapFile: failed; TApplication: works
ROOT: 6.18.04 (binary); TMapFile: failed; TApplication: works
ROOT: 6.20.00 (binary); Make error,

/home/koala/root/6.20.00.bin/lib/libHist.so: undefined reference to `exp@GLIBC_2.29'
/home/koala/root/6.20.00.bin/lib/libHist.so: undefined reference to `log@GLIBC_2.29'
/home/koala/root/6.20.00.bin/lib/libHist.so: undefined reference to `pow@GLIBC_2.29'
collect2: error: ld returned 1 exit status
Makefile:28: recipe for target 'hisprod' failed

ROOT: 6.22.00 (binary); Make error,

ROOTDataFrame -pthread -lm -ldl -rdynamic -lNew -Wl,--no-as-needed
/home/koala/root/6.22.00.bin/lib/libHist.so: undefined reference to `exp@GLIBC_2.29'
/home/koala/root/6.22.00.bin/lib/libHist.so: undefined reference to `log@GLIBC_2.29'
/home/koala/root/6.22.00.bin/lib/libHist.so: undefined reference to `pow@GLIBC_2.29'
collect2: error: ld returned 1 exit status
Makefile:28: recipe for target 'hisprod' failed

ROOT: 6.22.00 (binary), 6.24.8 (binary), 6.26.10 (binary) and 6.28.04 (binary) came across the same “Make error” as above.

@huagenxu
Copy link
Author

huagenxu commented Sep 7, 2023

OS: Ubuntu 18.04.6
ROOT: 6.13.08 (binary); Make error
ROOT: 6.14.06 (binary); Make error
ROOT: 6.16.00 (binary): TMapFile: works, TApplication: failed

Error in <TExMap::Add>: key 140702651440656 is not unique
 *** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007ff7e1a5e337 in __GI___waitpid (pid=4208, stat_loc=stat_loc
entry=0x7ffd6b4ee5e8, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
#1  0x00007ff7e19c9047 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:149
#2  0x00007ff7e40dde83 in TUnixSystem::StackTrace() () from /home/koala/root/6.16.00.bin/lib/libCore.so.6.16
#3  0x00007ff7e40e0874 in TUnixSystem::DispatchSignals(ESignals) () from /home/koala/root/6.16.00.bin/lib/libCore.so.6.16
#4  <signal handler called>
#5  0x00007ff7dbd7bc73 in TClingCallFunc::SetArg(long) () from /home/koala/root/6.16.00.bin/lib/libCling.so
#6  0x00007ff7e3f89fef in TApplication::LoadGraphicsLibs() () from /home/koala/root/6.16.00.bin/lib/libCore.so.6.16
#7  0x00007ff7e3f895bc in TApplication::InitializeGraphics() () from /home/koala/root/6.16.00.bin/lib/libCore.so.6.16
#8  0x00007ff7e3f8f54b in TApplication::TApplication(char const*, int*, char**, void*, int) () from /home/koala/root/6.16.00.bin/lib/libCore.so.6.16
#9  0x0000560cc64cfdde in main ()
===========================================================
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  0x00007ff7dbd7bc73 in TClingCallFunc::SetArg(long) () from /home/koala/root/6.16.00.bin/lib/libCling.so
#6  0x00007ff7e3f89fef in TApplication::LoadGraphicsLibs() () from /home/koala/root/6.16.00.bin/lib/libCore.so.6.16
#7  0x00007ff7e3f895bc in TApplication::InitializeGraphics() () from /home/koala/root/6.16.00.bin/lib/libCore.so.6.16
#8  0x00007ff7e3f8f54b in TApplication::TApplication(char const*, int*, char**, void*, int) () from /home/koala/root/6.16.00.bin/lib/libCore.so.6.16
#9  0x0000560cc64cfdde in main ()
===========================================================


ROOT: 6.18.04 (binary) TMapFile: works                 TApplication: failed (same error as 6.16.00. 
ROOT: 6.20.00 (binary), Make error,
DataFrame -pthread -lm -ldl -rdynamic -Wl,--no-as-needed -lNew
/home/koala/root/6.20.00.bin/lib/libHist.so: undefined reference to `exp@GLIBC_2.29'
/home/koala/root/6.20.00.bin/lib/libHist.so: undefined reference to `log@GLIBC_2.29'
/home/koala/root/6.20.00.bin/lib/libHist.so: undefined reference to `pow@GLIBC_2.29'
collect2: error: ld returned 1 exit status
Makefile:29: recipe for target 'hisprod' failed
make: *** [hisprod] Error 1

ROOT: 6.22.00 (binary), Make error, same as 6.20.00
ROOT: 6.24.08 (binary), Make error, same as 6.20.00
ROOT: 6.26.10 (binary), Make error, same as 6.20.00
ROOT: 6.28.04 (binary), Make error,

ysics -lMathCore -lThread -lMultiProc -lROOTDataFrame -Wl,-rpath,/home/koala/root/6.28.04.bin/lib -pthread -lm -ldl -rdynamic -Wl,--no-as-needed -lNew
/home/koala/root/6.28.04.bin/lib/libRIO.so: undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream()@GLIBCXX_3.4.26'
/home/koala/root/6.28.04.bin/lib/libHist.so: undefined reference to `exp@GLIBC_2.29'
/home/koala/root/6.28.04.bin/lib/libHist.so: undefined reference to `log@GLIBC_2.29'
/home/koala/root/6.28.04.bin/lib/libHist.so: undefined reference to `pow@GLIBC_2.29'
collect2: error: ld returned 1 exit status
Makefile:29: recipe for target 'hisprod' failed
make: *** [hisprod] Error 1

@huagenxu
Copy link
Author

huagenxu commented Sep 7, 2023

OS: Ubuntu 20.04.4

Only ROOT 6.28.04 works with the proposed ROOT-CONFIG.

ROOT: 6.13.08 (binary); Compiling works, but missing libtinfo.so.5 for running.

huagen@ikp191:~/Codes/root_debug$ ./appdemo 
Fatal in <TROOT::InitInterpreter>: cannot load library libtinfo.so.5: cannot open shared object file: No such file or directory

ROOT: 6.14.06 (binary); Compiling works, but missing libtinfo.so.5 for running. 
ROOT: 6.16.00 (binary); Compiling works, but missing libtinfo.so.5 for running. 
ROOT: 6.18.04 (binary); Compiling works, but missing libtinfo.so.5 for running.
ROOT: 6.20.00 (binary); Compiling works, TMapFile works, but TApplication failed with error,
huagen@ikp191:~/Codes/root_debug$ ./appdemo 
ERROR in cling::CIFactory::createCI(): cannot extract standard library include paths!
Invoking:
  x86_64-linux-gnu-g++-8  -O3 -DNDEBUG -xc++ -E -v /dev/null 2>&1 | sed -n -e '/^.include/,${' -e '/^ \/.*++/p' -e '}'
Results was:
With exit code 0
 *** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007fd1435d9c3a in __GI___wait4 (pid=47601, stat_loc=stat_loc
entry=0x7fffc08d2908, options=options
entry=0, usage=usage
entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:27
#1  0x00007fd1435d9bfb in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc
entry=0x7fffc08d2908, options=options
entry=0) at waitpid.c:38
#2  0x00007fd143548f67 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:172
#3  0x00007fd1444a57e0 in TUnixSystem::StackTrace() () from /home/huagen/root/6.20.00.bin/lib/libCore.so.6.20
#4  0x00007fd1444a8244 in TUnixSystem::DispatchSignals(ESignals) () from /home/huagen/root/6.20.00.bin/lib/libCore.so.6.20
#5  <signal handler called>
#6  0x00007fd13fdbd1d8 in TCling::CallFunc_Factory() const () from /home/huagen/root/6.20.00.bin/lib/libCling.so
#7  0x00007fd14446e452 in TMethodCall::Init(TFunction const*) () from /home/huagen/root/6.20.00.bin/lib/libCore.so.6.20
#8  0x00007fd144397703 in TPluginHandler::SetupCallEnv() () from /home/huagen/root/6.20.00.bin/lib/libCore.so.6.20
#9  0x00007fd144397b93 in TPluginHandler::CheckForExecPlugin(int) () from /home/huagen/root/6.20.00.bin/lib/libCore.so.6.20
#10 0x00007fd14435c0c4 in TApplication::LoadGraphicsLibs() () from /home/huagen/root/6.20.00.bin/lib/libCore.so.6.20
#11 0x00007fd14435b67a in TApplication::InitializeGraphics() () from /home/huagen/root/6.20.00.bin/lib/libCore.so.6.20
#12 0x00007fd144361088 in TApplication::TApplication(char const*, int*, char**, void*, int) () from /home/huagen/root/6.20.00.bin/lib/libCore.so.6.20
#13 0x0000558ef4e6f2cc in main ()
===========================================================
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.
===========================================================
#6  0x00007fd13fdbd1d8 in TCling::CallFunc_Factory() const () from /home/huagen/root/6.20.00.bin/lib/libCling.so
#7  0x00007fd14446e452 in TMethodCall::Init(TFunction const*) () from /home/huagen/root/6.20.00.bin/lib/libCore.so.6.20
#8  0x00007fd144397703 in TPluginHandler::SetupCallEnv() () from /home/huagen/root/6.20.00.bin/lib/libCore.so.6.20
#9  0x00007fd144397b93 in TPluginHandler::CheckForExecPlugin(int) () from /home/huagen/root/6.20.00.bin/lib/libCore.so.6.20
#10 0x00007fd14435c0c4 in TApplication::LoadGraphicsLibs() () from /home/huagen/root/6.20.00.bin/lib/libCore.so.6.20
#11 0x00007fd14435b67a in TApplication::InitializeGraphics() () from /home/huagen/root/6.20.00.bin/lib/libCore.so.6.20
#12 0x00007fd144361088 in TApplication::TApplication(char const*, int*, char**, void*, int) () from /home/huagen/root/6.20.00.bin/lib/libCore.so.6.20
#13 0x0000558ef4e6f2cc in main ()
===========================================================

ROOT 6.22.00 (binary); TMapFile: works, TApplication: failed

huagen@ikp191:~/Codes/root_debug$ ./appdemo 
 *** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007f3f00a51c3a in __GI___wait4 (pid=48533, stat_loc=stat_loc
entry=0x7fff7b0eece8, options=options
entry=0, usage=usage
entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:27
#1  0x00007f3f00a51bfb in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc
entry=0x7fff7b0eece8, options=options
entry=0) at waitpid.c:38
#2  0x00007f3f009c0f67 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:172
#3  0x00007f3f01963e2e in TUnixSystem::StackTrace() () from /home/huagen/root/6.22.00.bin/lib/libCore.so.6.22
#4  0x00007f3f01960cb5 in TUnixSystem::DispatchSignals(ESignals) () from /home/huagen/root/6.22.00.bin/lib/libCore.so.6.22
#5  <signal handler called>
#6  0x00007f3efcf2ec22 in TCling::CallFunc_Factory() const () from /home/huagen/root/6.22.00.bin/lib/libCling.so
#7  0x00007f3f01929332 in TMethodCall::Init(TFunction const*) () from /home/huagen/root/6.22.00.bin/lib/libCore.so.6.22
#8  0x00007f3f0184950b in TPluginHandler::SetupCallEnv() () from /home/huagen/root/6.22.00.bin/lib/libCore.so.6.22
#9  0x00007f3f018499c3 in TPluginHandler::CheckForExecPlugin(int) () from /home/huagen/root/6.22.00.bin/lib/libCore.so.6.22
#10 0x00007f3f0180ed14 in TApplication::LoadGraphicsLibs() () from /home/huagen/root/6.22.00.bin/lib/libCore.so.6.22
#11 0x00007f3f0180e18e in TApplication::InitializeGraphics() () from /home/huagen/root/6.22.00.bin/lib/libCore.so.6.22
#12 0x00007f3f01812be1 in TApplication::TApplication(char const*, int*, char**, void*, int) () from /home/huagen/root/6.22.00.bin/lib/libCore.so.6.22
#13 0x00005563c9c9b2cc in main ()
===========================================================
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.
===========================================================
#6  0x00007f3efcf2ec22 in TCling::CallFunc_Factory() const () from /home/huagen/root/6.22.00.bin/lib/libCling.so
#7  0x00007f3f01929332 in TMethodCall::Init(TFunction const*) () from /home/huagen/root/6.22.00.bin/lib/libCore.so.6.22
#8  0x00007f3f0184950b in TPluginHandler::SetupCallEnv() () from /home/huagen/root/6.22.00.bin/lib/libCore.so.6.22
#9  0x00007f3f018499c3 in TPluginHandler::CheckForExecPlugin(int) () from /home/huagen/root/6.22.00.bin/lib/libCore.so.6.22
#10 0x00007f3f0180ed14 in TApplication::LoadGraphicsLibs() () from /home/huagen/root/6.22.00.bin/lib/libCore.so.6.22
#11 0x00007f3f0180e18e in TApplication::InitializeGraphics() () from /home/huagen/root/6.22.00.bin/lib/libCore.so.6.22
#12 0x00007f3f01812be1 in TApplication::TApplication(char const*, int*, char**, void*, int) () from /home/huagen/root/6.22.00.bin/lib/libCore.so.6.22
#13 0x00005563c9c9b2cc in main ()
===========================================================

ROOT 6.24.8 (binary); TMapFile: works; TApplication: failed with the same error as above
ROOT 6.26.10 (binary); TMapFile: works; TApplication: failed with the same error as above
ROOT 6.28.4 (binary); TMapFile: works; TApplication: works

@huagenxu
Copy link
Author

huagenxu commented Sep 7, 2023

Concerning the TApplication, somehow it often failed when the code was compiled with -lNew, which is required by TMapFile.

Indeed with line below in the makefile,
ROOTGLIBS = $(shell root-config --glibs) -Wl,--no-as-needed -lNew
it worked only with Root 6.28.04.

@huagenxu
Copy link
Author

And are there more solutions for using TMapFile on one old system such as Ubuntu 16 or 18, since the DAQ is running on it?

@huagenxu
Copy link
Author

One more explicit example, on Ubuntu 18.04 LTS,
with root-config options w/o -lNew, i.e. ROOTGLIBS = $(shell root-config --glibs) -lNew, the TMapFile did not work but TApplication works fine.
If with "-Wl,--no-as-needed -lNew", the TMapFile works but TApplication fails with segmentation violation.

Since TApplicatioin is always available for ROOT, is there any solution to make TApplication work when the option "-Wl,--no-as-needed -lNew" is introduced?

@pcanal
Copy link
Member

pcanal commented Sep 19, 2023

It works for me. In your example, Isee:

Fatal in TROOT::InitInterpreter: cannot load library libtinfo.so.5: cannot open shared object file: No such file or directory

What is going on there? Do you have this libtinfo.so.5 available in the LD_LIBRARY_PATH?

@huagenxu
Copy link
Author

Hi, Philippe,

Many thanks for your effort. Indeed, the case of missing libtinfo.so.5 happened to the root versions of 6.14.06, 6.16.00 and 6.18.04, however the libtinfo.so.6 is availabe on Ubuntu 20.04.4. From 6.20.00 on, the error of missing libtinfo.so.5 does not appere any more.

Maybe we could focus on one specific OS, for instance, Ubuntu 20.04.4. Have you tested the macros on Ubuntu 20.04.4? Or which system and which version have you used?

Concerning the ROOT versions (6.24.08, 6.26.10 and 6.28.04) on the Ubuntu 20.04.4 (gcc 9.4), those 3 ROOT versions all have been tested with gcc9.4, however, except for 6.28.04, the 6.24.08 and 6.26.10 both don't work with TApplication when the macro was compiled with the ROOT-CONFIG option of "-Wl,--no-as-needed -lNew".

Without the option "-Wl,--no-as-needed -lNew", the TApplication works properly as expected. Could you have a closer look at this issue? What I want is to have more working combinations of ROOT and Ubuntu, therefore I don't have to update each OS system and the EMS system, which is quite challenging.

Many thanks in advance.
Huagen

@huagenxu
Copy link
Author

huagenxu commented Dec 22, 2023

Hi, Philippe,

Just an update to the issue,
after having upgraded the OS to Ubuntu 22.04 LTS, Root version 6.30.02. The compilation with "-Wl, --no-as-needed -lNew" works fine.

But problems still remain:
run the demo macro of TApplication, Error messages are as following,

Fatal in <operator new>: with std::align_val_t is not implemented yet
aborting
#0  0x00007f7901aea3ea in __GI___wait4 (pid=10250, stat_loc=stat_loc
entry=0x7ffeb2a715a8, options=options
entry=0, usage=usage
entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
#1  0x00007f7901aea3ab in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc
entry=0x7ffeb2a715a8, options=options
entry=0) at ./posix/waitpid.c:38
#2  0x00007f7901a50bdb in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:171
#3  0x00007f7902b13034 in TUnixSystem::StackTrace() () from /home/koala/ROOT/root_v6.30.02/lib/libCore.so
#4  0x00007f79029d0702 in DefaultErrorHandler(int, bool, char const*, char const*) () from /home/koala/ROOT/root_v6.30.02/lib/libCore.so
#5  0x00007f7902a96fe9 in ErrorHandler () from /home/koala/ROOT/root_v6.30.02/lib/libCore.so
#6  0x00007f7902a97b69 in Fatal(char const*, char const*, ...) () from /home/koala/ROOT/root_v6.30.02/lib/libCore.so
#7  0x00007f7902d5e6ed in operator new(unsigned long, std::align_val_t) () from /home/koala/ROOT/root_v6.30.02/lib/libNew.so
#8  0x00007f78ff1f5430 in std::pair<llvm::StringMapIterator<llvm::cl::Option*>, bool> llvm::StringMap<llvm::cl::Option*, llvm::MallocAllocator>::try_emplace<llvm::cl::Option*>(llvm::StringRef, llvm::cl::Option*&&) () from /home/koala/ROOT/root_v6.30.02/lib/libCling.so
#9  0x00007f78ff1f5b3d in (anonymous namespace)::CommandLineParser::addOption(llvm::cl::Option*, llvm::cl::SubCommand*) () from /home/koala/ROOT/root_v6.30.02/lib/libCling.so
#10 0x00007f78ff1f6805 in llvm::cl::Option::addArgument() () from /home/koala/ROOT/root_v6.30.02/lib/libCling.so
#11 0x00007f78fb1ba304 in __static_initialization_and_destruction_0(int, int) [clone .constprop.0] () from /home/koala/ROOT/root_v6.30.02/lib/libCling.so
#12 0x00007f7902d6a47e in call_init (l=<optimized out>, argc=argc
entry=1, argv=argv
entry=0x7ffeb2a74cf8, env=env
entry=0x7ffeb2a74d08) at ./elf/dl-init.c:70
#13 0x00007f7902d6a568 in call_init (env=0x7ffeb2a74d08, argv=0x7ffeb2a74cf8, argc=1, l=<optimized out>) at ./elf/dl-init.c:33
#14 _dl_init (main_map=0x5572a98c1920, argc=1, argv=0x7ffeb2a74cf8, env=0x7ffeb2a74d08) at ./elf/dl-init.c:117
#15 0x00007f7901b74905 in __GI__dl_catch_exception (exception=exception
entry=0x0, operate=operate
entry=0x7f7902d71f40 <call_dl_init>, args=args
entry=0x7ffeb2a74550) at ./elf/dl-error-skeleton.c:182
#16 0x00007f7902d71ff6 in dl_open_worker (a=0x7ffeb2a746f0) at ./elf/dl-open.c:808
#17 dl_open_worker (a=a
entry=0x7ffeb2a746f0) at ./elf/dl-open.c:771
#18 0x00007f7901b748a8 in __GI__dl_catch_exception (exception=exception
entry=0x7ffeb2a746d0, operate=operate
entry=0x7f7902d71f60 <dl_open_worker>, args=args
entry=0x7ffeb2a746f0) at ./elf/dl-error-skeleton.c:208
#19 0x00007f7902d7234e in _dl_open (file=<optimized out>, mode=-2147483647, caller_dlopen=0x7f7902a01a07 <TROOT::InitInterpreter()+1031>, nsid=-2, argc=1, argv=<optimized out>, env=0x7ffeb2a74d08) at ./elf/dl-open.c:883
#20 0x00007f7901a9063c in dlopen_doit (a=a
entry=0x7ffeb2a74960) at ./dlfcn/dlopen.c:56
#21 0x00007f7901b748a8 in __GI__dl_catch_exception (exception=exception
entry=0x7ffeb2a748c0, operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:208
#22 0x00007f7901b74973 in __GI__dl_catch_error (objname=0x7ffeb2a74918, errstring=0x7ffeb2a74920, mallocedp=0x7ffeb2a74917, operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:227
#23 0x00007f7901a9012e in _dlerror_run (operate=operate
entry=0x7f7901a905e0 <dlopen_doit>, args=args
entry=0x7ffeb2a74960) at ./dlfcn/dlerror.c:138
#24 0x00007f7901a906c8 in dlopen_implementation (dl_caller=<optimized out>, mode=<optimized out>, file=<optimized out>) at ./dlfcn/dlopen.c:71
#25 ___dlopen (file=<optimized out>, mode=<optimized out>) at ./dlfcn/dlopen.c:81
#26 0x00007f7902a01a07 in TROOT::InitInterpreter() () from /home/koala/ROOT/root_v6.30.02/lib/libCore.so
#27 0x00007f7902a01bcf in ROOT::Internal::GetROOT2() () from /home/koala/ROOT/root_v6.30.02/lib/libCore.so
#28 0x00007f79029ae41d in TApplication::TApplication(char const*, int*, char**, void*, int) () from /home/koala/ROOT/root_v6.30.02/lib/libCore.so
#29 0x00005572a86f2327 in main 
Aborted (core dumped)

run the demo macro of TMapFile, similar error appears,

Fatal in <operator new>: with std::align_val_t is not implemented yet
aborting
#0  0x00007f1de22ea3ea in __GI___wait4 (pid=10442, stat_loc=stat_loc
entry=0x7ffc77af3ad8, options=options
entry=0, usage=usage
entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
#1  0x00007f1de22ea3ab in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc
entry=0x7ffc77af3ad8, options=options
entry=0) at ./posix/waitpid.c:38
#2  0x00007f1de2250bdb in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:171
#3  0x00007f1de3b13034 in TUnixSystem::StackTrace() () from /home/koala/ROOT/root_v6.30.02/lib/libCore.so
#4  0x00007f1de39d0702 in DefaultErrorHandler(int, bool, char const*, char const*) () from /home/koala/ROOT/root_v6.30.02/lib/libCore.so
#5  0x00007f1de3a96fe9 in ErrorHandler () from /home/koala/ROOT/root_v6.30.02/lib/libCore.so
#6  0x00007f1de3a97b69 in Fatal(char const*, char const*, ...) () from /home/koala/ROOT/root_v6.30.02/lib/libCore.so
#7  0x00007f1de3cb56ed in operator new(unsigned long, std::align_val_t) () from /home/koala/ROOT/root_v6.30.02/lib/libNew.so
#8  0x00007f1de01f5430 in std::pair<llvm::StringMapIterator<llvm::cl::Option*>, bool> llvm::StringMap<llvm::cl::Option*, llvm::MallocAllocator>::try_emplace<llvm::cl::Option*>(llvm::StringRef, llvm::cl::Option*&&) () from /home/koala/ROOT/root_v6.30.02/lib/libCling.so
#9  0x00007f1de01f5b3d in (anonymous namespace)::CommandLineParser::addOption(llvm::cl::Option*, llvm::cl::SubCommand*) () from /home/koala/ROOT/root_v6.30.02/lib/libCling.so
#10 0x00007f1de01f6805 in llvm::cl::Option::addArgument() () from /home/koala/ROOT/root_v6.30.02/lib/libCling.so
#11 0x00007f1ddc1ba304 in __static_initialization_and_destruction_0(int, int) [clone .constprop.0] () from /home/koala/ROOT/root_v6.30.02/lib/libCling.so
#12 0x00007f1de3cc147e in call_init (l=<optimized out>, argc=argc
entry=1, argv=argv
entry=0x7ffc77af7118, env=env
entry=0x7ffc77af7128) at ./elf/dl-init.c:70
#13 0x00007f1de3cc1568 in call_init (env=0x7ffc77af7128, argv=0x7ffc77af7118, argc=1, l=<optimized out>) at ./elf/dl-init.c:33
#14 _dl_init (main_map=0x55a9235852d0, argc=1, argv=0x7ffc77af7118, env=0x7ffc77af7128) at ./elf/dl-init.c:117
#15 0x00007f1de2374905 in __GI__dl_catch_exception (exception=exception
entry=0x0, operate=operate
entry=0x7f1de3cc8f40 <call_dl_init>, args=args
entry=0x7ffc77af6a80) at ./elf/dl-error-skeleton.c:182
#16 0x00007f1de3cc8ff6 in dl_open_worker (a=0x7ffc77af6c20) at ./elf/dl-open.c:808
#17 dl_open_worker (a=a
entry=0x7ffc77af6c20) at ./elf/dl-open.c:771
#18 0x00007f1de23748a8 in __GI__dl_catch_exception (exception=exception
entry=0x7ffc77af6c00, operate=operate
entry=0x7f1de3cc8f60 <dl_open_worker>, args=args
entry=0x7ffc77af6c20) at ./elf/dl-error-skeleton.c:208
#19 0x00007f1de3cc934e in _dl_open (file=<optimized out>, mode=-2147483647, caller_dlopen=0x7f1de3a01a07 <TROOT::InitInterpreter()+1031>, nsid=-2, argc=1, argv=<optimized out>, env=0x7ffc77af7128) at ./elf/dl-open.c:883
#20 0x00007f1de229063c in dlopen_doit (a=a
entry=0x7ffc77af6e90) at ./dlfcn/dlopen.c:56
#21 0x00007f1de23748a8 in __GI__dl_catch_exception (exception=exception
entry=0x7ffc77af6df0, operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:208
#22 0x00007f1de2374973 in __GI__dl_catch_error (objname=0x7ffc77af6e48, errstring=0x7ffc77af6e50, mallocedp=0x7ffc77af6e47, operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:227
#23 0x00007f1de229012e in _dlerror_run (operate=operate
entry=0x7f1de22905e0 <dlopen_doit>, args=args
entry=0x7ffc77af6e90) at ./dlfcn/dlerror.c:138
#24 0x00007f1de22906c8 in dlopen_implementation (dl_caller=<optimized out>, mode=<optimized out>, file=<optimized out>) at ./dlfcn/dlopen.c:71
#25 ___dlopen (file=<optimized out>, mode=<optimized out>) at ./dlfcn/dlopen.c:81
#26 0x00007f1de3a01a07 in TROOT::InitInterpreter() () from /home/koala/ROOT/root_v6.30.02/lib/libCore.so
#27 0x00007f1de3a01bcf in ROOT::Internal::GetROOT2() () from /home/koala/ROOT/root_v6.30.02/lib/libCore.so
#28 0x000055a9220122ec in main ()
Aborted (core dumped)

With "-lNew" to compile the macro, the demo macro of TApplication works fine, but the demo macro of TMapFile shows the simiar error as before, i.e.,

Error in <TMapFile::TMapFile>: no memory mapped file capability available
Use rootn.exe or link application against "-lNew"

This is the latest test with newer OS version and ROOT version. It would be highly appreciated you could have a look at this after Christmas holidays:-).

Indeed, Merry Christmas and Happy New Year!

Huagen

@pcanal
Copy link
Member

pcanal commented Dec 29, 2023

Fatal in <operator new>: with std::align_val_t is not implemented yet

indicates that libNew is being used but that the C++ standard is too high for it (i.e. it needs some additional coding to support newer standard).

@hansenjo
Copy link

hansenjo commented Feb 7, 2024

After upgrading ROOT to 6.30, one of our applications also started giving us the error mentioned in this thread

Fatal in <operator new>: with std::align_val_t is not implemented yet

A little research led me to this: https://root-forum.cern.ch/t/aborting-with-std-align-val-t-is-not-implemented-yet-rhel-9-2/55989. If I understand correctly, this is the situation:

  • TMapFile requires linking with libNew
  • libNew is broken with -std=c++17 or higher (missing operator new overload)
  • ROOT 6.30 requires C++17
  • Hence TMapFile (and actually all of libNew) is currently unusable in ROOT 6.30. There are no workarounds.

Please elaborate if I am missing something.

This is a bit of an issue. You do realize that EPEL 9 provides just such a broken version (ROOT 6.30.02 with -std=c++17). Hence, on RHEL 9/Alma 9 etc. (i.e. the current go-to version of Linux at many labs), anyone who needs to use TMapFile (or libNew) must downgrade to ROOT 6.28 and, possibly, compile by hand with -std=c++14.

Additionally, on the latest version of macOS, Sonoma, only ROOT 6.30+ is supported. Hence, any code that uses TMapFile is inevitably broken at this time on the current version of macOS. The only "workaround" would be to downgrade (i.e. reinstall) the OS.

If I might make a suggestion: I would mention, or better: highlight, such regressions in the release notes of a new version. Or better yet, not consider a new release ready until such significant regressions are resolved. Also, broken functionality could be caught at compile time instead of letting user code hit a runtime abort().

@pcanal
Copy link
Member

pcanal commented Apr 25, 2024

This fixed in v6.32.00 and v6.34.00 (master).

@pcanal pcanal closed this as completed Apr 25, 2024
@pcanal pcanal added this to the 6.34/00 milestone Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Issues
Development

No branches or pull requests

3 participants