CADMesh.hh: No such file or directory
vcguag opened this issue · 18 comments
I have installed version 1.1.
When I try to compile the example/basics, library CADMesh.hh is not found. I get:
//////////////////////////////////////////////////////////////////////////////////////////
Scanning dependencies of target cadmesh_example
[ 20%] Building CXX object CMakeFiles/cadmesh_example.dir/cadmesh_example.cc.o
[ 40%] Building CXX object CMakeFiles/cadmesh_example.dir/src/PrimaryGeneratorAction.cc.o
[ 60%] Building CXX object CMakeFiles/cadmesh_example.dir/src/DetectorConstruction.cc.o
/home/victor/CADMesh-1.1/examples/basic/src/DetectorConstruction.cc:16:22: fatal error: CADMesh.hh: No such file or directory
compilation terminated.
CMakeFiles/cadmesh_example.dir/build.make:110: recipe for target 'CMakeFiles/cadmesh_example.dir/src/DetectorConstruction.cc.o' failed
make[2]: *** [CMakeFiles/cadmesh_example.dir/src/DetectorConstruction.cc.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/cadmesh_example.dir/all' failed
make[1]: *** [CMakeFiles/cadmesh_example.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
//////////////////////////////////////////////////////////////////////////////////////////
Before that, the output of the cmake instruction was:
//////////////////////////////////////////////////////////////////////////////////////////
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.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
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
cadmesh_DIR
-- Build files have been written to: /home/victor/CADMesh-1.1/examples/basic/build
//////////////////////////////////////////////////////////////////////////////////////////
I have tried to follow the entry "Have the example/s compile when the library is compiled, and provide a template project" where changes in the CMakeList.txt are suggested. It did not work. If I try to include CADMesh.hh by hand in the include folder, other libraries are missing...
Thanks in advance for your help!
I had the same issue and what finally helped was not using a separate installation directory during the initial setup. In other words, during the installation I skipped the optional installation path. Instead of using
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=<optional install location>
make
sudo make install
I simply used
cmake ..
make
sudo make install
Hi,
I'm having a very similar problem.
I tried using cmake .. -DCMAKE_INSTALL_PREFIX:PATH= to specify the installation location but it kept building in the build directory anyway. For example
cmake .. -DCMAKE_INSTALL_PREFIX=/home/local1/geant4/work/CAD
yields
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /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: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /bin/pkg-config (found version "0.27.1")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/local1/geant4/work/CAD/CADMesh-1.1/build
When I then try to tell the example build to look here
cmake .. -Dcadmesh_DIR:PATH=/home/local1/geant4/work/CAD/CADMesh-1.1/build/
I get
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /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: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
cadmesh_DIR
-- Build files have been written to: /home/local1/geant4/work/CAD/CADMesh-1.1/examples/basic/build
If I then make, I get the very same problem the open posters gets.
[ 20%] Building CXX object CMakeFiles/cadmesh_example.dir/cadmesh_example.cc.o
[ 40%] Building CXX object CMakeFiles/cadmesh_example.dir/src/DetectorConstruction.cc.o
/home/local1/geant4/work/CAD/CADMesh-1.1/examples/basic/src/DetectorConstruction.cc:16:22: fatal error: CADMesh.hh: No such file or directory
#include "CADMesh.hh"
^
compilation terminated.
make[2]: *** [CMakeFiles/cadmesh_example.dir/src/DetectorConstruction.cc.o] Error 1
make[1]: *** [CMakeFiles/cadmesh_example.dir/all] Error 2
make: *** [all] Error 2
Any ideas?
Thanks in advance
Dean
If no path is specified, in my case it was installed in /usr/local
. To find CADMesh.hh I had to do:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
Another possibility that also works for me is to create a CADMeshInstall folder and indicate it:
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/home/..../CADMesh-1.1/CADMeshInstall
And then:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/.../CADMesh-1.1/CADMeshInstall/lib
I ran into the same problem when I tried the example.
CMake issues the warning:
CMake Warning:
Manually-specified variables were not used by the project:
cadmesh_DIR
because cadmesh isn't being used.
Go to the CMakeLists.txt
file under examples/basic
and uncomment the lines 10 and 11:
find_package(cadmesh)
include_directories(${CADMESH_INCLUDE_DIRS})
I also found I had a linking error with line 20 so I commented out line 20 and uncommented line 21:
#target_link_libraries(cadmesh_example cadmesh)
target_link_libraries(cadmesh_example ${cadmesh_LIBRARIES})
This last part could be OS-specific (I'm on a mac).
I've done something similar with a few CADMesh-using programmes.
See here: KevinCWLi/K600-ALBA#2 and here: KevinCWLi/K600#3 for details.
Hi,
Thanks for all the feedback, I was able to get a little further but I've ran into another error.
Inside the basic example (/home/local1/geant4/work/CAD/CADMesh-1.1/examples/basic/build).
I cmake .. and then I make,
localhost:/build < 20 >make
Scanning dependencies of target cadmesh_example
[ 20%] Building CXX object CMakeFiles/cadmesh_example.dir/cadmesh_example.cc.o
[ 40%] Building CXX object CMakeFiles/cadmesh_example.dir/src/DetectorConstruction.cc.o
[ 60%] Building CXX object CMakeFiles/cadmesh_example.dir/src/PhysicsList.cc.o
[ 80%] Building CXX object CMakeFiles/cadmesh_example.dir/src/PrimaryGeneratorAction.cc.o
[100%] Linking CXX executable cadmesh_example
[100%] Built target cadmesh_example
localhost:/build < 21 >./cadmesh_example
./cadmesh_example: error while loading shared libraries: libcadmesh.so: cannot open shared object file: No such file or directory
I the executable exists but it throws up that error.
I can see libcadmesh.so in /home/local1/geant4/work/CAD/CADMesh-1.1/build
Thanks again.
Dean
This likely means that the library paths haven't been set. Now, I think that if you've got the LD_LIBRARY_PATH variable being exported in your .bashrc then it should probably find the library file.
However, in one of my replies above - and the reply from @bxyzhu - we noted that there are some problems with linking libraries sometimes. I think (with no particularly strong evidence...) that this may be the problem in the current case.
Check that the LD_LIBRARY_PATH includes the directory which you've given above (post the output of export $LD_LIBRARY_PATH if you want us to check) and if it doesn't, add export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/local1/geant4/work/CAD/CADMesh-1.1/build to your .bashrc.
If that doesn't work, do what @bxyzhu suggests in his answer. If that doesn't work then maybe try what I suggested in the two issues that I posted. If that doesn't work then... uh... we'll think of something.
Hi guys,
I followed your advice padsley, I tried
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/local1/geant4/work/CAD/CADMesh-1.1/build
but go this error
Bad : modifier in $ (/).
So they I tried
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:"/home/local1/geant4/work/CAD/CADMesh-1.1/build"
And I got no errors. So I tried the executable and I think it worked.
Cheers guys.
Dean
I'm glad that it worked. Sorry about the export vs setenv thing, I didn't ask what kind of shell you had. Oops.
If you're happy and you think that everything is fixed then maybe close the issue? Then at least the guy running CADMesh knows that the problem is fixed.
I've been able to run .ply files in Geant4, so yes, the issue is sorted and thank you a lot.
Just as a point I ran into. If you run a weird structure, you can get transport errors.
I put this in my stepping action to stop them from appearing in my output.
G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->SetPushVerbosity(0);}
Dean
Hi. I'm having the same (or a similar) problem.
I have installed cadmesh to the usual /usr/local/lib. Installation goes okay, but I get the warning:
CMake Warning (dev):
Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake
--help-policy CMP0042" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
MACOSX_RPATH is not specified for the following targets:
tet
This warning is for project developers. Use -Wno-dev to suppress it.
I get this for assimp, cadmesh, and tet.
After installation, I attempt to build the example (or any other thing depending on cadmesh) and I get:
[100%] Linking CXX executable cadmesh_example
ld: library not found for -lcadmesh
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [cadmesh_example] Error 1
make[1]: *** [CMakeFiles/cadmesh_example.dir/all] Error 2
make: *** [all] Error 2
I have manually added cadmesh to my environment variables and tried the solutions in this thread, but have nothing yet.
Running out of ideas...
I think I had a similar problem regarding MACOSX_RPATH, I'd try to fix the RPATH warning first.
I added the line set(CMAKE_MACOSX_RPATH 1)
into CMakesList.txt (I added it after project(cadmesh)
) and it seemed to resolve the issue.
Hi. I'm having the same (or a similar) problem.
cmake successfully, but make error:
: fatal error: CADMesh.hh: no such file or directory #include "CADMesh.hh" ^~~~~~~~~~~~ compilation terminated. CMakeFiles/cadmesh_example.dir/build.make:86: recipe for target 'CMakeFiles/cadmesh_example.dir/src/DetectorConstruction.cc.o' failed make[2]: *** [CMakeFiles/cadmesh_example.dir/src/DetectorConstruction.cc.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/cadmesh_example.dir/all' failed make[1]: *** [CMakeFiles/cadmesh_example.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2
and the Environmental variable has been written to .bashrc
i tried to change my cmakelist.txt as above, i got warning. the error didnt change.
---------------------------------------------------------------update--------------------------
hi, guys. i fixed my problem. i tried methods as above, didnt work. i installed once again, did not specify the install location. finally ,it worked.
besides, i specified the location , then i found the include ,lib dictionary were locked. maybe it's the reason?
thanks a lot. i reinstall the package using default install location(usr /local) .then no more errors.
ldxxxxx
I had the same issue and what finally helped was not using a separate installation directory during the initial setup. In other words, during the installation I skipped the optional installation path. Instead of using
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=<optional install location>
make
sudo make install
I simply used
cmake ..
make
sudo make install
I concur with this solution. It worked for me (on Ubuntu 18.04) and it's in my opinion the simplest solution.