Catch2 symbols missing from the package since last update

Description:

Catch2::Catch2WithMain cannot be used anymore due to missing symbols. The package does not contain any library file.

Additional info:

  • package version(s): 3.8.0-1

Steps to reproduce:

Create a basic Catch2 test project with Catch2::Catch2WithMain and try to build it.

unit.cpp:

#include <catch2/catch_all.hpp>

TEST_CASE("unit") { REQUIRE(true == false); }

CMakeLists.txt:

cmake_minimum_required(VERSION 3.30)
project(repro-catch2)

find_package(Catch2 3 REQUIRED)

add_executable(unit unit.cpp)
target_link_libraries(unit Catch2::Catch2WithMain)

Build the project:

mkdir build
cd build
cmake ..
make

Output:

-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/repro-catch2/build
[ 50%] Building CXX object CMakeFiles/unit.dir/unit.cpp.o
[100%] Linking CXX executable unit
/usr/bin/ld: CMakeFiles/unit.dir/unit.cpp.o: warning: relocation against `_ZTVN5Catch20ITransientExpressionE' in read-only section `.text._ZN5Catch20ITransientExpressionC2Ebb[_ZN5Catch20ITransientExpressionC5Ebb]'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../lib/Scrt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: CMakeFiles/unit.dir/unit.cpp.o: in function `CATCH2_INTERNAL_TEST_0()':
unit.cpp:(.text+0x89): undefined reference to `Catch::AssertionHandler::AssertionHandler(Catch::StringRef, Catch::SourceLineInfo const&, Catch::StringRef, Catch::ResultDisposition::Flags)'
/usr/bin/ld: unit.cpp:(.text+0xdb): undefined reference to `Catch::AssertionHandler::handleExpr(Catch::ITransientExpression const&)'
/usr/bin/ld: unit.cpp:(.text+0xe7): undefined reference to `Catch::AssertionHandler::complete()'
/usr/bin/ld: unit.cpp:(.text+0x119): undefined reference to `Catch::AssertionHandler::handleUnexpectedInflightException()'
/usr/bin/ld: CMakeFiles/unit.dir/unit.cpp.o: in function `__static_initialization_and_destruction_0()':
unit.cpp:(.text+0x195): undefined reference to `Catch::StringRef::StringRef(char const*)'
/usr/bin/ld: unit.cpp:(.text+0x21d): undefined reference to `Catch::makeTestInvoker(void (*)())'
/usr/bin/ld: unit.cpp:(.text+0x249): undefined reference to `Catch::AutoReg::AutoReg(Catch::Detail::unique_ptr<Catch::ITestInvoker>, Catch::SourceLineInfo const&, Catch::StringRef, Catch::NameAndTags const&)'
/usr/bin/ld: CMakeFiles/unit.dir/unit.cpp.o: in function `Catch::ITransientExpression::ITransientExpression(bool, bool)':
unit.cpp:(.text._ZN5Catch20ITransientExpressionC2Ebb[_ZN5Catch20ITransientExpressionC5Ebb]+0x17): undefined reference to `vtable for Catch::ITransientExpression'
/usr/bin/ld: CMakeFiles/unit.dir/unit.cpp.o:(.data.rel.ro._ZTIN5Catch10BinaryExprIbbEE[_ZTIN5Catch10BinaryExprIbbEE]+0x10): undefined reference to `typeinfo for Catch::ITransientExpression'
/usr/bin/ld: CMakeFiles/unit.dir/unit.cpp.o: in function `Catch::BinaryExpr<bool, bool>::streamReconstructedExpression(std::ostream&) const':
unit.cpp:(.text._ZNK5Catch10BinaryExprIbbE29streamReconstructedExpressionERSo[_ZNK5Catch10BinaryExprIbbE29streamReconstructedExpressionERSo]+0x70): undefined reference to `Catch::formatReconstructedExpression(std::ostream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Catch::StringRef, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/unit.dir/build.make:103: unit] Error 1
make[1]: *** [CMakeFiles/Makefile2:87: CMakeFiles/unit.dir/all] Error 2
make: *** [Makefile:91: all] Error 2