0.11.0: build fails with cmake 3.30.3
Describe the bug Looks like build fails with cmake 3.30.3. Quite possible that it could be cmake issue.
To Reproduce Build with build cmake 3.30.3 installed.
Expected behavior Build should not fail.
Screenshots
[ 58%] Linking CXX executable tests/gain_map_test
cd /home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib && /usr/bin/cmake -E cmake_link_script CMakeFiles/gain_map_test.dir/link.txt --verbose=1
/usr/bin/g++ -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -mtls-dialect=gnu2 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -fno-rtti -fno-exceptions -fno-rtti -O2 -g -DNDEBUG -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--gc-sections -Wl,--as-needed -Wl,--build-id=sha1 -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,pack-relative-relocs -flto=auto -fuse-linker-plugin -fPIE -pie CMakeFiles/gain_map_test.dir/extras/gain_map_test.cc.o -o tests/gain_map_test -Wl,-rpath,/home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib libjxl_testlib-internal.a libjxl_extras-internal.a /usr/lib64/libgtest_main.so.1.14.0 /usr/lib64/libgtest.so.1.14.0 libjxl-internal.a /usr/lib64/libhwy.so /usr/lib64/libbrotlidec.so /usr/lib64/libbrotlicommon.so /usr/lib64/libbrotlienc.so libjxl_cms.so.0.11.0 /usr/lib64/libtcmalloc_minimal.so libjxl_threads.so.0.11.0 /usr/lib64/libgif.so /usr/lib64/libjpeg.so /usr/lib64/libpng.so /usr/lib64/libOpenEXR-3_2.so /usr/lib64/libOpenEXRUtil-3_2.so /usr/lib64/libOpenEXRCore-3_2.so /usr/lib64/libIex-3_2.so /usr/lib64/libIlmThread-3_2.so /usr/lib64/libImath-3_1.so
cd /home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib && /usr/bin/cmake -D TEST_TARGET=gain_map_test -D TEST_EXECUTABLE=/home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib/tests/gain_map_test -D TEST_EXECUTOR= -D TEST_WORKING_DIR=/home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib -D TEST_EXTRA_ARGS= -D TEST_PROPERTIES= -D TEST_PREFIX= -D TEST_SUFFIX= -D TEST_FILTER= -D NO_PRETTY_TYPES=FALSE -D NO_PRETTY_VALUES=FALSE -D TEST_LIST=gain_map_test_TESTS -D CTEST_FILE=/home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib/gain_map_test[1]_tests.cmake -D TEST_DISCOVERY_TIMEOUT=240 -D TEST_XML_OUTPUT_DIR= -P /usr/share/cmake/Modules/GoogleTestAddTests.cmake
ReadTestData /home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/testdata/external/Compact-ICC-Profiles/profiles/scRGB-v2.icc
CMake Error at /usr/share/cmake/Modules/GoogleTestAddTests.cmake:112 (message):
Error running test executable.
Path: '/home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib/tests/gain_map_test'
Working directory: '/home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib'
Result: Illegal instruction
Output:
Call Stack (most recent call first):
/usr/share/cmake/Modules/GoogleTestAddTests.cmake:226 (gtest_discover_tests_impl)
make[2]: *** [lib/CMakeFiles/gain_map_test.dir/build.make:122: lib/tests/gain_map_test] Error 1
make[2]: *** Deleting file 'lib/tests/gain_map_test'
Environment
- OS: Linux x86/64
- Compiler version: gcc 14.2.1
- CPU type: x86_64
Additional context N/A
I've opened https://gitlab.kitware.com/cmake/cmake/-/issues/26339
I'm not sure this is a cmake issue. It looks like cmake is just reporting that the test executable gain_map_test is aborting.
(For the record, the build works and all tests pass using cmake 3.30.4, gcc 14.2.1 on a similar platform.)
OK so how can I try to diagnose this issue in my env? Any advices/hints? 🤔
As a workaround, are you able to build it with clang instead of gcc?
export CC=clang CXX=clang++
cmake .....
Some other info that might be useful to the developers when they get to look at this:
- Can you share the command(s) you use for your build? (cmake options, etc.)
- If you run
gain_map_testdirectly, it should show which test is crashing:
Successful run
$ ./gain_map_test
Running main() from /usr/src/debug/gtest/googletest-1.15.2/googletest/src/gtest_main.cc
ReadTestData /home/user/build/libjxl/src/libjxl/testdata/external/Compact-ICC-Profiles/profiles/scRGB-v2.icc
Test data external/Compact-ICC-Profiles/profiles/scRGB-v2.icc is 372 bytes long.
ReadTestData /home/user/build/libjxl/src/libjxl/testdata/external/Compact-ICC-Profiles/profiles/scRGB-v2.icc
Test data external/Compact-ICC-Profiles/profiles/scRGB-v2.icc is 372 bytes long.
[==========] Running 4 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 4 tests from GainMapTestCases/GainMapTest
[ RUN ] GainMapTestCases/GainMapTest.GainMapRoundtrip/HasColorEncoding1ICCSize0
ReadTestData /home/user/build/libjxl/src/libjxl/testdata/external/Compact-ICC-Profiles/profiles/scRGB-v2.icc
Test data external/Compact-ICC-Profiles/profiles/scRGB-v2.icc is 372 bytes long.
[ OK ] GainMapTestCases/GainMapTest.GainMapRoundtrip/HasColorEncoding1ICCSize0 (0 ms)
[ RUN ] GainMapTestCases/GainMapTest.GainMapRoundtrip/HasColorEncoding1ICCSize136
ReadTestData /home/user/build/libjxl/src/libjxl/testdata/external/Compact-ICC-Profiles/profiles/scRGB-v2.icc
Test data external/Compact-ICC-Profiles/profiles/scRGB-v2.icc is 372 bytes long.
[ OK ] GainMapTestCases/GainMapTest.GainMapRoundtrip/HasColorEncoding1ICCSize136 (0 ms)
[ RUN ] GainMapTestCases/GainMapTest.GainMapRoundtrip/HasColorEncoding0ICCSize136
ReadTestData /home/user/build/libjxl/src/libjxl/testdata/external/Compact-ICC-Profiles/profiles/scRGB-v2.icc
Test data external/Compact-ICC-Profiles/profiles/scRGB-v2.icc is 372 bytes long.
[ OK ] GainMapTestCases/GainMapTest.GainMapRoundtrip/HasColorEncoding0ICCSize136 (0 ms)
[ RUN ] GainMapTestCases/GainMapTest.GainMapRoundtrip/HasColorEncoding0ICCSize0
ReadTestData /home/user/build/libjxl/src/libjxl/testdata/external/Compact-ICC-Profiles/profiles/scRGB-v2.icc
Test data external/Compact-ICC-Profiles/profiles/scRGB-v2.icc is 372 bytes long.
[ OK ] GainMapTestCases/GainMapTest.GainMapRoundtrip/HasColorEncoding0ICCSize0 (0 ms)
[----------] 4 tests from GainMapTestCases/GainMapTest (1 ms total)
[----------] Global test environment tear-down
[==========] 4 tests from 1 test suite ran. (1 ms total)
[ PASSED ] 4 tests.
- If you run
gain_map_testunder gdb, it might show exactly where in the code it's crashing:
e.g.
gdb /home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib/tests/gain_map_test
...
(gdb) run
...
(gdb) bt
First of all after:
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu'
[ 64%] Linking CXX executable tests/gain_map_test
cd /home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib && /usr/bin/cmake -E cmake_link_script CMakeFiles/gain_map_test.dir/link.txt --verbose=1
/usr/bin/g++ -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -mtls-dialect=gnu2 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -fno-rtti -fno-exceptions -fno-rtti -O2 -g -DNDEBUG -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--gc-sections -Wl,--as-needed -Wl,--build-id=sha1 -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,pack-relative-relocs -flto=auto -fuse-linker-plugin -fPIE -pie CMakeFiles/gain_map_test.dir/extras/gain_map_test.cc.o -o tests/gain_map_test -Wl,-rpath,/home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib libjxl_testlib-internal.a libjxl_extras-internal.a /usr/lib64/libgtest_main.so.1.14.0 /usr/lib64/libgtest.so.1.14.0 libjxl-internal.a /usr/lib64/libhwy.so /usr/lib64/libbrotlidec.so /usr/lib64/libbrotlicommon.so /usr/lib64/libbrotlienc.so libjxl_cms.so.0.11.0 /usr/lib64/libtcmalloc_minimal.so libjxl_threads.so.0.11.0 /usr/lib64/libgif.so /usr/lib64/libjpeg.so /usr/lib64/libpng.so /usr/lib64/libOpenEXR-3_3.so /usr/lib64/libOpenEXRUtil-3_3.so /usr/lib64/libOpenEXRCore-3_3.so /usr/lib64/libIex-3_3.so /usr/lib64/libIlmThread-3_3.so /usr/lib64/libImath-3_1.so
cd /home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib && /usr/bin/cmake -D TEST_TARGET=gain_map_test -D TEST_EXECUTABLE=/home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib/tests/gain_map_test -D TEST_EXECUTOR= -D TEST_WORKING_DIR=/home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib -D TEST_EXTRA_ARGS= -D TEST_PROPERTIES= -D TEST_PREFIX= -D TEST_SUFFIX= -D TEST_FILTER= -D NO_PRETTY_TYPES=FALSE -D NO_PRETTY_VALUES=FALSE -D TEST_LIST=gain_map_test_TESTS -D CTEST_FILE=/home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib/gain_map_test[1]_tests.cmake -D TEST_DISCOVERY_TIMEOUT=240 -D TEST_XML_OUTPUT_DIR= -P /usr/share/cmake/Modules/GoogleTestAddTests.cmake
ReadTestData /home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/testdata/external/Compact-ICC-Profiles/profiles/scRGB-v2.icc
CMake Error at /usr/share/cmake/Modules/GoogleTestAddTests.cmake:112 (message):
Error running test executable.
Path: '/home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib/tests/gain_map_test'
Working directory: '/home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib'
Result: Illegal instruction
Output:
Call Stack (most recent call first):
/usr/share/cmake/Modules/GoogleTestAddTests.cmake:226 (gtest_discover_tests_impl)
make[2]: *** [lib/CMakeFiles/gain_map_test.dir/build.make:122: lib/tests/gain_map_test] Error 1
make[2]: *** Deleting file 'lib/tests/gain_map_test'
I have no gain_map_test binary.
Second: I've linked manually gain_map_tes binaty and executed
[tkloczko@pers-jacek tests]$ ./gain_map_test
Running main() from /home/tkloczko/rpmbuild/BUILD/googletest-1.14.0/googletest/src/gtest_main.cc
ReadTestData /home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/testdata/external/Compact-ICC-Profiles/profiles/scRGB-v2.icc
Illegal instruction (core dumped)
[tkloczko@pers-jacek tests]$ gdb ./gain_map_test
GNU gdb (GDB) G2V 14.2-14.fc37
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./gain_map_test...
(gdb) r
Starting program: /home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/x86_64-redhat-linux-gnu/lib/tests/gain_map_test
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Running main() from /home/tkloczko/rpmbuild/BUILD/googletest-1.14.0/googletest/src/gtest_main.cc
ReadTestData /home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/testdata/external/Compact-ICC-Profiles/profiles/scRGB-v2.icc
Program received signal SIGILL, Illegal instruction.
jxl::test::ReadTestData (filename=...) at /home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/lib/jxl/test_utils.cc:90
90 Check(file.good());
Missing debuginfo, try: dnf debuginfo-install gtest-1.14.0-6.fc37.x86_64
Missing debuginfo, try: dnf debuginfo-install highway-1.2.0-3.fc37.x86_64
Missing debuginfo, try: dnf debuginfo-install libbrotli-1.1.0-5.fc37.x86_64
Missing debuginfo, try: dnf debuginfo-install gperftools-libs-2.15-3.fc37.x86_64
Missing debuginfo, try: dnf debuginfo-install libstdc++-14.2.1-4.fc42.x86_64
Missing debuginfo, try: dnf debuginfo-install glibc-2.40.9000-1.fc42.x86_64
Missing debuginfo, try: dnf debuginfo-install libgcc-14.2.1-4.fc42.x86_64
Missing debuginfo, try: dnf debuginfo-install lcms2-2.16-4.fc37.x86_64
(gdb) bt full
#0 jxl::test::ReadTestData (filename=...) at /home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/lib/jxl/test_utils.cc:90
full_path = {_M_dataplus = {<std::allocator<char>> = {<std::__new_allocator<char>> = {<No data fields>}, <No data fields>},
_M_p = 0x555555dbc070 "/home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/testdata/external/Compact-ICC-Profiles/profiles/scRGB-v2.icc"}, _M_string_length = 104, {
_M_local_buf = "j\000\000\000\000\000\000\000J\000\000\000\000\000\000", _M_allocated_capacity = 106}}
file = <incomplete type>
str = <optimized out>
data = <optimized out>
raw = <optimized out>
full_path = <optimized out>
file = <optimized out>
str = <optimized out>
raw = <optimized out>
data = <optimized out>
#1 jxl::test::GetIccTestProfile () at /home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/lib/jxl/test_utils.cc:71
No locals.
#2 jxl::test::GetCompressedIccTestProfile () at /home/tkloczko/rpmbuild/BUILD/libjxl-0.11.0/lib/jxl/test_utils.cc:76
writer = {static kMaxBitsPerCall = 56, bits_written_ = 0, storage_ = {memory_manager_ = 0x555555592000 <jxl::test::(anonymous namespace)::kMemoryManager>, size_ = 0,
capacity_ = 0, data_ = {allocation_ = 0x0, memory_manager_ = 0x0, address_ = 0x0}}, current_allotment_ = 0x0}
icc = <optimized out>
bytes = <optimized out>
#3 0x0000555555557821 in jxl::(anonymous namespace)::gtest_GainMapTestCasesGainMapTest_EvalGenerator_ () at /usr/include/c++/14/bits/stl_vector.h:98
No locals.
#4 0x000055555555abe6 in testing::internal::ParameterizedTestSuiteInfo<jxl::(anonymous namespace)::GainMapTest>::RegisterTests (this=<optimized out>)
at /usr/include/gtest/internal/gtest-param-util.h:563
generator = {
impl_ = {<std::__shared_ptr<testing::internal::ParamGeneratorInterface<jxl::(anonymous namespace)::GainMapTestParams> const, (__gnu_cxx::_Lock_policy)2>> = {<std::__shared_ptr_access<testing::internal::ParamGeneratorInterface<jxl::(anonymous namespace)::GainMapTestParams> const, (__gnu_cxx::_Lock_policy)2, false, false>> = {<No data fields>},
_M_ptr = 0x7ffff7ca9000 <tcmalloc::Static::central_cache_+15808>, _M_refcount = {_M_pi = 0x1}}, <No data fields>}}
file = <optimized out>
line = <optimized out>
test_suite_name = {_M_dataplus = {<std::allocator<char>> = {<std::__new_allocator<char>> = {<No data fields>}, <No data fields>},
_M_p = 0x6 <error: Cannot access memory at address 0x6>}, _M_string_length = 140737488346736, {_M_local_buf = "a\000\000\000\000\000\000\000\000\274L\v\313v\"\216",
_M_allocated_capacity = 97}}
i = <optimized out>
instantiation_name = @0x555555dac000: {_M_dataplus = {<std::allocator<char>> = {<std::__new_allocator<char>> = {<No data fields>}, <No data fields>},
_M_p = 0x555555daa040 "GainMapTestCases"}, _M_string_length = 16, {_M_local_buf = "\020\000\000\000\000\000\000\000TESTS\000\000", _M_allocated_capacity = 16}}
name_func = <optimized out>
test_param_names = {_M_t = {
_M_impl = {<std::allocator<std::_Rb_tree_node<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {<std::__new_allocator<std::_Rb_tree_node<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {<No data fields>}, <No data fields>}, <std::_Rb_tree_key_compare<std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {
_M_key_compare = {<std::binary_function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool>> = {<No data fields>}, <No data fields>}}, <std::_Rb_tree_header> = {_M_header = {_M_color = (unknown: 0xf7ca9000), _M_parent = 0x7fffffffddf0,
_M_left = 0x7ffff7c88033 <tcmalloc::CentralFreeList::RemoveRange(void**, void**, int)+131>, _M_right = 0x1}, _M_node_count = 140737488346544}, <No data fields>}}}
gen_it = {_M_current = 0x555555dac000}
test_info = <optimized out>
test_it = <optimized out>
generated_instantiations = <optimized out>
#5 0x00007ffff7f739fd in testing::internal::UnitTestImpl::RegisterParameterizedTests() () from /lib64/libgtest.so.1.14.0
No symbol table info available.
#6 0x00007ffff7f73a9c in testing::internal::UnitTestImpl::PostFlagParsingInit() () from /lib64/libgtest.so.1.14.0
No symbol table info available.
#7 0x00007ffff7faf109 in main () from /lib64/libgtest_main.so.1.14.0
No symbol table info available.
#8 0x00007ffff76fd1c8 in __libc_start_call_main () from /lib64/libc.so.6
No symbol table info available.
#9 0x00007ffff76fd28b in __libc_start_main_impl () from /lib64/libc.so.6
No symbol table info available.
#10 0x00005555555569c5 in _start ()
--Type <RET> for more, q to quit, c to continue without paging--
No symbol table info available.
(gdb)
I see that in Fedora jpegxl is build with BUILD_TESTING=OFF so this is why Fedora package build with the same compiler is OK.
And yet another thought .. why gain_map_test binary is executed as part off all target?
This execution shuld be executed only by ctest.
I manage to build my own package by temporary use BUILD_TESTING=OFF.
The crash in the test is reproducable here with both gcc 14.2.0 and clang 19.1.4 -- on x86_64, gain_map_test produces a SIGILL, on aarch64, it produces a SIGTRAP instead
Will take a look soon.
FWIW: on all ubuntu-* github action runners CMake is 3.31.1.
Could someone check if the problem is reproducible with this version of CMake as well?
Another observation: in report crash happens in "linking" phase, i.e. when gtest harness runs binary to collect test names.
This reduces the area of search where the problem could hide.
FWIW: on all
ubuntu-*github action runners CMake is3.31.1.
On the other hand - neither env has gcc 14+ / clang 19+.
Stack trace clearly shows the problem: Compact-ICC-Profiles/profiles/scRGB-v2.icc can't be loaded. So, it is very likely CMake problem. Investigating further.
Could you check what ls -la testdata/external/ shows?
NB: I'll add CMake config check that this directory is populated when tests are enabled