You are not logged in.

#1 2017-04-30 21:34:49

bartus
Member
Registered: 2013-05-13
Posts: 50

CMake package lib vs lib64 precendence.

When building packages with CMake I notice that lib64 get precedence over lib, which is a strange mishap but rarely leads to any problems.
Lately cgal update renders one of my PKGBUILD unusable because of this "precedence" behaviour.

What should be proper solution to skip lib64 when cmake looks for packages ?

> problematic PKGBUILD cloudcompare-git
> fragment of CGALConfig.cmake that introduce error because of hard codded path /usr/lib/CGAL mismatch the reference path /usr/lib64/CGAL

  9 set(CGAL_CONFIG_LOADED TRUE)
 10
 11 get_filename_component(CGAL_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
 12
 13 set(CGAL_HEADER_ONLY "OFF" )
 14
 15 # CGAL_DIR is the directory where this CGALConfig.cmake is installed
 16 string(REPLACE "/usr/lib/CGAL" "" CGAL_INSTALL_PREFIX "${CGAL_CONFIG_DIR}")
 17
 18  if(NOT EXISTS "${CGAL_INSTALL_PREFIX}//usr/lib/CGAL/CGALConfig.cmake")
 19     # Cannot compute CGAL_INSTALL_PREFIX!
 20     # Use the CMake prefix chosen at compile time.
 21     set(CGAL_INSTALL_PREFIX "/usr")
 22  endif()

Offline

#2 2017-04-30 23:21:40

bartus
Member
Registered: 2013-05-13
Posts: 50

Re: CMake package lib vs lib64 precendence.

I poke the problem bit harder and arrive at /usr/share/cmake-3.7/Modules/Platform/UnixPaths.cmake
Last lines says:

87 set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS TRUE)
88 set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)

Which means that cmake by default drops /usr/lib and go straight for /usr/lib32 or /usr/lib64 depending on library bit-depth. Commenting out last line fixes my problem.
Found this issue mentioned on CMake bug tracker here. Suggestion was to add Arch exclusion rule setting FIND_LIBRARY_USE_LIB64_PATHS FALSE.

Last edited by bartus (2017-05-01 00:28:27)

Offline

Board footer

Powered by FluxBB