glicka
September 1, 2021, 3:39pm
1
I’m trying to install Geant4/Geant4Py on my MacBook Pro with the following CMake:
export OPENGL_X11="ON"
export RAYTRACER_X11="ON"
export USE_QT="ON"
export MULTITHREADED="ON"
export INSTALL_DATA="ON"
export USE_SYSTEM_EXPAT="OFF"
export STATIC_LIBS="OFF"
export G4PYINSTALL="ON"
export XERCESCPATH=/opt/xerces-c/
export XercesIncludeDir=/opt/xerces-c/include/xercesc/
export XercesRootDir=/opt/xerces-c/lib
export XercesVersion=3.2.3
export boostdir=/usr/local/Cellar/boost/1.76.0
export install_dir=$PWD/../geant4-install
export data_dir=$PWD/../geant4-data
export source_dir=$PWD/../geant4-source
export pyinstallDir=${CONDA_PREFIX}/lib/python${pyMajor}.${pyMinor}/site-packages/
cmake -DGEANT4_USE_OPENGL_X11=$OPENGL_X11 \
-DGEANT4_USE_RAYTRACER_X11=$RAYTRACER_X11 \
-DGEANT4_USE_QT=$USE_QT \
-DBUILD_STATIC_LIBS=$STATIC_LIBS \
-DGEANT4_BUILD_MULTITHREADED=$MULTITHREADED \
-DGEANT4_USE_SYSTEM_EXPAT=$USE_SYSTEM_EXPAT \
-DGEANT4_INSTALL_DATADIR=$data_dir \
-DGEANT4_INSTALL_DATA=$INSTALL_DATA \
-DCMAKE_INSTALL_PREFIX=$install_dir \
-DCMAKE_INSTALL_PYTHONDIR=$pyinstallDir \
-DGEANT4_USE_PYTHON=$G4PYINSTALL \
-DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt@5 \
-DQT_QMAKE_EXECUTABLE=/usr/local/Cellar/qt@5/5.15.2/lib \
-DGEANT4_BUILD_TLS_MODEL=global-dynamic \
-DCMAKE_PREFIX_PATH=$XERCESCPATH \
-DXercesC_INCLUDE_DIR=$XercesIncludeDir \
-DXercesC_LIBRARY=$XercesRootDir \
-DXercesC_VERSION=$XercesVersion \
-DBOOST_ROOT=/Users/aeglick/Documents/boost_1_77_0 \
-DBOOST_INCLUDEDIR=/Users/aeglick/Documents/boost_1_77_0 \
-DBOOST_LIBRARYDIR=/Users/aeglick/Documents/boost_1_77_0/stage/lib \
-DGEANT4_USE_GDML=ON \
../geant4-source
which runs to completion no problem. When I try to make it with make -j8
it runs to 94% then returns an error
make: *** [all] Error 2
after building G4physicslists.
What is happening? I don’t get this issue on linux and I’m new to Mac. Thank you!
bmorgan
September 1, 2021, 5:19pm
2
Could you trace and post the compiler command (and associated error:
message) causing the error please?
glicka
September 1, 2021, 6:00pm
3
It looks like this may be the issue.
/Users/aeglick/Geant4.10.7/geant4-source/source/persistency/gdml/include/G4GDMLRead.hh:37:10: fatal error: 'xercesc/parsers/XercesDOMParser.hpp' file not found
#include <xercesc/parsers/XercesDOMParser.hpp>
I tried to include the XercesC library path in CMake as:
export XERCESCPATH=/opt/xerces-c/
export XercesIncludeDir=/opt/xerces-c/include/xercesc/
export XercesRootDir=/opt/xerces-c/lib
export XercesVersion=3.2.3
-DCMAKE_PREFIX_PATH=$XERCESCPATH \
-DXercesC_INCLUDE_DIR=$XercesIncludeDir \
-DXercesC_LIBRARY=$XercesRootDir \
-DXercesC_VERSION=$XercesVersion \
But it didn’t seem to look there for some reason?
glicka
September 1, 2021, 7:22pm
4
I also want to point out that CMake gave me a flag that it knows where XercesC is located.
-- Found XercesC: /opt/xerces-c/lib (found version "3.2.3")
glicka
September 1, 2021, 9:41pm
5
Part of the issue is that my include path had too much detail in it. The include path should have been:
export XercesIncludeDir=/opt/xerces-c/include/
Now I am getting a new error that states:
ld: can't map file, errno=22 file '/opt/xerces-c/lib/' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
so there is still something wrong with Xerces-c.
weller
September 2, 2021, 6:00am
6
what happens if you skip all the extra detail in your cmake command? I would assume (CMAKE_PREFIX_PATH — CMake 3.21.2 Documentation ) that cmake will find, e.g., the include directory if you only provide /opt/xerces-c
as CMAKE_PREFIX_PATH
also, notice that you have CMAKE_PREFIX_PATH
defined twice in your command.
Does that work as expected? If not, I would give a try to combine into one:
CMAKE_PREFIX_PATH=/usr/local/Cellar/qt@5;$XERCESCPATH
2 Likes
bmorgan
September 2, 2021, 11:07am
7
As @weller ’s suggested, there’s no need to set the XercesC_...
variables if CMAKE_PREFIX_PATH
contains the prefix under which it’s installed. These variables are intended for use only when CMake can’t locate the headers/libraries due to unusual install layouts (and these, in general, only occur on very specialised systems).
glicka:
Now I am getting a new error that states:
ld: can't map file, errno=22 file '/opt/xerces-c/lib/' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
so there is still something wrong with Xerces-c.
This is caused by the setting -DXercesC_LIBRARY=/opt/xerces-c/lib
, which is telling CMake to link that directory as the library. I.e. it’ll result in the linker running with a flag -l/opt/xerces-c/lib
.
1 Like
glicka
September 2, 2021, 3:39pm
8
Thank you @weller @bmorgan . That fixed my issue and I can now run Geant4 and Geant4Py on my Mac!
system
Closed
September 9, 2021, 3:40pm
9
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.