PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
9.88k stars 4.61k forks source link

I got an error when I installed PCL and tried to run the program #6124

Closed BoBoINVICTUS closed 3 weeks ago

BoBoINVICTUS commented 3 weeks ago

When I run the example program, I get an error:PCL can not be found on this machine,as shown here: image My CMakeLists.txt file has the following contents: image I tried to set PCL_ROOT and PCL_DIR, but it didn't work. My system is Windows 11 cmake version is 3.24.2 PCL version is 1.14.1 I also set the system environment variables: image

Can you tell me what the problem is?

larshg commented 3 weeks ago

Try add message(FATAL_ERROR "PCL_ROOT is ${PCL_ROOT} and ENV PCL_ROOT is $ENV{PCL_ROOT}") right before the find_package.

Also see if ...\PCL1.14.1\include\pcl-1.14\pcl\pcl_config.h is present?

larshg commented 3 weeks ago

Do have PCL_ROOT as a system variable (the installer seems to set it) - what is it set to?

BoBoINVICTUS commented 3 weeks ago

Do have PCL_ROOT as a system variable (the installer seems to set it) - what is it set to? image image image image

BoBoINVICTUS commented 3 weeks ago

Do have PCL_ROOT as a system variable (the installer seems to set it) - what is it set to? When I use the code "set(PCL_ROOT "D:/PCL1.14.1")", the output is as follows: image image The previous error will still occur.

larshg commented 3 weeks ago

Try add: message(" Looking for ${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h") to D:\PCL1.14.1\cmake\PCLConfig.cmake below line 433 - ie just before it looks for the pcl_config.h file.

Seems it doesn't support having it installed on D or there are something about the paths and perhaps character settings, that makes cmake unable to verify that the file does exists.

BoBoINVICTUS commented 3 weeks ago

Try add: message(" Looking for ${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h") to D:\PCL1.14.1\cmake\PCLConfig.cmake below line 433 - ie just before it looks for the pcl_config.h file.

Seems it doesn't support having it installed on D or there are something about the paths and perhaps character settings, that makes cmake unable to verify that the file does exists.

image

larshg commented 3 weeks ago

Do you supply any arguments to the cmake call - it seems that PCL_ROOT is only set to D:\.

BoBoINVICTUS commented 3 weeks ago

Do you supply any arguments to the cmake call - it seems that PCL_ROOT is only set to D:\. I use VSCode to write the program, how do I write the command line, add arguments? image

larshg commented 3 weeks ago

Can you show the full output from vscode in text?

BoBoINVICTUS commented 3 weeks ago

Can you show the full output from vscode in text? image [main] Configuring project: 点云配准_代码初稿1.0 [proc] Executing command: D:\cmake-3.24.2-windows-x86_64\bin\cmake.EXE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=D:\MinGw\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=D:\MinGw\bin\g++.exe --no-warn-unused-cli "-SD:/learning/Robotic-learning/机械臂控制书籍/点云配准从入门到精通/点云配准_代码初稿1.0/3.2 ISS关键点提取" -Bd:/learning/Robotic-learning/机械臂控制书籍/点云配准从入门到精通/点云配准_代码初稿1.0/build -G "MinGW Makefiles" [cmake] Not searching for unused variables given on the command line. [cmake] Looking for D://include/pcl-1.14/pcl/pcl_config.h [cmake] CMake Error at D:/PCL1.14.1/cmake/PCLConfig.cmake:59 (message): [cmake] PCL can not be found on this machine [cmake] Call Stack (most recent call first): [cmake] D:/PCL1.14.1/cmake/PCLConfig.cmake:453 (pcl_report_not_found) [cmake] CMakeLists.txt:10 (find_package) [cmake] [cmake] [cmake] -- Configuring incomplete, errors occurred! [cmake] See also "D:/learning/Robotic-learning/机械臂控制书籍/点云配准从入门到精通/点云配准_代码初稿1.0/build/CMakeFiles/CMakeOutput.log". [cmake] See also "D:/learning/Robotic-learning/机械臂控制书籍/点云配准从入门到精通/点云配准_代码初稿1.0/build/CMakeFiles/CMakeError.log". [proc] The command: D:\cmake-3.24.2-windows-x86_64\bin\cmake.EXE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=D:\MinGw\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=D:\MinGw\bin\g++.exe --no-warn-unused-cli "-SD:/learning/Robotic-learning/机械臂控制书籍/点云配准从入门到精通/点云配准_代码初稿1.0/3.2 ISS关键点提取" -Bd:/learning/Robotic-learning/机械臂控制书籍/点云配准从入门到精通/点云配准_代码初稿1.0/build -G "MinGW Makefiles" exited with code: 1

image (base) PS D:\learning\Robotic-learning\机械臂控制书籍\点云配准从入门到精通\点云配准_代码初稿1.0\3.2 ISS关键点提取> cmake -D PCL_ROOT=D:/PCL1.14.1 . -- Building for: NMake Makefiles CMake Error at CMakeLists.txt:3 (project): Running

'nmake' '-?'

failed with:

系统找不到指定的文件。

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage -- Configuring incomplete, errors occurred! See also "D:/learning/Robotic-learning/机械臂控制书籍/点云配准从入门到精通/点云配准_代码初稿1.0/3.2 ISS关键点提取/CMakeFiles/CMakeOutput.log

larshg commented 3 weeks ago

Mine looks like this: Executing command: "C:\Program Files\CMake\bin\cmake.EXE" -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE --no-warn-unused-cli -SC:/dev/iss_keypoints_extract -Bc:/dev/iss_keypoints_extract/build -G "Visual Studio 17 2022" -T host=x64 -A x64 And I just tried with VSCode and it works as well. I don't have MinGW, so that might be the reason.

BoBoINVICTUS commented 3 weeks ago

Mine looks like this: Executing command: "C:\Program Files\CMake\bin\cmake.EXE" -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE --no-warn-unused-cli -SC:/dev/iss_keypoints_extract -Bc:/dev/iss_keypoints_extract/build -G "Visual Studio 17 2022" -T host=x64 -A x64 And I just tried with VSCode and it works as well. I don't have MinGW, so that might be the reason. I don't have Visual Studio installed on my computer. Is that why I can't compile?

larshg commented 3 weeks ago

No, its not. You should be able to do it with MinGW/GCC as well. I'm just not familiar with it or if it has any relevance. Somehow your PCL_ROOT gets changed or not set - can you try run, when you set it in your CmakeLists?

BoBoINVICTUS commented 3 weeks ago

No, its not. You should be able to do it with MinGW/GCC as well. I'm just not familiar with it or if it has any relevance. Somehow your PCL_ROOT gets changed or not set - can you try run, when you set it in your CmakeLists? image image I set the PCL_ROOT in CMakeLists.txt, but it doesn't work.

BoBoINVICTUS commented 3 weeks ago

No, its not. You should be able to do it with MinGW/GCC as well. I'm just not familiar with it or if it has any relevance. Somehow your PCL_ROOT gets changed or not set - can you try run, when you set it in your CmakeLists?

Maybe my PCL download is wrong? Instead of downloading "PCL-1.14.1-AllInOne-msvc2022-win64.exe", I should have installed it from source?

larshg commented 3 weeks ago

Do you use image ?

Also try open Cmake Cache editor and look if there is a PCL_ROOT variable? image

BoBoINVICTUS commented 3 weeks ago

Do you use image ?

Also try open Cmake Cache editor and look if there is a PCL_ROOT variable? image I used delete cache and reconfigure, but the result is the same as before image

There is no PCL_ROOT variable in CmakeCache.txt, but there is a PCL_DIR variable. image

larshg commented 3 weeks ago

I think its this code that fails in the PCLConfig.cmake:

if(WIN32 AND NOT MINGW)
# PCLConfig.cmake is installed to PCL_ROOT/cmake
  get_filename_component(PCL_ROOT "${PCL_DIR}" PATH)
  if(EXISTS "${PCL_ROOT}/3rdParty")
    set(PCL_ALL_IN_ONE_INSTALLER ON)
  endif()
else()
# PCLConfig.cmake is installed to PCL_ROOT/share/pcl-x.y
  get_filename_component(PCL_ROOT "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
endif()

Try remove the AND NOT MINGW

BoBoINVICTUS commented 3 weeks ago

I think its this code that fails in the PCLConfig.cmake:

if(WIN32 AND NOT MINGW)
# PCLConfig.cmake is installed to PCL_ROOT/cmake
  get_filename_component(PCL_ROOT "${PCL_DIR}" PATH)
  if(EXISTS "${PCL_ROOT}/3rdParty")
    set(PCL_ALL_IN_ONE_INSTALLER ON)
  endif()
else()
# PCLConfig.cmake is installed to PCL_ROOT/share/pcl-x.y
  get_filename_component(PCL_ROOT "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
endif()

Try remove the AND NOT MINGW

When I remove the AND NOT MINGW, I get a new error: image I followed the same approach,remove the AND NOT MINGW in PCLConfig.cmake:

if(WIN32 AND NOT MINGW AND NOT "${BOOST_DEFINITIONS}" MATCHES "BOOST_ALL_NO_LIB")

if(WIN32 AND NOT "${BOOST_DEFINITIONS}" MATCHES "BOOST_ALL_NO_LIB") string(APPEND BOOST_DEFINITIONS -DBOOST_ALL_NO_LIB) endif()

That mistake still hasn't gone away.

larshg commented 3 weeks ago

Try add set(Boost_DEBUG ON) in your cmake and clear cache and rerun. Odd that it doesn't find the libraries, when it does find the boostConfig.

BoBoINVICTUS commented 3 weeks ago

Try add set(Boost_DEBUG ON) in your cmake and clear cache and rerun. Odd that it doesn't find the libraries, when it does find the boostConfig.

It's the same error, I look at the relevant path, it seems to find it, but it's still an error, I don't understand image

larshg commented 3 weeks ago

Can you post the cmake output?

larshg commented 3 weeks ago

Which MinGW do you use - then I can try to replicate.

BoBoINVICTUS commented 3 weeks ago

Which MinGW do you use - then I can try to replicate.

The cmake output is as follows: CMake Warning (dev) at CMakeLists.txt:3 (find_package): Policy CMP0074 is not set: find_package uses _ROOT variables. Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Environment variable PCL_ROOT is set to:

D:\PCL1.14.1\

For compatibility, CMake is ignoring the variable. This warning is for project developers. Use -Wno-dev to suppress it.

Looking for D:/PCL1.14.1/include/pcl-1.14/pcl/pcl_config.h Could NOT find Boost: missing: system iostreams filesystem serialization (found D:/PCL1.14.1/3rdParty/Boost/lib/cmake/Boost-1.84.0/BoostConfig.cmake (found suitable version "1.84.0", minimum required is "1.65.0")) CMake Error at D:/PCL1.14.1/cmake/PCLConfig.cmake:59 (message): common is required but boost was not found Call Stack (most recent call first): D:/PCL1.14.1/cmake/PCLConfig.cmake:371 (pcl_report_not_found) D:/PCL1.14.1/cmake/PCLConfig.cmake:563 (find_external_library) CMakeLists.txt:3 (find_package)

MinGW version is: gcc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)

larshg commented 3 weeks ago

Ahh The all-in-one installer is build using Visual studio, but you try to use MinGW, which is not supporting the usage of Visual studio build libraries. image

You would need to build all dependencies from source, to make it work properly. Or use Visual studio community edition instead.

You could try to use VCPKG with MinGW - there all dependencies will be build using your local compiler.

larshg commented 3 weeks ago

image

larshg commented 3 weeks ago

Closing as it is not a bug in PCL per se - but a compiler / mixing of tools issue.

larshg commented 3 weeks ago

Feel free to add comments though 😄

BoBoINVICTUS commented 3 weeks ago

Ahh The all-in-one installer is build using Visual studio, but you try to use MinGW, which is not supporting the usage of Visual studio build libraries. image

You would need to build all dependencies from source, to make it work properly. Or use Visual studio community edition instead.

You could try to use VCPKG with MinGW - there all dependencies will be build using your local compiler.

If I want to install PCL from source, are there any installation instructions?

larshg commented 3 weeks ago

https://pcl.readthedocs.io/projects/tutorials/en/latest/compiling_pcl_dependencies_windows.html#compiling-pcl-dependencies-windows but its quite old. I would go with vcpkg first: https://pcl.readthedocs.io/projects/tutorials/en/latest/pcl_vcpkg_windows.html#pcl-vcpkg-windows