scnlib's tests/examples/benchmarks fail to build from source on Arch (both with GCC 15.1.1 and Clang 20.1.8) since commit 48b8aeb.
Error
$ cmake --build build --target all -j1
[1/18] Linking CXX executable benchmark/runtime/basic/scn_basic_bench
FAILED: benchmark/runtime/basic/scn_basic_bench
: && /usr/lib/ccache/bin/c++ -O3 -DNDEBUG -Wl,--dependency-file=benchmark/runtime/basic/CMakeFiles/scn_basic_bench.dir/link.d benchmark/runtime/basic/CMakeFiles/scn_basic_bench.dir/basic_bench.cpp.o -o benchmark/runtime/basic/scn_basic_bench -Wl,-rpath,/srv/build/work/scnlib-git/src/build/_deps/google-benchmark-build/src:/srv/build/work/scnlib-git/src/build _deps/google-benchmark-build/src/libbenchmark_main.so.1.9.4 libscn.so.4.0.1 _deps/google-benchmark-build/src/libbenchmark.so.1.9.4 && :
/usr/bin/ld: benchmark/runtime/basic/CMakeFiles/scn_basic_bench.dir/basic_bench.cpp.o: in function `bench_basic_scn_value(benchmark::State&)':
basic_bench.cpp:(.text+0x27f): undefined reference to `scn::v4::detail::vscan_value_impl(std::basic_string_view<char, std::char_traits<char> >, scn::v4::basic_scan_arg<scn::v4::basic_scan_context<scn::v4::detail::buffer_range_tag, char> >)'
/usr/bin/ld: benchmark/runtime/basic/CMakeFiles/scn_basic_bench.dir/basic_bench.cpp.o: in function `bench_basic_scn(benchmark::State&)':
basic_bench.cpp:(.text+0x597): undefined reference to `scn::v4::detail::vscan_impl(std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> >, scn::v4::basic_scan_args<scn::v4::basic_scan_context<scn::v4::detail::buffer_range_tag, char> >)'
/usr/bin/ld: benchmark/runtime/basic/CMakeFiles/scn_basic_bench.dir/basic_bench.cpp.o: in function `bench_basic_scn_withoptions(benchmark::State&)':
basic_bench.cpp:(.text+0x757): undefined reference to `scn::v4::detail::vscan_impl(std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> >, scn::v4::basic_scan_args<scn::v4::basic_scan_context<scn::v4::detail::buffer_range_tag, char> >)'
/usr/bin/ld: benchmark/runtime/basic/CMakeFiles/scn_basic_bench.dir/basic_bench.cpp.o: in function `bench_basic_scn_withlocale(benchmark::State&)':
basic_bench.cpp:(.text+0x94a): undefined reference to `scn::v4::scan_expected<long> scn::v4::detail::vscan_localized_impl<std::locale>(std::locale const&, std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> >, scn::v4::basic_scan_args<scn::v4::basic_scan_context<scn::v4::detail::buffer_range_tag, char> >)'
/usr/bin/ld: benchmark/runtime/basic/CMakeFiles/scn_basic_bench.dir/basic_bench.cpp.o: in function `bench_basic_scn_localized(benchmark::State&)':
basic_bench.cpp:(.text+0xb2a): undefined reference to `scn::v4::scan_expected<long> scn::v4::detail::vscan_localized_impl<std::locale>(std::locale const&, std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> >, scn::v4::basic_scan_args<scn::v4::basic_scan_context<scn::v4::detail::buffer_range_tag, char> >)'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
(other tests/benchmarks/examples fail similarly, run ninja -k0 or make -k)
Build configuration
cmake -S scnlib -B build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
&& cmake --build build --target all
Bisect
$ git bisect start master v4.0.1
Bisecting: 20 revisions left to test after this (roughly 4 steps)
[8b8f3052b62976dc6cdc0b664a0df46b155ed1b3] Fix other-archs build job
$ git bisect run bash -ex -c "rm -rf build; cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON; cmake --build build --target all; cmake --build build --target test"
<...>
48b8aeb217734b459d4d9170e602a65af9080f39 is the first bad commit
commit 48b8aeb217734b459d4d9170e602a65af9080f39
Author: Elias Kosunen <elias.kosunen@gmail.com>
Date: Wed Jun 4 01:58:26 2025 +0300
Initial support for modules
.github/workflows/linux.yml | 4 +-
.github/workflows/modules.yml | 126 +++
CMakeLists.txt | 66 +-
README.md | 2 +-
cmake/icm_build_failure_parse_and_run.cmake | 7 +-
cmake/icm_build_failure_testing.cmake | 15 +-
cmake/install.cmake | 10 +
cmake/options.cmake | 2 +
include/scn/chrono.h | 10 +-
include/scn/fwd.h | 1093 +-------------------
include/scn/istream.h | 4 +
include/scn/macros.h | 1091 +++++++++++++++++++
include/scn/regex.h | 4 +
include/scn/scan.h | 33 +-
src/modules/CMakeLists.txt | 30 -
src/modules/chrono.cppm | 58 --
src/modules/istream.cppm | 27 -
src/modules/ranges.cppm | 29 -
src/modules/scan.cppm | 138 ---
src/modules/scn.cppm | 24 -
src/scn/impl.cpp | 2 +-
src/scn/scn.cppm | 204 ++++
tests/consumer-test/CMakeLists.txt | 8 -
tests/consumer-test/library/CMakeLists.txt | 8 +
tests/consumer-test/{ => library}/main.cpp | 0
tests/consumer-test/module/CMakeLists.txt | 9 +
tests/consumer-test/module/main.cpp | 12 +
tests/unittests/CMakeLists.txt | 12 +-
.../regex.cppm => tests/unittests/module_test.cpp | 21 +-
29 files changed, 1589 insertions(+), 1460 deletions(-)
create mode 100644 .github/workflows/modules.yml
create mode 100644 include/scn/macros.h
delete mode 100644 src/modules/CMakeLists.txt
delete mode 100644 src/modules/chrono.cppm
delete mode 100644 src/modules/istream.cppm
delete mode 100644 src/modules/ranges.cppm
delete mode 100644 src/modules/scan.cppm
delete mode 100644 src/modules/scn.cppm
create mode 100644 src/scn/scn.cppm
delete mode 100644 tests/consumer-test/CMakeLists.txt
create mode 100644 tests/consumer-test/library/CMakeLists.txt
rename tests/consumer-test/{ => library}/main.cpp (100%)
create mode 100644 tests/consumer-test/module/CMakeLists.txt
create mode 100644 tests/consumer-test/module/main.cpp
rename src/modules/regex.cppm => tests/unittests/module_test.cpp (61%)
bisect found first bad commit
$ git bisect log
# bad: [aeaee06538611a142cf273ff2537841cdc8b15fc] Fix issue found by fuzzing
# good: [e937be1a52588621b406d58ce8614f96bb5de747] Prepare v4.0.1
git bisect start 'master' 'v4.0.1'
# good: [8b8f3052b62976dc6cdc0b664a0df46b155ed1b3] Fix other-archs build job
git bisect good 8b8f3052b62976dc6cdc0b664a0df46b155ed1b3
# good: [646fcd7586b8726c2472118048aa97e832e16eba] Replace use of ubuntu-20.04 in CI with containers
git bisect good 646fcd7586b8726c2472118048aa97e832e16eba
# good: [aca4cf20a38bbd8ba0be58608ddc7ee859c539d0] int128 and ext-float fixes
git bisect good aca4cf20a38bbd8ba0be58608ddc7ee859c539d0
# bad: [c7f05757c41e397ceaa80cfe54bf47a080842a38] Warning fixes
git bisect bad c7f05757c41e397ceaa80cfe54bf47a080842a38
# bad: [48b8aeb217734b459d4d9170e602a65af9080f39] Initial support for modules
git bisect bad 48b8aeb217734b459d4d9170e602a65af9080f39
# good: [e42892687f751df67032b27f035422924036ad35] Add C++20 modules support
git bisect good e42892687f751df67032b27f035422924036ad35
# first bad commit: [48b8aeb217734b459d4d9170e602a65af9080f39] Initial support for modules
How to reproduce
$ podman run -it --rm archlinux:latest
[root@container /]$ pacman -Sy base-devel git cmake ninja
[root@container /]$ git clone https://github.com/eliaskosunen/scnlib --revision 48b8aeb217734b459d4d9170e602a65af9080f39
[root@container /]$ cmake -G Ninja -S scnlib -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
[root@container /]$ cmake --build build --target all -- -k0
Analysis
The issue seems to be the newly-changed visibility flags, making visibility default to "hidden" for all symbols:
|
if (NOT DEFINED CMAKE_CXX_VISIBILITY_PRESET) |
|
message(STATUS "No CMAKE_CXX_VISIBILITY_PRESET set, defaulting to hidden") |
|
set(CMAKE_CXX_VISIBILITY_PRESET hidden CACHE STRING "Preset for the export of private symbols") |
|
set_property(CACHE CMAKE_CXX_VISIBILITY_PRESET PROPERTY STRINGS hidden default) |
|
endif () |
|
if (NOT DEFINED CMAKE_VISIBILITY_INLINES_HIDDEN) |
|
message(STATUS "No CMAKE_VISIBILITY_INLINES_HIDDEN set, defaulting to ON") |
|
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON CACHE BOOL |
|
"Whether to add a compiler flag to hide symbols of inline functions") |
|
endif () |
Overriding the -fvisibility=hidden flag, reverting to "default" visibility for non-inlines, is enough to fix the FTBFS and have the tests pass:
cmake -S scnlib -B build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_CXX_VISIBILITY_PRESET=default \
&& cmake --build build --target all \
&& cmake --build build --target tests
Overriding -fvisibility-inlines-hidden is not necessary to fix FTBFS (though I can't comment on semantic correctness).
scnlib's tests/examples/benchmarks fail to build from source on Arch (both with GCC 15.1.1 and Clang 20.1.8) since commit 48b8aeb.
Error
(other tests/benchmarks/examples fail similarly, run
ninja -k0ormake -k)Build configuration
cmake -S scnlib -B build \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=ON \ && cmake --build build --target allBisect
How to reproduce
Analysis
The issue seems to be the newly-changed visibility flags, making visibility default to "hidden" for all symbols:
scnlib/CMakeLists.txt
Lines 30 to 39 in 48b8aeb
Overriding the
-fvisibility=hiddenflag, reverting to "default" visibility for non-inlines, is enough to fix the FTBFS and have the tests pass:cmake -S scnlib -B build \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=ON \ -DCMAKE_CXX_VISIBILITY_PRESET=default \ && cmake --build build --target all \ && cmake --build build --target testsOverriding
-fvisibility-inlines-hiddenis not necessary to fix FTBFS (though I can't comment on semantic correctness).