Skip to content

3.20.0 regression: CMAKE_LIBRARY_ARCHITECTURE reports x86_64-unknown-linux-gnu on non-Debian x86_64 Linux

  • Expected: CMAKE_LIBRARY_ARCHITECTURE is empty in non-Debian derivative distributions

  • Actual: CMAKE_LIBRARY_ARCHITECTURE reports x86_64-unknown-linux-gnu

  • Impact: Some projects don't use CMAKE_INSTALL_LIBDIR but uses lib/${CMAKE_LIBRARY_ARCHITECTURE} to decide where to install libraries, thus broken behaviours with CMake 3.20.0

  • Preliminary Analysis: I've run git bisect with this script:

#!/bin/sh

cd ~/src/cmake/build
ninja cmake || exit

export CMAKE_GENERATOR=Ninja

rm -rf /tmp/xtest
mkdir -p /tmp/xtest
cd /tmp/xtest

cat <<'EOF' >CMakeLists.txt
project(xtest)
if (CMAKE_LIBRARY_ARCHITECTURE)
message(FATAL_ERROR "CMAKE_LIBRARY_ARCHITECTURE: ${CMAKE_LIBRARY_ARCHITECTURE}")
endif()
EOF

~/src/cmake/build/bin/cmake .

and git-bisect reports 657fc3a9, (CMakeDetermineCompilerABI: Parse library arch from versioned paths, 2021-02-03) as the first bad commit.

Edited by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information