Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem linking on Linux using CMake
Forum Updated to NodeBB v4.3 + New Features

Problem linking on Linux using CMake

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 211 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Perdrix
    wrote on 9 Dec 2024, 10:37 last edited by Perdrix 12 Sept 2024, 13:32
    #1

    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

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SamiV123
      wrote on 9 Dec 2024, 19:17 last edited by SamiV123 12 Sept 2024, 19:17
      #2

      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.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Perdrix
        wrote on 9 Dec 2024, 20:25 last edited by
        #3

        None of the above

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Perdrix
          wrote on 10 Dec 2024, 09:36 last edited by
          #4

          This is https://bugreports.qt.io/browse/QTBUG-130056

          Removing setting of CMAKE_AUTORCC fixed this

          1 Reply Last reply
          0

          1/4

          9 Dec 2024, 10:37

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved