Catch2 fails to link when using a CMake multi-config generator
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 38/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- cmake, cpp
- Área
- build-system, testing-qa
Línea de trabajo
Empieza reproduciendo la configuración proporcionada de Conan y CMake con Ninja Multi-Config y, después, compárala con el generador de Ninja que funciona. Lee el comentario y la lógica de configuración de Catch2-Target-release.cmake, centrándote en cómo se añaden las configuraciones a la ruta. Se considera terminado cuando la compilación Multi-Config enlaza correctamente xxx_test sin que falten símbolos de Catch2 ni main.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
When Catch2 is installed using Conan into a project using CMake, and the project uses a multi-config generator such as "Ninja Multi-Config", building the project results in linker errors having to do with missing references to Catch2 symbols.
Expected behavior
Project should link successfully.
Reproduction steps
- Install Catch2 using Conan:
[test_requires]
catch2/3.6.0
- Use Conan's CMake integration to find and link against Catch2:
add_executable(xxx_test ${SOURCES_WITHOUT_MAIN} ${TEST_SOURCES})
find_package(Catch2 REQUIRED)
target_link_libraries(xxx_test PRIVATE Catch2::Catch2WithMain)
- Configure + build using CMake and the "Ninja Multi-Config" generator
cmake -G "Ninja Multi-Config" -S. -B ./build --preset=conan-release && cmake --build ./build
- Observe link errors:
FAILED: Debug/xxx_test
...
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../lib/Scrt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: CMakeFiles/xxx_test.dir/Debug/test/XXX.test.cpp.o: in function `CATCH2_INTERNAL_TEST_0()':
/home/tom/projects/xxx/projects/xxx/test/XXX.test.cpp:6:(.text+0x4e): undefined reference to `Catch::ReusableStringStream::ReusableStringStream()'
...
Platform information:
- OS: Arch Linux
- Compiler+version: GCC v14.1.1
- Catch version: v3.6.0
- Conan version: 2.5.0
Additional context
- When changing the generator to "Ninja" things work as expected.
- The following comment exists in
Catch2-Target-release.cmake:
# FIXME: What is the result of this for multi-config? All configs adding themselves to path?
- Lenguaje dominante
- C++
- Estrellas
- 21.6k
- Forks
- 3.4k
- Merge medio
- 3 d 12 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de catchorg/Catch2
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 2 días
-
catch_discover_tests passes all EXTRA_ARGS as one argumentPosiblemente ocupada @CyberKun la tomó hace 11 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
catchorg/Catch2#3239 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Not seeing some error messages from fakeit in jetbrains riderPosiblemente ocupada @Amanpal9 la tomó hace 21 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
catchorg/Catch2#3228 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
catch_discover_tests fails for Emscripten/WASM tests since v3.16.0Posiblemente ocupada @nafiurahman00 la tomó hace 8 días. AbiertoExtras
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
catchorg/Catch2#3241 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 2 días
Todos los issues de catchorg/Catch2
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
cp-algorithms/cp-algorithms#1774 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
telefonicaid/fiware-orion#4836 ·
Los mantenedores suelen responder en 1 día
-
nixd exits at startup when its parent process belongs to another userPosiblemente ocupada @conao3 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nix-community/nixd#930 ·
Los mantenedores suelen responder en 2 días
-
refactor topic-ui topic-weather
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Command-Install Needs-Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
microsoft/winget-cli#6718 ·
Los mantenedores suelen responder en 2 días