Problem linking on Linux using CMake
-
wrote on 9 Dec 2024, 10:37 last edited by Perdrix 12 Sept 2024, 13:32
I'm getting these errors from the link step when I try to build using CMake (Qt 6.8.0):
/usr/bin/ld: DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/DeepSkyStacker_autogen/4COPAEF2SH/qrc_DeepSkyStacker_translations.cpp.o (symbol from plugin): in function `qInitResources_DeepSkyStacker_translations()': (.text+0x0): multiple definition of `qInitResources_DeepSkyStacker_translations()'; DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/__/.qt/rcc/qrc_DeepSkyStacker_translations.cpp.o (symbol from plugin):(.text+0x0): first defined here /usr/bin/ld: DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/DeepSkyStacker_autogen/4COPAEF2SH/qrc_DeepSkyStacker_translations.cpp.o (symbol from plugin): in function `qInitResources_DeepSkyStacker_translations()': (.text+0x0): multiple definition of `qCleanupResources_DeepSkyStacker_translations()'; DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/__/.qt/rcc/qrc_DeepSkyStacker_translations.cpp.o (symbol from plugin):(.text+0x0): first defined here
In my CMakeLists.txt I have:
qt_add_executable(DeepSkyStacker ${ALL_FILES}) qt_standard_project_setup(I18N_TRANSLATED_LANGUAGES ca cs de es fr it ja_JP nl pt_BR ro ru tr zh_CN zh_TW) qt_add_translations(${PROJECT_NAME} PLURALS_TS_FILE en TS_FILE_DIR i18n)
During the build I see:
119/168] Automatic MOC and UIC for target DeepSkyStacker [120/168] Automatic RCC for resources.qrc [121/168] Automatic RCC for ../.qt/rcc/DeepSkyStacker_translations.qrc [122/168] Building CXX object DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/__/.qt/rcc/qrc_DeepSkyStacker_translations.cpp.o [123/168] Building CXX object DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/cmake_pch.hxx.gch : : [166/168] Building CXX object DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/DeepSkyStacker_autogen/4COPAEF2SH/qrc_DeepSkyStacker_translations.cpp.o [167/168] Building CXX object DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/DeepSkyStacker_autogen/EWIEGA46WW/qrc_resources.cpp.o
So it looks like it is generating TWO qrc files for the translation files? !!!
I can post the full CMakeLists.txt file if needed but it's not small ...
Puzzled
David -
wrote on 9 Dec 2024, 19:17 last edited by SamiV123 12 Sept 2024, 19:17
Maybe you have some function definition in a header file or you're including the same translation unit multiple times in your build target's sources.
-
wrote on 9 Dec 2024, 20:25 last edited by
None of the above
-
wrote on 10 Dec 2024, 09:36 last edited by
This is https://bugreports.qt.io/browse/QTBUG-130056
Removing setting of CMAKE_AUTORCC fixed this
1/4