BundleUtilities test fails with glibc 2.36
On a glibc 2.36 linux system, the BundleUtilities test fails as follows:
INPUT = /home/cmake/cmake-3.24.1/Tests/BundleUtilities/testbundleutils1
MODULE = /home/cmake/cmake-3.24.1/Tests/BundleUtilities/module1.so
INPUTDIR = /home/cmake/cmake-3.24.1/Tests/BundleUtilities
OUTPUTDIR = /home/cmake/cmake-3.24.1/Tests/BundleUtilities/testdir1
OUTPUT = /home/cmake/cmake-3.24.1/Tests/BundleUtilities/testdir1/testbundleutils1
OUTPUTMODULE = /home/cmake/cmake-3.24.1/Tests/BundleUtilities/testdir1/module1.so
-- fixup_bundle
-- app='/home/cmake/cmake-3.24.1/Tests/BundleUtilities/testdir1/testbundleutils1'
-- libs='/home/cmake/cmake-3.24.1/Tests/BundleUtilities/testdir1/module1.so'
-- dirs='/home/cmake/cmake-3.24.1/Tests/BundleUtilities'
-- ignoreItems=''
-- fixup_bundle: preparing...
--
warning: cannot resolve item 'linux-vdso.so.1'
possible problems:
need more directories?
need to use InstallRequiredSystemLibraries?
run in install tree instead of build tree?
-- warning: gp_resolved_file_type non-absolute file 'linux-vdso.so.1' returning type 'other' -- possibly incorrect
--
warning: cannot resolve item 'linux-vdso.so.1'
possible problems:
need more directories?
need to use InstallRequiredSystemLibraries?
run in install tree instead of build tree?
--
warning: cannot resolve item 'linux-vdso.so.1'
possible problems:
need more directories?
need to use InstallRequiredSystemLibraries?
run in install tree instead of build tree?
-- warning: gp_resolved_file_type non-absolute file 'linux-vdso.so.1' returning type 'other' -- possibly incorrect
--
warning: cannot resolve item 'linux-vdso.so.1'
possible problems:
need more directories?
need to use InstallRequiredSystemLibraries?
run in install tree instead of build tree?
CMake Error at /home/cmake/cmake-3.24.1/Modules/BundleUtilities.cmake:471 (file):
file READ_ELF given FILE "linux-vdso.so.1" that does not exist.
Call Stack (most recent call first):
/home/cmake/cmake-3.24.1/Modules/BundleUtilities.cmake:527 (get_item_rpaths)
/home/cmake/cmake-3.24.1/Modules/BundleUtilities.cmake:614 (set_bundle_key_values)
/home/cmake/cmake-3.24.1/Modules/BundleUtilities.cmake:934 (get_bundle_keys)
bundleutils.cmake:37 (fixup_bundle)
gmake[2]: *** [CMakeFiles/testbundleutils1_test.dir/build.make:71: CMakeFiles/testbundleutils1_test] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:231: CMakeFiles/testbundleutils1_test.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2
a simple way to workaround (fix?) the issue appears to be:
--- a/cmake-3.24.1/Modules/GetPrerequisites.cmake 2022-08-17 18:54:57.000000000 +0200
+++ b/cmake-3.24.1/Modules/GetPrerequisites.cmake 2022-08-23 16:21:14.612199765 +0200
@@ -514,7 +514,7 @@
string(TOLOWER "${resolved_file}" lower)
if(UNIX)
- if(resolved_file MATCHES "^(/lib/|/lib32/|/libx32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/libx32/|/usr/lib64/|/usr/X11R6/|/usr/bin/)")
+ if(resolved_file MATCHES "^(/lib/|/lib32/|/libx32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/libx32/|/usr/lib64/|/usr/X11R6/|/usr/bin/|linux-vdso\.so)")
set(is_system 1)
endif()
endif()
the behavior change to glibc 2.35 can be seen in ldd output
# ldd /usr/bin/true
linux-vdso.so.1 => linux-vdso.so.1 (0x00007ffce2fb7000)
libc.so.6 => /lib64/libc.so.6 (0x00007f4d56b2c000)
/lib64/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007f4d56d15000)
on glibc 2.35 the output looks like this:
# ldd /usr/bin/true
linux-vdso.so.1 (0x00007fff7d374000)
libc.so.6 => /lib64/libc.so.6 (0x00007fc770eec000)
/lib64/ld-linux-x86-64.so.2 (0x00007fc771141000)
wasn't able to find the exact code path that cmake is using to read the dependencies.
simple reproducer is run this inside the current fedora rawhide container, e.g. podman run -it fedora:rawhide
Edited by Dirk Mueller