MantisBT - CMake
View Issue Details
0011260CMakeCMakepublic2010-09-22 23:142016-06-10 14:31
Nathan Phillip Brink (binki) 
Bill Hoffman 
normalfeaturealways
closedmoved 
CMake-2-8 
 
0011260: Add GLOBAL FIND_LIBRARY_USE_LIB32_PATHS property, whose behavior is like FIND_LIBRARY_USE_LIB64_PATHS
CMake has a global property called FIND_LIBRARY_USE_LIB64_PATHS which automatically adds "lib64" to various search-paths when a 64-bit build is detected. This property affects the search paths for at least:
FIND_LIBRARY()
FIND_PACKAGE(<MODULE_NAME> NO_MODULE)

Merely having a FIND_LIBRARY_USE_LIB64_PATHS property and thus support for /usr/lib64 and /lib64 ignores the push for multilib support which in enough cases uses the /lib32 and /usr/lib32 directories for 32-bit libraries.
ohnobinki@ohnopublishing ~/cmake_find_package_no_module/build $ cat ../CMakeLists.txt
FIND_PACKAGE(Automoc4 NO_MODULE)
ohnobinki@ohnopublishing ~/cmake_find_package_no_module/build $ cmake -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 -Wno-dev .. @ohnopublishing - Wednesday 22 September - 23:00
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - 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
CMake Warning at CMakeLists.txt:1 (FIND_PACKAGE):
  Could not find a configuration file for package Automoc4.

  Set Automoc4_DIR to the directory containing a CMake configuration file for
  Automoc4. The file will have one of the following names:

    Automoc4Config.cmake
    automoc4-config.cmake



-- Configuring done
-- Generating done
-- Build files have been written to: /home/ohnobinki/cmake_find_package_no_module/build


# Yet I have the necessary automoc config stuff:
ohnobinki@ohnopublishing ~/cmake_find_package_no_module/build $ qlist -e automoc
/usr/bin/automoc4
/usr/lib/debug/usr/bin/automoc4.debug
/usr/lib32/automoc4/automoc4.files.in
/usr/lib32/automoc4/Automoc4Config.cmake
/usr/lib32/automoc4/Automoc4Version.cmake
/usr/lib64/automoc4/automoc4.files.in
/usr/lib64/automoc4/Automoc4Config.cmake
/usr/lib64/automoc4/Automoc4Version.cmake

# and a 64-bit running of CMake finds this stuff fine:
ohnobinki@ohnopublishing ~/cmake_find_package_no_module/build $ rm CMakeCache.txt
ohnobinki@ohnopublishing ~/cmake_find_package_no_module/build $ cmake -DCMAKE_C_FLAGS=-m64 -DCMAKE_CXX_FLAGS=-m64 -Wno-dev ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - 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
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ohnobinki/cmake_find_package_no_module/build
ohnobinki@ohnopublishing ~/cmake_find_package_no_module/build $ grep -e AUTOMOC CMakeCache.txt
AUTOMOC4_EXECUTABLE:FILEPATH=/usr/bin/automoc4
//ADVANCED property for variable: AUTOMOC4_EXECUTABLE
AUTOMOC4_EXECUTABLE-ADVANCED:INTERNAL=1




#
# With my patch and 32-bit stuff:
#
ohnobinki@ohnopublishing ~/cmake_find_package_no_module/build $ rm CMakeCache.txt
ohnobinki@ohnopublishing ~/cmake_find_package_no_module/build $ ~/cmake/build/bin/cmake -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 -Wno-dev ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - 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
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ohnobinki/cmake_find_package_no_module/build

#
# I have tested my patch by making sure that the original error messages are
# still present if someone decides to set the FIND_LIBRARY_USE_LIB32_PATHS
# property to FALSE.
#
No tags attached.
related to 0015994closed Kitware Robot CMake support for the Linux x86-64 32-bit ABI (x32-abi) 
patch cmake-FIND_LIBRARY_USE_LIB32_PATHS-property-multilib.patch (6,814) 2010-09-22 23:14
https://public.kitware.com/Bug/file/3408/cmake-FIND_LIBRARY_USE_LIB32_PATHS-property-multilib.patch
patch cmake-FIND_LIBRARY_USE_LIB32_PATHS-property-multilib-r1.patch (7,242) 2010-10-17 22:30
https://public.kitware.com/Bug/file/3454/cmake-FIND_LIBRARY_USE_LIB32_PATHS-property-multilib-r1.patch
Issue History
2010-09-22 23:14Nathan Phillip Brink (binki)New Issue
2010-09-22 23:14Nathan Phillip Brink (binki)File Added: cmake-FIND_LIBRARY_USE_LIB32_PATHS-property-multilib.patch
2010-10-17 22:30Nathan Phillip Brink (binki)File Added: cmake-FIND_LIBRARY_USE_LIB32_PATHS-property-multilib-r1.patch
2010-10-17 22:32Nathan Phillip Brink (binki)Note Added: 0022512
2011-01-17 16:59David ColeAssigned To => Bill Hoffman
2011-01-17 16:59David ColeStatusnew => assigned
2014-06-04 18:37Daniel ScharrerNote Added: 0036121
2015-07-13 10:33starseekerNote Added: 0039133
2016-04-05 10:08Brad KingRelationship addedhas duplicate 0015994
2016-04-05 12:55Brad KingRelationship replacedrelated to 0015994
2016-06-10 14:28Kitware RobotNote Added: 0041747
2016-06-10 14:28Kitware RobotStatusassigned => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0022512)
Nathan Phillip Brink (binki)   
2010-10-17 22:32   
cmake-FIND_LIBRARY_USE_LIB32_PATHS-property-multilib-r1.patch: This version actually sets the harmless FIND_LIBRARY_USE_LIB32_PATHS option to be enabled by default. Otherwise, it should be the exact same as the previously posted patch.
(0036121)
Daniel Scharrer   
2014-06-04 18:37   
Is there any progress being made on merging this patch or an alternate solution. It sucks having to work around this CMake deficiency in every project that needs 32-bit libs.
(0039133)
starseeker   
2015-07-13 10:33   
Just wanted to note that this is still an issue for switching between hunting for 32 and 64 bit libraries - are there any plans to fix it?
(0041747)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.