chrono icon indicating copy to clipboard operation
chrono copied to clipboard

cannot build template_project on Ubuntu 21.10

Open IvanVnucec opened this issue 2 years ago • 6 comments

I've built and succesfully isntalled Chrono as specified in the Install documentation. I've copied template_project and cd into it, made build foder, cd into it, ran cmake -DChrono_DIR=<path_to_cloned_chrono_dir>/cmake .., I get missing Chrono_DIR error. Here is the full cmake setup console output:

$ cmake -DChrono_DIR=<path_to_cloned_chrono_dir>/cmake ..
-- Could NOT find Chrono (missing: Chrono_DIR)
Could not find Chrono or one of its required modules
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ivan/Desktop/template_project/build

I've also tried with CMake GUI by running ccmake .. in the build foder. I've set the Chrono_DIR variable to <path_to_cloned_chrono_dir>/cmake but still I get missing: Chrono_DIR error.

IvanVnucec avatar Apr 06 '22 08:04 IvanVnucec

I've managed to compile the template_project by running ccmake .. in the build folder and with configuration as follows:

 CMAKE_BUILD_TYPE                 Debug
 CMAKE_INSTALL_PREFIX             /usr/local
 Chrono_DIR                       /usr/local/lib/cmake

Then after pressing c to configure and then g to generate, I've ran make and got this successfull build message:

$ make
Scanning dependencies of target myexe
[ 50%] Building CXX object CMakeFiles/myexe.dir/my_example.cpp.o
[100%] Linking CXX executable myexe
[100%] Built target myexe

EDIT: Also, you can have the same setup without running CMake GUI by just running oneliner in the build folder cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr/local -DChrono_DIR=/usr/local/lib/cmake .., this is the output:

root@vm:~/Desktop/template_project/build$ cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr/local -DChrono_DIR=/usr/local/lib/cmake ..
-- Finding package Chrono...
--    Requested component Irrlicht (REQUIRED)
--    CHRONO_CXX_FLAGS         (Compiler flags):  -std=c++14  -fopenmp  -march=native -msse4.2 -mfpmath=sse  -march=native -mavx2  -march=native -mfma  
--    CHRONO_C_FLAGS           (Compiler flags):   -fopenmp  -march=native -msse4.2 -mfpmath=sse  -march=native -mavx2  -march=native -mfma  
--    CHRONO_LINKER_FLAGS      (Linker flags): -L/usr/local/lib
--    CHRONO_INCLUDE_DIRS      (Chrono include directories): /usr/local/include;/usr/local/include/chrono;/usr/local/include/chrono/collision/bullet;/usr/local/include/chrono/collision/gimpact;/usr/local/include/chrono_thirdparty/HACD;/usr/local/include/chrono_thirdparty/HACDv2;/usr/include/eigen3;;/usr/include/irrlicht
--    CHRONO_LIB_NAMES         (Chrono library names): ChronoEngine;ChronoEngine_irrlicht
--    CHRONO_LIBRARIES         (Chrono libraries): /usr/lib/gcc/x86_64-linux-gnu/11/libgomp.so;/usr/lib/x86_64-linux-gnu/libpthread.a;/usr/lib/x86_64-linux-gnu/libIrrlicht.so;-lXxf86vm;-lglut;-lX11;-lGL;/usr/local/lib/libChronoEngine.so;/usr/local/lib/libChronoEngine_irrlicht.so
--    CHRONO_DLL_NAMES         (Chrono DLL names): 
--    CHRONO_DLLS              (Chrono DLLs): 
--    CHRONO_DATA_DIR          (Path to Chrono data folder): /usr/local/share/chrono/data/
--    CHRONO_VEHICLE_DATA_DIR  (Path to Chrono::Vehicle data folder): /usr/local/share/chrono/data/vehicle/
--    CHRONO_FSI_DATA_DIR      (Path to Chrono::FSI data folder): /usr/local/share/chrono/data/fsi/
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ivan/Desktop/template_project/build

IvanVnucec avatar Apr 06 '22 08:04 IvanVnucec

After successfull build I've ran myexe compiled program and got the following runtime error:

$ ./myexe
./myexe: error while loading shared libraries: libChronoEngine_postprocess.so: cannot open shared object file: No such file or directory

How do I solve it?

EDIT: I see I have missing lib in the /usr/local/lib. I've just ran ls and got the following:

root@vm:/usr/local/lib$ ls -l
total 78716
drwxr-xr-x 2 root root     4096 tra   5 11:01 cmake
-rw-r--r-- 1 root root  2569032 tra   5 10:53 libChronoEngine_irrlicht.so
-rw-r--r-- 1 root root   896528 tra   5 10:48 libChronoEngine_postprocess.so
-rw-r--r-- 1 root root 73982144 tra   5 10:48 libChronoEngine.so
-rw-r--r-- 1 root root  3138248 tra   5 10:54 libChronoModels_robot.so
drwxr-xr-x 3 root root     4096 lis  12 22:39 python3.9

Maybe it is the problem in the empty DLLs path variables as stated in the comment above:

--    CHRONO_DLL_NAMES         (Chrono DLL names): 
--    CHRONO_DLLS              (Chrono DLLs): 

IvanVnucec avatar Apr 06 '22 08:04 IvanVnucec

There is a cross-module dependency that is not properly reflected in the Chrono project configuration script. This will be fixed when a feature branch will be merged in the main development branch.

Until then, please rebuild and reinstall Chrono with the Postprocess module enabled (i.e., set ENABLE_MODULE_POSTPROCESS during Chrono cmake configuration)

rserban avatar Apr 06 '22 09:04 rserban

I had Postprocess module already installed because I've followed https://api.projectchrono.org/tutorial_install_chrono_linux.html where it says that the ENABLE_MODULE_POSTPROCESS should be set to ON.

IvanVnucec avatar Apr 06 '22 09:04 IvanVnucec

I've managed to run template project executable myexe by running sudo ldconfig command as recommended here. Maybe the ldconfig command should be added to the chrono install documentation as standard procedure so someone would not loose its precious time figuring out what the problem might be.

IvanVnucec avatar Apr 06 '22 09:04 IvanVnucec

Maybe the ldconfig command should be added to the chrono install documentation as standard procedure so someone would not loose its precious time figuring out what the problem might be.

Running ldconfig for chrono may be a distribution-specific fix, but it's worth noting. My system picks it up automatically, but that might be due to some customization on my end.

thepianoboy avatar May 20 '22 16:05 thepianoboy