I have successfully compiled root 6.00/00 on my system - using gcc 4.8.2 - and I am trying to test it, in particular in interactive mode. I understood from the announcment page that cling allows to support all C++ features, so I have tried the following SimpleMultithread.C macro:
SimpleMultithread.C (450 Bytes)
The compilation is apparently succesfull:
> root -l
root  .L SimpleMultithread.C+
but then during the execution there is an exception thrown:
root  SimpleMultithread()
Current thread id: 47554627303248
terminate called after throwing an instance of 'std::system_error'
what(): Enable multithreading to use std::thread: Operation not permitted
So it seems that cling is able to use some of the std::thread library - such as std::this_thread::get_id() when called from the main thread - but not the multi-threading itself.
Is it because this C++11 feature is not supported yet, or because I did not installed root correctly?
I did the following:
./configure linuxx8664gcc --all
but maybe I should have added some other options.
thanks for trying this out.
It looks that the libpthread.so is not correctly linked. I am looking into it.
could you share the detalis of the linux flavour you are working on?
I added the description of this behaviour in our ticketing system
A solution will be provided soon.
Meanwhile, you can work this around preloading libpthread.so. On my system (kubuntu)
cat /etc/issue gives:
Scientific Linux release 5.9 (Boron)
uname -a gives:
Linux clratlserv03.in2p3.fr 2.6.18-348.4.1.el5 #1 SMP Tue Apr 16 15:42:58 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
So it’s slc5, x86_64. I installed gcc4.8.2 and root6.00/00 myself, so the problem might be due to me. However, if I transform this named macro into a main and compile it with gcc, the program works correctly; therefore I think my gcc is ok (and I did several programs using std::thread with this gcc setup without any problems).
Your workaround works after adapting it to my system:
So I suppose that when I did the ./configure , I just should have specified a path to the directory where libpthread.so.0 is? Is it not able to find it by itself?
what is happening is that the ./configure finds correctly all the libraries (try ldd $ROOTSYS/lib/libThread.so), no action needed from your side. Too aggressive linker settings may be in use for the generation of the root executable though.