How to solve: CMAKE_HAVE_LIBC_PTHREAD - Failed

Dear Geant4 users,
How to activate multithread when running geant4.11.0.2 examples?
For example when the following command is applied:
/run/numberOfThreads 2
(also with change number 2).
It did not work and the following error appeared:
"
***** Illegal application state </run/numberOfThreads 2> *****

***** Batch is interrupted!! *****

-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : UIMAN0123
issued by : G4UImanager::ApplyCommand
Command aborted (200)
Error code : 200
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
"
I think (but not sure) the error come from the cmake compiling that appear in compiling (my cmake version is cmake-3.5.0-rc3) and the follwing line appeared :
Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failedas

the following is all terminal output :
"
The C compiler identification is GNU 9.3.0

– The CXX compiler identification is GNU 9.3.0

– Check for working C compiler: /usr/bin/cc

– Check for working C compiler: /usr/bin/cc – works

– Detecting C compiler ABI info

– Detecting C compiler ABI info - done

– Detecting C compile features

– Detecting C compile features - done

– Check for working CXX compiler: /usr/bin/c++

– Check for working CXX compiler: /usr/bin/c++ – works

– Detecting CXX compiler ABI info

– Detecting CXX compiler ABI info - done

– Detecting CXX compile features

– Detecting CXX compile features - done

– Found EXPAT: /usr/lib/x86_64-linux-gnu/libexpat.so (found suitable version “2.2.9”, minimum required is “2.2.9”)

– Looking for pthread.h

– Looking for pthread.h - found

– Performing Test CMAKE_HAVE_LIBC_PTHREAD

– Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed

– Check if compiler accepts -pthread

– Check if compiler accepts -pthread - yes

– Found Threads: TRUE

– Found XercesC: /usr/lib/x86_64-linux-gnu/libxerces-c.so (found suitable version “3.2.2”, minimum required is “3.2.2”)

– Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so

– Found X11: /usr/include

– Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so

– Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found

– Looking for gethostbyname

– Looking for gethostbyname - found

– Looking for connect

– Looking for connect - found

– Looking for remove

– Looking for remove - found

– Looking for shmat

– Looking for shmat - found

– Looking for IceConnectionNumber in ICE

– Looking for IceConnectionNumber in ICE - found

– Found Geant4: /home/username/geant4.11/install_g4/lib/Geant4-11.0.2/Geant4Config.cmake (found version “11.0.2”)

– Configuring done

– Generating done

– Build files have been written to: example
"

Dear nassarasemi,

from the output that you attach I would guess that you are applying the “/run/numberOfThreads 2” command after you have run the “/run/initialize” command in you macro (given that you don’t initialize directly in your main).

What happens if the numberOfThreads command is the first one in your macro?
In case you initialize the run manager in your main, can you try to comment it out and then add the command to your macro?

Best regards

You are right.
Thank you sir.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.