ivogeorg / SFND-Lidar-Obstacle-Detection

0 stars 0 forks source link

`boost::filesystem` not being linked correctly #1

Open ivogeorg opened 1 year ago

ivogeorg commented 1 year ago

The error messages from cmake .. and make on the project are as follows:

(base) orbital@yocto-sandbox:~/git-repos/SFND-Lidar-Obstacle-Detection/build$ cmake ..
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.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
-- Checking for module 'eigen3'
--   Found eigen3, version 3.3.7
-- Found Eigen: /usr/include/eigen3 (Required is at least version "3.3") 
-- Eigen found (include: /usr/include/eigen3, version: 3.3.7)
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.65.0") found components: system filesystem iostreams serialization 
-- Checking for module 'flann'
--   Found flann, version 1.9.1
-- Found FLANN: /usr/lib/x86_64-linux-gnu/libflann_cpp.so  
-- FLANN found (include: /usr/include, lib: /usr/lib/x86_64-linux-gnu/libflann_cpp.so)
-- The imported target "vtkParseOGLExt" references the file
   "/usr/bin/vtkParseOGLExt-7.1"
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-7.1/VTKTargets.cmake"
but not all the files it references.

-- The imported target "vtkRenderingPythonTkWidgets" references the file
   "/usr/lib/x86_64-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-7.1/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-7.1/VTKTargets.cmake"
but not all the files it references.

-- The imported target "pvtk" references the file
   "/usr/bin/pvtk"
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-7.1/VTKTargets.cmake"
but not all the files it references.

-- Could NOT find Pcap (missing: PCAP_LIBRARIES PCAP_INCLUDE_DIRS) 
** WARNING ** io features related to pcap will be disabled
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.6.37") 
-- Checking for module 'libusb-1.0'
--   Found libusb-1.0, version 1.0.23
-- Found libusb: /usr/lib/x86_64-linux-gnu/libusb-1.0.so  
-- Eigen found (include: /usr/include/eigen3, version: 3.3.7)
-- Found Qhull: /usr/lib/x86_64-linux-gnu/libqhull_r.so  
-- QHULL found (include: /usr/include, lib: /usr/lib/x86_64-linux-gnu/libqhull_r.so)
-- looking for PCL_COMMON
-- Found PCL_COMMON: /usr/local/lib/libpcl_common.so  
-- looking for PCL_KDTREE
-- Found PCL_KDTREE: /usr/local/lib/libpcl_kdtree.so  
-- looking for PCL_OCTREE
-- Found PCL_OCTREE: /usr/local/lib/libpcl_octree.so  
-- looking for PCL_SEARCH
-- Found PCL_SEARCH: /usr/local/lib/libpcl_search.so  
-- looking for PCL_SAMPLE_CONSENSUS
-- Found PCL_SAMPLE_CONSENSUS: /usr/local/lib/libpcl_sample_consensus.so  
-- looking for PCL_FILTERS
-- Found PCL_FILTERS: /usr/local/lib/libpcl_filters.so  
-- looking for PCL_2D
-- Found PCL_2D: /usr/local/include/pcl-1.13  
-- looking for PCL_GEOMETRY
-- Found PCL_GEOMETRY: /usr/local/include/pcl-1.13  
-- looking for PCL_IO
-- Found PCL_IO: /usr/local/lib/libpcl_io.so  
-- looking for PCL_FEATURES
-- Found PCL_FEATURES: /usr/local/lib/libpcl_features.so  
-- looking for PCL_ML
-- Found PCL_ML: /usr/local/lib/libpcl_ml.so  
-- looking for PCL_SEGMENTATION
-- Found PCL_SEGMENTATION: /usr/local/lib/libpcl_segmentation.so  
-- looking for PCL_VISUALIZATION
-- Found PCL_VISUALIZATION: /usr/local/lib/libpcl_visualization.so  
-- looking for PCL_SURFACE
-- Found PCL_SURFACE: /usr/local/lib/libpcl_surface.so  
-- looking for PCL_REGISTRATION
-- Found PCL_REGISTRATION: /usr/local/lib/libpcl_registration.so  
-- looking for PCL_KEYPOINTS
-- Found PCL_KEYPOINTS: /usr/local/lib/libpcl_keypoints.so  
-- looking for PCL_TRACKING
-- Found PCL_TRACKING: /usr/local/lib/libpcl_tracking.so  
-- looking for PCL_RECOGNITION
-- Found PCL_RECOGNITION: /usr/local/lib/libpcl_recognition.so  
-- looking for PCL_STEREO
-- Found PCL_STEREO: /usr/local/lib/libpcl_stereo.so  
-- looking for PCL_OUTOFCORE
-- Found PCL_OUTOFCORE: /usr/local/lib/libpcl_outofcore.so  
-- looking for PCL_PEOPLE
-- Found PCL_PEOPLE: /usr/local/lib/libpcl_people.so  
-- Found PCL: pcl_common;pcl_kdtree;pcl_octree;pcl_search;pcl_sample_consensus;pcl_filters;pcl_io;pcl_features;pcl_ml;pcl_segmentation;pcl_visualization;pcl_surface;pcl_registration;pcl_keypoints;pcl_tracking;pcl_recognition;pcl_stereo;pcl_outofcore;pcl_people;Boost::system;Boost::filesystem;Boost::iostreams;Boost::serialization;vtkChartsCore;vtkCommonColor;vtkCommonCore;vtksys;vtkCommonDataModel;vtkCommonMath;vtkCommonMisc;vtkCommonSystem;vtkCommonTransforms;vtkCommonExecutionModel;vtkFiltersGeneral;vtkCommonComputationalGeometry;vtkFiltersCore;vtkInfovisCore;vtkFiltersExtraction;vtkFiltersStatistics;vtkImagingFourier;vtkImagingCore;vtkalglib;vtkRenderingContext2D;vtkRenderingCore;vtkFiltersGeometry;vtkFiltersSources;vtkRenderingFreeType;/usr/lib/x86_64-linux-gnu/libfreetype.so;/usr/lib/x86_64-linux-gnu/libz.so;vtkFiltersModeling;vtkImagingSources;vtkInteractionImage;vtkImagingColor;vtkInteractionStyle;vtkInteractionWidgets;vtkFiltersHybrid;vtkImagingGeneral;vtkImagingHybrid;vtkIOImage;vtkDICOMParser;vtkmetaio;/usr/lib/x86_64-linux-gnu/libjpeg.so;/usr/lib/x86_64-linux-gnu/libpng.so;/usr/lib/x86_64-linux-gnu/libtiff.so;vtkRenderingAnnotation;vtkRenderingVolume;vtkIOXML;vtkIOCore;vtkIOXMLParser;/usr/lib/x86_64-linux-gnu/libexpat.so;vtkIOGeometry;vtkIOLegacy;vtkIOPLY;vtkRenderingLOD;vtkViewsCore;vtkViewsContext2D;vtkRenderingOpenGL2;vtkRenderingContextOpenGL2;FLANN::FLANN;QHULL::QHULL (Required is at least version "1.13") 
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: system filesystem iostreams serialization 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/build
(base) orbital@yocto-sandbox:~/git-repos/SFND-Lidar-Obstacle-Detection/build$ make
Scanning dependencies of target environment
[ 25%] Building CXX object CMakeFiles/environment.dir/src/environment.cpp.o
In file included from /home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/environment.cpp:7:
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.h:47:24: error: ‘filesystem’ is not a member of ‘boost’
   47 |     std::vector<boost::filesystem::path> streamPcd(std::string dataPath);
      |                        ^~~~~~~~~~
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.h:47:24: error: ‘filesystem’ is not a member of ‘boost’
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.h:47:40: error: template argument 1 is invalid
   47 |     std::vector<boost::filesystem::path> streamPcd(std::string dataPath);
      |                                        ^
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.h:47:40: error: template argument 2 is invalid
In file included from /home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/environment.cpp:9:
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.cpp:132:20: error: ‘filesystem’ is not a member of ‘boost’
  132 | std::vector<boost::filesystem::path> ProcessPointClouds<PointT>::streamPcd(std::string dataPath)
      |                    ^~~~~~~~~~
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.cpp:132:20: error: ‘filesystem’ is not a member of ‘boost’
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.cpp:132:36: error: template argument 1 is invalid
  132 | std::vector<boost::filesystem::path> ProcessPointClouds<PointT>::streamPcd(std::string dataPath)
      |                                    ^
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.cpp:132:36: error: template argument 2 is invalid
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.cpp: In member function ‘int ProcessPointClouds<PointT>::streamPcd(std::string)’:
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.cpp:135:24: error: ‘filesystem’ is not a member of ‘boost’
  135 |     std::vector<boost::filesystem::path> paths(boost::filesystem::directory_iterator{dataPath}, boost::filesystem::directory_iterator{});
      |                        ^~~~~~~~~~
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.cpp:135:24: error: ‘filesystem’ is not a member of ‘boost’
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.cpp:135:40: error: template argument 1 is invalid
  135 |     std::vector<boost::filesystem::path> paths(boost::filesystem::directory_iterator{dataPath}, boost::filesystem::directory_iterator{});
      |                                        ^
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.cpp:135:40: error: template argument 2 is invalid
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.cpp:135:55: error: ‘boost::filesystem’ has not been declared
  135 |     std::vector<boost::filesystem::path> paths(boost::filesystem::directory_iterator{dataPath}, boost::filesystem::directory_iterator{});
      |                                                       ^~~~~~~~~~
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.cpp:135:104: error: ‘boost::filesystem’ has not been declared
  135 |     std::vector<boost::filesystem::path> paths(boost::filesystem::directory_iterator{dataPath}, boost::filesystem::directory_iterator{});
      |                                                                                                        ^~~~~~~~~~
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.cpp:135:136: error: expression list treated as compound expression in initializer [-fpermissive]
  135 |     std::vector<boost::filesystem::path> paths(boost::filesystem::directory_iterator{dataPath}, boost::filesystem::directory_iterator{});
      |                                                                                                                                        ^
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.cpp:138:16: error: request for member ‘begin’ in ‘paths’, which is of non-class type ‘int’
  138 |     sort(paths.begin(), paths.end());
      |                ^~~~~
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.cpp:138:31: error: request for member ‘end’ in ‘paths’, which is of non-class type ‘int’
  138 |     sort(paths.begin(), paths.end());
      |                               ^~~
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.cpp:138:5: error: there are no arguments to ‘sort’ that depend on a template parameter, so a declaration of ‘sort’ must be available [-fpermissive]
  138 |     sort(paths.begin(), paths.end());
      |     ^~~~
/home/orbital/git-repos/SFND-Lidar-Obstacle-Detection/src/processPointClouds.cpp:138:5: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
make[2]: *** [CMakeFiles/environment.dir/build.make:63: CMakeFiles/environment.dir/src/environment.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/environment.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
(base) orbital@yocto-sandbox:~/git-repos/SFND-Lidar-Obstacle-Detection/build$ cd ../
(base) orbital@yocto-sandbox:~/git-repos/SFND-Lidar-Obstacle-Detection$ rm -fr build
(base) orbital@yocto-sandbox:~/git-repos/SFND-Lidar-Obstacle-Detection$ sudo apt-get install libboost-all-dev=1.74.0
[sudo] password for orbital: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Version '1.74.0' for 'libboost-all-dev' was not found
(base) orbital@yocto-sandbox:~/git-repos/SFND-Lidar-Obstacle-Detection$ 

The contents of the CMakeLists.txt file are as follows:

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

add_definitions(-std=c++14)

set(CXX_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}")

project(playback)

find_package(PCL 1.13 REQUIRED)

include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
list(REMOVE_ITEM PCL_LIBRARIES "vtkproj4")

add_executable (environment src/environment.cpp src/render/render.cpp src/processPointClouds.cpp)
# target_link_libraries (environment ${PCL_LIBRARIES})
find_package(Boost REQUIRED COMPONENTS system filesystem iostreams serialization)
target_link_libraries(environment ${PCL_LIBRARIES} ${Boost_LIBRARIES})
ivogeorg commented 1 year ago

A thing to try is to check what Makefile cmake creates and see if the proper linking is there. Experiment with the Makefile first to get the right linkage and only then experiment with CMakeLists.txt to achieve the right linkage in the generated Makefile.

This is a good issue to learn about the CMake build infrastructure.