I am new to CMake and Geant4. I am trying to build a project using them.
Also, I am working in a remote cluster. When I cmake
, there's no error. But when I do make
the error I am getting is,
make[2]: *** No rule to make target '/usr/lib64/libXmu.so', needed by 'PRO_simulation'. Stop.
make[1]: *** [CMakeFiles/PRO_simulation.dir/all] Error 2
make: *** [all] Error 2
however,
ls -rt /usr/lib64/libXmu*
gives:
lrwxrwxrwx. 1 root root 15 Jan 11 2016 /usr/lib64/libXmu.so.6 -> libXmu.so.6.2.0
-rwxr-xr-x. 1 root root 109552 Nov 20 2015 /usr/lib64/libXmu.so.6.2.0
lrwxrwxrwx. 1 root root 16 Jan 11 2016 /usr/lib64/libXmuu.so.1 -> libXmuu.so.1.0.0
-rwxr-xr-x. 1 root root 19440 Nov 20 2015 /usr/lib64/libXmuu.so.1.0.0
Since its a remote cluster I cannot do a link with the name "libXmu.so" (After requesting the cluster authorities, still there's no use), but I can do the link to my local directory.
Now my question is what should I do in cmake such that, it will look for libXmu.so
in my local directory instead of /usr/lib64/libXmu.so
First of all, this is a hack and by no means a proper solution, but you can link directly to a .so
file: Link .so file to .cpp file via g++ compiling
target_link_libraries
for all targets./home/user/path/to/libXmu.so
to the cmake CXX or link flags. More information on how to do that can be found in: How do I add a linker or compile flag in a CMake file? or: Set CFLAGS and CXXFLAGS options using CMakeI would recommend that you first try something such as:
export CFLAGS=/home/user/path/to/libXmu.so
export CXXFLAGS=/home/user/path/to/libXmu.so
Before running cmake. If this fails, open CMakeLists.txt and try to find where extra CFLAGS
and CXXFLAGS
are defined and add the path to libXmu.so
Another thing that you can do is you can run make VERBOSE=1
, which will show you the exact gcc/g++ command issued, copy it in a text editor and replace -lxmu
with /home/user/path/to/libXmu.so
I hope at least one of those works.