Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cmake] pcl_options.cmake modified CMAKE_FIND_LIBRARY_SUFFIXES, resulting in failure to find dependencies #4997

Open
JackBoosY opened this issue Oct 26, 2021 · 1 comment
Labels
kind: bug Type of issue status: triage Labels incomplete

Comments

@JackBoosY
Copy link
Contributor

JackBoosY commented Oct 26, 2021

Hi guys,
I'm vcpkg maintainer.
Recently we are updating pcl in vcpkg (microsoft/vcpkg#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:

if(PCL_SHARED_LIBS)
set(PCL_LIB_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX})
set(PCL_LIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
set(PCL_LIB_TYPE "SHARED")
# set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX})
if(WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_IMPORT_LIBRARY_SUFFIX})
endif()
else()
set(PCL_LIB_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX})
set(PCL_LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
set(PCL_LIB_TYPE "STATIC")
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()

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

@JackBoosY JackBoosY added kind: bug Type of issue status: triage Labels incomplete labels Oct 26, 2021
@JackBoosY
Copy link
Contributor Author

Maybe related PR: #4390

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Type of issue status: triage Labels incomplete
Projects
None yet
Development

No branches or pull requests

1 participant