I'm trying to install awesome wm from source. So I created a build directory and executed the following command:
cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX
But make install tries to put some of the program files in /usr/local/share, which isn't where I want them:
> make install
[ 3%] Built target generated_sources
[ 6%] Built target test-gravity
[ 9%] Built target lgi-check
[ 9%] Built target version_stamp
[ 29%] Built target generated_icons
[ 31%] Checking for LGI...
Building for Lua 5.3.
Found lgi 0.9.2.
[ 31%] Built target lgi-check-run
[ 35%] Built target generate_awesomerc
[100%] Built target awesome
Install the project...
-- Install configuration: ""
-- Up-to-date: /home/user/.local/bin/awesome
-- Up-to-date: /home/user/.local/bin/awesome-client
-- Installing: /usr/local/share/awesome/lib
CMake Error at cmake_install.cmake:69 (file):
file INSTALL cannot make directory "/usr/local/share/awesome/lib": No such
file or directory
make: *** [Makefile:107: install] Error 1
Is there some cmake variable similar to CMAKE_INSTALL_PREFIX or CMAKE_INSTALL_LIBDIR which I need to specify for share data?
You'll have CMAKE_INSTALL_DATADIR for share when using the cmake module: include(GNUInstallDirs)
Note: when using cmake --build build --target install -- DESTDIR=foo
please read the CMAKE_INSTALL_PREFIX doc
On UNIX one can use the DESTDIR mechanism in order to relocate the whole installation. DESTDIR means DESTination DIRectory.
WARNING: DESTDIR may not be used on Windows because installation prefix usually contains a drive letter like in C:/Program Files which cannot be prepended with some other prefix.
src: https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html#variable:CMAKE_INSTALL_PREFIX
Related
I am trying to install the following C library:
https://github.com/kwhat/libuiohook
I did the described steps which seem to work with no error.
$ git clone https://github.com/kwhat/libuiohook
$ cd uiohook
$ mkdir build && cd build
$ cmake -S .. -D BUILD_SHARED_LIBS=ON -D BUILD_DEMO=ON -DCMAKE_INSTALL_PREFIX=../dist
$ cmake --build . --parallel 2 --target install
The problem is I don't know what to do next.
I tried to copy the code from the simple hook example and tried to execute the code in a different executable with the following CMakeLists.txt.
cmake_minimum_required(VERSION 3.20)
project(libuihook_test)
include_directories("/Users/ahoehne/libuiohook/dist/include")
find_library(lib uiohook)
if(NOT lib)
message(FATAL_ERROR "uiohook library not found")
endif()
set(CMAKE_CXX_STANDARD 17)
add_executable(libuihook_test main.cpp)
target_link_libraries(libuihook_test lib)
which doesn't work and results in a
CMake Error at CMakeLists.txt:9 (message):
uiohook library not found
the log from installing is the following:
[ 14%] Building C object CMakeFiles/uiohook.dir/src/darwin/input_helper.c.o
[ 14%] Building C object CMakeFiles/uiohook.dir/src/logger.c.o
[ 21%] Building C object CMakeFiles/uiohook.dir/src/darwin/input_hook.c.o
[ 28%] Building C object CMakeFiles/uiohook.dir/src/darwin/post_event.c.o
[ 35%] Building C object CMakeFiles/uiohook.dir/src/darwin/system_properties.c.o
[ 42%] Linking C shared library libuiohook.dylib
[ 42%] Built target uiohook
[ 57%] Building C object CMakeFiles/demo_post.dir/demo/demo_post.c.o
[ 57%] Building C object CMakeFiles/demo_properties.dir/demo/demo_properties.c.o
[ 71%] Linking C executable demo_properties
[ 71%] Linking C executable demo_post
[ 71%] Built target demo_post
[ 71%] Built target demo_properties
[ 78%] Building C object CMakeFiles/demo_hook.dir/demo/demo_hook.c.o
[ 85%] Building C object CMakeFiles/demo_hook_async.dir/demo/demo_hook_async.c.o
[ 92%] Linking C executable demo_hook
[100%] Linking C executable demo_hook_async
[100%] Built target demo_hook
[100%] Built target demo_hook_async
Install the project...
-- Install configuration: ""
-- Installing: /Users/ahoehne/libuiohook/dist/lib/libuiohook.1.2.0.dylib
-- Up-to-date: /Users/ahoehne/libuiohook/dist/lib/libuiohook.1.dylib
-- Up-to-date: /Users/ahoehne/libuiohook/dist/lib/libuiohook.dylib
-- Up-to-date: /Users/ahoehne/libuiohook/dist/include/uiohook.h
-- Installing: /Users/ahoehne/libuiohook/dist/lib/cmake/uiohook/uiohook-config.cmake
-- Installing: /Users/ahoehne/libuiohook/dist/lib/cmake/uiohook/uiohook-config-noconfig.cmake
-- Installing: /Users/ahoehne/libuiohook/dist/bin/demo_hook
-- Installing: /Users/ahoehne/libuiohook/dist/bin/demo_hook_async
-- Installing: /Users/ahoehne/libuiohook/dist/bin/demo_post
-- Installing: /Users/ahoehne/libuiohook/dist/bin/demo_properties
-- Installing: /Users/ahoehne/libuiohook/dist/lib/pkgconfig/uiohook.pc
I consulted the CMAKE Docs but honestly right now confuses me more than it helps. I am sure at some point I will have an aha moment and connect the dots. Most tutorials do an excellent job of explaining you C/C++ but they all lack the more advanced stuff around build tools, testing, debugging, and so on, everything you basically need to build more complex projects. So I am also grateful for book/video suggestions.
I also tried different combinations of include_directories, add, link library also an absolute path but nothing seems to work and I get a library not found error or uiohook.h not found.
I am well aware that C and C++ are completely different languages and different practices apply I am not sure If I could have fixed this question to one. But basically try to learn C++ but need to access a lot of C libs.
As the library provides a uiohook-config.cmake you should use that to link to the library via find_package rather than using find_library.
Something like this should work:
set(CMAKE_PREFIX_PATH /Users/ahoehne/libuiohook/dist/lib/cmake/uiohook/)
find_package(uiohook REQURIED)
target_link_libraries(libuihook_test uiohook)
I tried to build rtabmap_ros in my catkin_ws and I got this error:
user#user-desktop:~/catkin_ws$ catkin_make
Base path: /home/user/catkin_ws
Source space: /home/user/catkin_ws/src
Build space: /home/user/catkin_ws/build
Devel space: /home/user/catkin_ws/devel
Install space: /home/user/catkin_ws/install
####
#### Running command: "cmake /home/user/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/user/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/user/catkin_ws/install -G Unix Makefiles" in "/home/user/catkin_ws/build"
####
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.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
-- Using CATKIN_DEVEL_PREFIX: /home/user/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/user/catkin_ws/devel;/opt/ros/melodic
-- This workspace overlays: /home/user/catkin_ws/devel;/opt/ros/melodic
-- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.17", minimum required is "2")
-- Using PYTHON_EXECUTABLE: /usr/bin/python2
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/user/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python2 (found version "2.7.17")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.29
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 1 packages in topological order:
-- ~~ - rtabmap_ros
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'rtabmap_ros'
-- ==> add_subdirectory(rtabmap_ros)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
CMake Warning at rtabmap_ros/CMakeLists.txt:31 (find_package):
By not providing "Findfiducial_msgs.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"fiducial_msgs", but CMake did not find one.
Could not find a package configuration file provided by "fiducial_msgs"
with any of the following names:
fiducial_msgsConfig.cmake
fiducial_msgs-config.cmake
Add the installation prefix of "fiducial_msgs" to CMAKE_PREFIX_PATH or set
"fiducial_msgs_DIR" to a directory containing one of the above files. If
"fiducial_msgs" provides a separate development package or SDK, be sure it
has been installed.
-- Found RTABMap: /opt/ros/melodic/lib/librtabmap_core.so;/opt/ros/melodic/lib/librtabmap_utilite.so;/opt/ros/melodic/lib/librtabmap_gui.so;/usr/lib/aarch64-linux-gnu/libz.so;/opt/ros/melodic/lib/libg2o_core.so;/opt/ros/melodic/lib/libg2o_types_slam2d.so;/opt/ros/melodic/lib/libg2o_types_slam3d.so;/opt/ros/melodic/lib/libg2o_types_sba.so;/opt/ros/melodic/lib/libg2o_stuff.so;/opt/ros/melodic/lib/libg2o_solver_csparse.so;/opt/ros/melodic/lib/libg2o_csparse_extension.so;/usr/lib/aarch64-linux-gnu/libcxsparse.so;/opt/ros/melodic/lib/libg2o_solver_cholmod.so;/usr/lib/aarch64-linux-gnu/libcholmod.so;/usr/lib/aarch64-linux-gnu/libfreenect.so;/usr/lib/aarch64-linux-gnu/libfreenect_sync.so;/usr/lib/libOpenNI2.so;/usr/lib/aarch64-linux-gnu/libdc1394.so;/opt/ros/melodic/lib/liboctomap.so;/opt/ros/melodic/lib/liboctomath.so (Required is at least version "0.20.18")
-- Checking for module 'eigen3'
-- Found eigen3, version 3.3.4
-- Found eigen: /usr/include/eigen3
-- Checking for module 'libopenni'
-- Found libopenni, version 1.5.4.0
-- Found openni: /usr/lib/libOpenNI.so
-- The imported target "vtkGUISupportQt" references the file
"/usr/lib/aarch64-linux-gnu/libvtkGUISupportQt-6.3.so.6.3.0"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.
-- The imported target "vtkGUISupportQtOpenGL" references the file
"/usr/lib/aarch64-linux-gnu/libvtkGUISupportQtOpenGL-6.3.so.6.3.0"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.
-- The imported target "vtkGUISupportQtSQL" references the file
"/usr/lib/aarch64-linux-gnu/libvtkGUISupportQtSQL-6.3.so.6.3.0"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.
-- The imported target "vtkViewsQt" references the file
"/usr/lib/aarch64-linux-gnu/libvtkViewsQt-6.3.so.6.3.0"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.
-- The imported target "vtkGUISupportQtWebkit" references the file
"/usr/lib/aarch64-linux-gnu/libvtkGUISupportQtWebkit-6.3.so.6.3.0"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.
-- The imported target "vtkRenderingQt" references the file
"/usr/lib/aarch64-linux-gnu/libvtkRenderingQt-6.3.so.6.3.0"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.
-- The imported target "vtkRenderingQtTCL" references the file
"/usr/lib/aarch64-linux-gnu/libvtkRenderingQtTCL-6.3.so.6.3.0"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.
-- The imported target "vtkRenderingPythonTkWidgets" references the file
"/usr/lib/aarch64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.
-- The imported target "vtk" references the file
"/usr/bin/vtk"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.
-- The imported target "vtkRenderingQtPythonD" references the file
"/usr/lib/aarch64-linux-gnu/libvtkRenderingQtPython27D-6.3.so.6.3.0"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-6.3/VTKTargets.cmake"
but not all the files it references.
-- Found libusb-1.0: /usr/include
-- Checking for module 'flann'
-- Found flann, version 1.9.1
-- Found Flann: /usr/lib/aarch64-linux-gnu/libflann_cpp_s.a
-- Found qhull: /usr/lib/aarch64-linux-gnu/libqhull.so
-- Found PCL_COMMON: /usr/lib/aarch64-linux-gnu/libpcl_common.so
-- Found PCL_OCTREE: /usr/lib/aarch64-linux-gnu/libpcl_octree.so
-- Found PCL_IO: /usr/lib/aarch64-linux-gnu/libpcl_io.so
-- Found PCL_KDTREE: /usr/lib/aarch64-linux-gnu/libpcl_kdtree.so
-- Found PCL_SEARCH: /usr/lib/aarch64-linux-gnu/libpcl_search.so
-- Found PCL_SURFACE: /usr/lib/aarch64-linux-gnu/libpcl_surface.so
-- Found PCL_FILTERS: /usr/lib/aarch64-linux-gnu/libpcl_filters.so
-- Found PCL_2D: /usr/include/pcl-1.8
-- Found PCL_FEATURES: /usr/lib/aarch64-linux-gnu/libpcl_features.so
-- Found PCL_REGISTRATION: /usr/lib/aarch64-linux-gnu/libpcl_registration.so
-- Found PCL_SAMPLE_CONSENSUS: /usr/lib/aarch64-linux-gnu/libpcl_sample_consensus.so
-- Found PCL_GEOMETRY: /usr/include/pcl-1.8
-- Found PCL_ML: /usr/lib/aarch64-linux-gnu/libpcl_ml.so
-- Found PCL_SEGMENTATION: /usr/lib/aarch64-linux-gnu/libpcl_segmentation.so
-- Found PCL_VISUALIZATION: /usr/lib/aarch64-linux-gnu/libpcl_visualization.so
-- RTABMAP_SYNC_MULTI_RGBD = OFF
-- RTABMAP_SYNC_USER_DATA = OFF
-- rtabmap_ros: 18 messages, 16 services
-- WITH octomap_msgs
-- WITH apriltag_ros
-- WITH find_object_2d
-- checking for module 'OGRE'
-- found OGRE, version 1.9.0
-- WITH rviz
-- WITH costmap_2d
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/catkin_ws/build
####
#### Running command: "make -j4 -l4" in "/home/user/catkin_ws/build"
####
Scanning dependencies of target rtabmap_costmap_plugins
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_Point2f
Scanning dependencies of target rtabmap_point_cloud_assembler
Scanning dependencies of target rtabmap_pointcloud_to_depthimage
make[2]: *** No rule to make target '/usr/lib/aarch64-linux-gnu/libvtkGUISupportQtOpenGL-6.3.so.6.3.0', needed by '/home/user/catkin_ws/devel/lib/rtabmap_ros/point_cloud_assembler'. Stop.
make[2]: *** Waiting for unfinished jobs....
[ 0%] Building CXX object rtabmap_ros/CMakeFiles/rtabmap_point_cloud_assembler.dir/src/PointCloudAssemblerNode.cpp.o
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_Point2f
make[2]: *** No rule to make target '/usr/lib/aarch64-linux-gnu/libvtkGUISupportQtOpenGL-6.3.so.6.3.0', needed by '/home/user/catkin_ws/devel/lib/rtabmap_ros/pointcloud_to_depthimage'. Stop.
make[2]: *** Waiting for unfinished jobs....
[ 0%] Building CXX object rtabmap_ros/CMakeFiles/rtabmap_pointcloud_to_depthimage.dir/src/PointCloudToDepthImageNode.cpp.o
[ 0%] Building CXX object rtabmap_ros/CMakeFiles/rtabmap_costmap_plugins.dir/src/costmap_2d/static_layer.cpp.o
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_NodeData
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_NodeData
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_GetMap
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_GetMap
Scanning dependencies of target sensor_msgs_generate_messages_cpp
[ 0%] Built target sensor_msgs_generate_messages_cpp
Scanning dependencies of target std_msgs_generate_messages_cpp
[ 0%] Built target std_msgs_generate_messages_cpp
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_Info
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_Info
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_GetPlan
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_GetPlan
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_MapGraph
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_MapGraph
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_RemoveLabel
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_RemoveLabel
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_GetNodesInRadius
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_GetNodesInRadius
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_SetLabel
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_SetLabel
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_ScanDescriptor
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_ScanDescriptor
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_MapData
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_MapData
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_Path
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_Path
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_PublishMap
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_PublishMap
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_AddLink
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_AddLink
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_DetectMoreLoopClosures
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_DetectMoreLoopClosures
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_GPS
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_GPS
Scanning dependencies of target geometry_msgs_generate_messages_cpp
[ 0%] Built target geometry_msgs_generate_messages_cpp
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_KeyPoint
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_KeyPoint
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_OdomInfo
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_OdomInfo
Scanning dependencies of target _rtabmap_ros_generate_messages_check_deps_RGBDImages
CMakeFiles/Makefile2:706: recipe for target 'rtabmap_ros/CMakeFiles/rtabmap_point_cloud_assembler.dir/all' failed
make[1]: *** [rtabmap_ros/CMakeFiles/rtabmap_point_cloud_assembler.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 0%] Built target _rtabmap_ros_generate_messages_check_deps_RGBDImages
CMakeFiles/Makefile2:743: recipe for target 'rtabmap_ros/CMakeFiles/rtabmap_pointcloud_to_depthimage.dir/all' failed
make[1]: *** [rtabmap_ros/CMakeFiles/rtabmap_pointcloud_to_depthimage.dir/all] Error 2
[ 0%] Linking CXX shared library /home/user/catkin_ws/devel/lib/librtabmap_costmap_plugins.so
[ 0%] Built target rtabmap_costmap_plugins
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed
I also have issues installing this particular library libvtkGUISupportQtOpenGL-6.3.so.6.3.0.
It seems that you need to install fiducial_msgs:
sudo apt-get install ros-noetic-fiducial-msgs
The first comments led me through until I reached the error below
NEW ERROR AFTER running sudo apt install libeigen3-dev
CMake Error at rpg_emvs/mapper_emvs/CMakeLists.txt:16 (find_package):
By not providing "FindEigen.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Eigen", but
CMake did not find one.
Could not find a package configuration file provided by "Eigen" with any of
the following names:
EigenConfig.cmake
eigen-config.cmake
Add the installation prefix of "Eigen" to CMAKE_PREFIX_PATH or set
"Eigen_DIR" to a directory containing one of the above files. If "Eigen"
provides a separate development package or SDK, be sure it has been
installed.
This is the Cmakelists.txt file
project(mapper_emvs)
cmake_minimum_required(VERSION 2.8.3)
find_package(catkin_simple REQUIRED)
catkin_simple(ALL_DEPS_REQUIRED)
find_package(Eigen REQUIRED)
find_package(Boost REQUIRED system filesystem date_time thread)
#Setting include, lib directories and definitions
include_directories(${${Boost_INCLUDE_DIR} ${EIGEN_INCLUDE_DIRS}})
should I try commenting the eigen add package part ?
NEW ERROR After updating CMAKE file
/home/ubuntu/emvs_ws/src/numpy_eigen/include/numpy_eigen/boost_python_headers.hpp:23:22: fatal error: Eigen/Core: No such file or directory
compilation terminated.
ERROR after building numpy_eigen alone
-- verifying file...
file='/home/ubuntu/emvs_ws/build/eigen_catkin/eigen_src-prefix/src/3.3.4.tar.bz2'
-- MD5 hash of
/home/ubuntu/emvs_ws/build/eigen_catkin/eigen_src-prefix/src/3.3.4.tar.bz2
does not match expected value
expected: 'a7aab9f758249b86c93221ad417fbe18'
actual: 'd41d8cd98f00b204e9800998ecf8427e'
-- File already exists but hash mismatch. Removing...
-- Downloading...
dst='/home/ubuntu/emvs_ws/build/eigen_catkin/eigen_src-prefix/src/3.3.4.tar.bz2'
timeout='none'
-- Using src='http://bitbucket.org/eigen/eigen/get/3.3.4.tar.bz2'
[ 13%] Building CXX object numpy_eigen/CMakeFiles/numpy_eigen_test.dir/src/autogen_test_module/test_float.cpp.o
[ 13%] Building CXX object numpy_eigen/CMakeFiles/numpy_eigen_test.dir/src/autogen_test_module/numpy_eigen_test_module.cpp.o
[ 18%] Building CXX object numpy_eigen/CMakeFiles/numpy_eigen_test.dir/src/autogen_test_module/test_double.cpp.o
[ 22%] Building CXX object numpy_eigen/CMakeFiles/numpy_eigen_test.dir/src/autogen_test_module/test_uchar.cpp.o
[ 27%] Building CXX object numpy_eigen/CMakeFiles/numpy_eigen_test.dir/src/autogen_test_module/test_int.cpp.o
[ 31%] Building CXX object numpy_eigen/CMakeFiles/numpy_eigen_test.dir/src/autogen_test_module/test_long.cpp.o
/home/ubuntu/emvs_ws/src/numpy_eigen/src/autogen_test_module/test_uchar.cpp:1:22: fatal error: Eigen/Core: No such file or directory
compilation terminated.
/home/ubuntu/emvs_ws/src/numpy_eigen/src/autogen_test_module/test_float.cpp:1:22: fatal error: Eigen/Core: No such file or directory
compilation terminated.
You can download and keep inside /home/ubuntu/emvs_ws/src(assume this is your ros workspace) folder and compile with other packages which need numpy_eigen.
cd /home/ubuntu/emvs_ws/src
git clone https://github.com/ethz-asl/numpy_eigen.git
cd ../
catkin_make
I guess it's better to use catkin_make instead of catkin build, something those packages getting strange errors with catkin build. Also, if this package depends on catkin_simple, if you don't have catkin_simple, clone that repo into src and try executing catkin_make.
I want to create a shared library from cmake . I have a simple test.cpp .
My CMakeLists.txt looks like below
cmake_minimum_required(VERSION 2.8)
project (test)
set(CMAKE_BUILD_TYPE Release)
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
add_library(test SHARED /home/tuhin/test/test1/test.cpp)
But I am not able to find "test" which my .so, I have seen test.dir folder created but not .so
Please help me to understand the issue.
(I suppose you read the comments and acted accordingly...)
(I also suppose you need a way to find out where your library will be placed, from within CMake build system)
The disk location of any target does not depend on CMakeLists.txt only, but also on the choice of the generator. Multi config generators like Visual Studio something, or Xcode might append configuration name as an additional directory, so you may get different results just by choosing a different generator.
This means that there is no easy way to uniquely identify disk location during configure stage. On the other hand, you may very easily check that information during the build stage:
cmake_minimum_required(VERSION 3.15)
project (lib_file_name)
add_library(my_test_lib SHARED my_test_lib.cpp)
add_custom_target(output_lib_name
ALL
COMMAND ${CMAKE_COMMAND} -E echo "my_test_lib location: $<TARGET_FILE:my_test_lib>"
)
note add_custom_target line:
new target was added, named output_lib_name
it will be executed as a part of building the default target (-> ALL)
command to build this target is asking cmake to output the file name of the target in question, using CMAke generator expressions (--> COMMAND ${CMAKE_COMMAND} -E echo "my_test_lib location: $<TARGET_FILE:my_test_lib>")
If you run it with makefile generator:
$ cmake -S /tmp -B /tmp/make-build -G "Unix Makefiles" ; cmake --build /tmp/make-build
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/make-build
Scanning dependencies of target my_test_lib
[ 50%] Building CXX object CMakeFiles/my_test_lib.dir/my_test_lib.cpp.o
[100%] Linking CXX shared library libmy_test_lib.dylib
[100%] Built target my_test_lib
Scanning dependencies of target output_lib_name
my_test_lib location: /tmp/make-build/libmy_test_lib.dylib
[100%] Built target output_lib_name
Note the line
my_test_lib location: /tmp/make-build/libmy_test_lib.dylib
if you run it with Xcode generator:
configure:
$ cmake -S /tmp -B /tmp/xcode-build -G Xcode
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/xcode-build
build release configuration:
$ cmake --build /tmp/xcode-build --config Release
........... lot of output deleted ...........
my_test_lib location: /tmp/xcode-build/Release/libmy_test_lib.dylib
** BUILD SUCCEEDED **
build debug configuration:
$ cmake --build /tmp/xcode-build --config Debug
........... lot of output deleted ...........
my_test_lib location: /tmp/xcode-build/Debug/libmy_test_lib.dylib
** BUILD SUCCEEDED **
Note how the location is different for different configuration builds, without any change in CMake build system.
At the end, this is the cmake documentation about add_custom_command, cmake generator expressions.
I'm trying to compile and example file which needs the required library libmusicxml.
I compiled the library as they said (cmake, make, make install) and it made and installed a bunch of files:
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/libmusicxml2.so.3.00
-- Installing: /usr/local/lib/libmusicxml2.so
-- Installing: /usr/local/include/libmusicxml/musicxmlfactory.h
-- Installing: /usr/local/include/libmusicxml/sortvisitor.h
-- Installing: /usr/local/include/libmusicxml/xmlreader.h
... etc
Now I want to compile one of their sample files so I run g+ filename.cpp and it gives me the following error:
libmusicxml.h: No such file or directory
Does this mean it's not seeing the library in /usr/local? Can I specify this somewhere? Set a path or something?
I have made sure to have the latest version of the libmusicxml library from here and did the same (cmake followed by make).
When I go to the gives samples and try to make one (with the provided make file, which work according to the developer) it doesn't want to do it:
dorien#XP:~/bin/libmusicxml-master/samples$ make
gcc -g -O3 -Wall -Wuninitialized -I../src/elements -I../src/interface -I../src/files -I../src/lib -I../src/parser -I../src/visitors -I../src/guido -I../src/operations countnotes.cpp ../libmusicxml2.a -lstdc++ -o countnotes
gcc: error: ../libmusicxml2.a: No such file or directory
Makefile:14: recipe for target 'countnotes' failed
-> I tried to locate libmusicxml2.a and that doesn't seem to exist.
When I run xml2guido (which seems to have a compiled version in the root directory of the package), I get:
xml2guido: error while loading shared libraries: libmusicxml2.so.3.00: cannot open shared object file: No such file or directory
However, there is a libmusicxml2.so.3.00 in the same directory
Maybe it's that the package is not linked correctly? Or something about the missing .a file?
I do think it was built correctly:
make
[ 73%] Built target musicxml2
[ 75%] Built target RandomMusic
[ 78%] Built target countnotes
[ 80%] Built target partsummary
[ 82%] Built target readunrolled
[ 85%] Built target xml2guido
[ 87%] Built target xml2midi
[ 90%] Built target xmlclone
[ 92%] Built target xmlfactory
[ 95%] Built target xmliter
[ 97%] Built target xmlread
[100%] Built target xmltranspose
dorien#XP:~/bin/libmusicxml-master$ sudo make install
[ 73%] Built target musicxml2
[ 75%] Built target RandomMusic
[ 78%] Built target countnotes
[ 80%] Built target partsummary
[ 82%] Built target readunrolled
[ 85%] Built target xml2guido
[ 87%] Built target xml2midi
[ 90%] Built target xmlclone
[ 92%] Built target xmlfactory
[ 95%] Built target xmliter
[ 97%] Built target xmlread
[100%] Built target xmltranspose
Install the project...
-- Install configuration: ""
-- Up-to-date: /usr/local/lib/libmusicxml2.so.3.00
-- Up-to-date: /usr/local/lib/libmusicxml2.so
-- Up-to-date: /usr/local/include/libmusicxml/musicxmlfactory.h
-- Up-to-date: /usr/local/include/libmusicxml/sortvisitor.h
-- Up-to-date: /usr/local/include/libmusicxml/xmlreader.h
-- Up-to-date: /usr/local/include/libmusicxml/xmlfile.h
-- Up-to-date: /usr/local/include/libmusicxml/libmusicxml.h
-- Up-to-date: /usr/local/include/libmusicxml/unrolled_xml_tree_browser.h
-- Up-to-date: /usr/local/include/libmusicxml/xml.h
-- Up-to-date: /usr/local/include/libmusicxml/elements.h
-- Up-to-date: /usr/local/include/libmusicxml/factory.h
-- Up-to-date: /usr/local/include/libmusicxml/types.h
-- Up-to-date: /usr/local/include/libmusicxml/typedefs.h
-- Up-to-date: /usr/local/include/libmusicxml/xml_tree_browser.h
-- Up-to-date: /usr/local/include/libmusicxml/versions.h
-- Up-to-date: /usr/local/include/libmusicxml/exports.h
Does this mean it's not seeing the library in /usr/local?
It means that it didn't find the header libmusicxml.h. You didn't tell the compiler to look for it in /usr/local/include/libmusicxml.
Can I specify this somewhere? Set a path or something?
See the documentation of your compiler. In gcc, the option for include search paths is -I.
Instead of searching for the header libmusicxml.h from /usr/local/include/libmusicxml/, I would recommend including libmusicxml/libmusicxml.h and searching from /usr/local/include. That would be simpler since g++ searches from /usr/local/include by default, so no compiler options would be required.
The library (and headers) weren't recognised until I ran:
export LD_LIBRARY_PATH=/addressto/libmusicxml-master
That fixed it.