PointCloudLibrary / PointCloudLibrary/pcl
[cmake] pcl_options.cmake modified CMAKE_FIND_LIBRARY_SUFFIXES, resulting in failure to find dependencies
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 4.7k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 6
Description
Hi guys,
I'm vcpkg maintainer.
Recently we are updating pcl in vcpkg (https://github.com/microsoft/vcpkg/pull/18855), but met some problems:
When vtk, a dependency of pcl, finds qt, an error occurs:
CMake Error at /mnt/vcpkg-ci/installed/x64-linux/share/cmake/Qt5Gui/Qt5GuiConfig.cmake:95 (message):
Library not found: GL
Call Stack (most recent call first):
/mnt/vcpkg-ci/installed/x64-linux/share/cmake/Qt5Gui/Qt5GuiConfig.cmake:277 (_qt5_Gui_process_prl_file)
/agent/_work/1/s/scripts/buildsystems/vcpkg.cmake:792 (_find_package)
/mnt/vcpkg-ci/installed/x64-linux/share/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake:231 (find_package)
/agent/_work/1/s/scripts/buildsystems/vcpkg.cmake:792 (_find_package)
/mnt/vcpkg-ci/installed/x64-linux/share/cmake/Qt5/Qt5Config.cmake:28 (find_package)
/agent/_work/1/s/scripts/buildsystems/vcpkg.cmake:792 (_find_package)
/mnt/vcpkg-ci/installed/x64-linux/share/vtk/VTK-vtk-module-find-packages.cmake:115 (find_package)
/mnt/vcpkg-ci/installed/x64-linux/share/vtk/vtk-config.cmake:129 (include)
/agent/_work/1/s/scripts/buildsystems/vcpkg.cmake:792 (_find_package)
cmake/pcl_find_vtk.cmake:25 (find_package)
CMakeLists.txt:380 (include)
After a long period of searching, we found that pcl modified the value of CMAKE_FIND_LIBRARY_SUFFIXES in pcl_options.cmake, which caused its downstream dependencies to fail to find their dependencies through find_library.
For example, qt needs libGL.so, and CMAKE_FIND_LIBRARY_SUFFIXES is modified to .a when statically building PCL, which results in find_library expecting to find libGL.a.
See code: https://github.com/PointCloudLibrary/pcl/blob/cd99687bd1f332d77aee06a8e9fbad4fb08c0a44/cmake/pcl_options.cmake#L5-L18
So, please DO NOT do that, any modification of the cmake macro value that has not been backed up and restored will cause errors when using the downstream configuration.
Thanks,
Jack
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading cmake/pcl_options.cmake, especially lines 5-18, and reproduce the static PCL configuration followed by the VTK/Qt dependency lookup described in the report. Trace the value of CMAKE_FIND_LIBRARY_SUFFIXES through that configuration; done means downstream find_library calls can locate their dependencies without the PCL setting leaking into them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100