MantisBT - CMake
View Issue Details
0014457CMakeCMakepublic2013-10-03 03:182016-06-10 14:31
Zachary Deretsky 
Kitware Robot 
highmajoralways
closedmoved 
LinuxUbuntu12.04
CMake 2.8.11 
 
0014457: CMAKE_CXX_LIBRARY_ARCHITECTURE variable is not getting populated
The simple test case was created after many iterations by Stephen Kelly:

This CMakeLists.txt
zach@cloud1-12:~/QT/build$ cat ../CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
set(CMAKE_C_COMPILER $ENV{AZ_TOOL_PATH}/bin/gcc)
project(qtgui)
find_library(TEST_Qt5Gui_GL_LIBRARY GL)
message("TEST_Qt5Gui_GL_LIBRARY : ${TEST_Qt5Gui_GL_LIBRARY}")
message("CMAKE_CXX_LIBRARY_ARCHITECTURE ${CMAKE_CXX_LIBRARY_ARCHITECTURE}")

produces this result:
zach@cloud1-12:~/QT/build$ cmake ..
-- The C compiler identification is GNU 4.6.3
-- The CXX compiler identification is GNU 4.6.3
-- Check for working C compiler: /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/bin/gcc
-- Check for working C compiler: /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/bin/c++
-- Check for working CXX compiler: /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
TEST_Qt5Gui_GL_LIBRARY : TEST_Qt5Gui_GL_LIBRARY-NOTFOUND
CMAKE_CXX_LIBRARY_ARCHITECTURE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zach/QT/build

If I set CMAKE_CXX_LIBRARY_ARCHITECTURE in this CMakeLists.txt

cmake_minimum_required(VERSION 2.8)
set(CMAKE_C_COMPILER $ENV{AZ_TOOL_PATH}/bin/gcc)
set(CMAKE_CXX_LIBRARY_ARCHITECTURE x86_64-linux-gnu)
project(qtgui)
find_library(TEST_Qt5Gui_GL_LIBRARY GL)
message("TEST_Qt5Gui_GL_LIBRARY : ${TEST_Qt5Gui_GL_LIBRARY}")
message("CMAKE_CXX_LIBRARY_ARCHITECTURE ${CMAKE_CXX_LIBRARY_ARCHITECTURE}")

I obtain:

zach@cloud1-12:~/QT/build$ cmake ..
-- The C compiler identification is GNU 4.6.3
-- The CXX compiler identification is GNU 4.6.3
-- Check for working C compiler: /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/bin/gcc
-- Check for working C compiler: /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/bin/c++
-- Check for working CXX compiler: /AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
TEST_Qt5Gui_GL_LIBRARY : /usr/lib/x86_64-linux-gnu/libGL.so
CMAKE_CXX_LIBRARY_ARCHITECTURE x86_64-linux-gnu
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zach/QT/build


No tags attached.
Issue History
2013-10-03 03:18Zachary DeretskyNew Issue
2013-10-03 03:33Zachary DeretskyNote Added: 0033968
2013-10-03 08:08Brad KingNote Added: 0033970
2016-06-10 14:29Kitware RobotNote Added: 0042383
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0033968)
Zachary Deretsky   
2013-10-03 03:33   
Is the problem that I need to set
CMAKE_CXX_LIBRARY_ARCHITECTURE to x86_64-linux-gnu
because
zach@cloud1-12:~/QT/build$ ls -l /usr/lib/x86_64-linux-gnu/libGL.so
lrwxrwxrwx 1 root root 13 Jun 18 13:54 /usr/lib/x86_64-linux-gnu/libGL.so -> mesa/libGL.so

but

/AZ/x86_64/kernel-3.2.0-25-virtual/glibc-2.15/2013-09-19-12.16.39/bin/c++ -dumpmachine
x86_64-unknown-linux-gnu


x86_64-linux-gnu versus x86_64-unknown-linux-gnu ???
(0033970)
Brad King   
2013-10-03 08:08   
The code that populates the library architecture is here:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CMakeDetermineCompilerABI.cmake;hb=v2.8.11.2#l117 [^]
 # Detect library architecture directory name.

Look at CMakeFiles/<cmake-version>/CMakeCXXCompiler.cmake for the value determined for CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES. CMake tries matching paths containing the arch triplet from that list of directories. If your toolchain is not configured to search /usr/lib/x86_64-linux-gnu implicitly then CMake won't pick it up automatically either.
(0042383)
Kitware Robot   
2016-06-10 14:29   
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.