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. ERROR: copy relocation against non-copyable protected symbol
Forum Updated to NodeBB v4.3 + New Features

ERROR: copy relocation against non-copyable protected symbol

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 2.9k Views 2 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.
  • O Offline
    O Offline
    ochurlaud
    wrote on last edited by ochurlaud
    #1

    I am porting Cantata from Qt5 to Qt6.

    At the end of the compilation, the linking fails with this error:

    /usr/bin/ld: support/libsupport.a(acceleratormanager.cpp.o): copy relocation against non-copyable protected symbol `_ZN9QComboBox16staticMetaObjectE@@Qt_6' in /usr/lib/libQt6Widgets.so.6.6.2
    collect2: error: ld returned 1 exit status
    

    I have no idea of what can raise this kind of error (removing traces of QComboBox in the cpp file fixes this error but get me another "copy relocation against..." for another file and other symbol).

    Thank you for your insight!

    I'm building cantata on an up-to-date archlinux laptop.
    In case it's needed, the changes are here: https://github.com/fenuks/cantata/pull/1

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      From a quick search, it seems you would need to build your code with the -fPIC option enabled.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      O 1 Reply Last reply
      2
      • Christian EhrlicherC Christian Ehrlicher referenced this topic on
      • SGaistS SGaist

        Hi,

        From a quick search, it seems you would need to build your code with the -fPIC option enabled.

        O Offline
        O Offline
        ochurlaud
        wrote on last edited by ochurlaud
        #3

        @SGaist Thank you for the proposition. I made this change and it raised a lot of other issues :

        <SNIP>
         Building CXX object replaygain/CMakeFiles/cantata-replaygain.dir/__/support/thread.cpp.o
        [ 98%] Linking CXX executable ../cantata-replaygain
        /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o: in function `FfmpegInput::~FfmpegInput()':
        ffmpeginput.cpp:(.text+0x328): undefined reference to `QBasicMutex::lockInternal()'
        /usr/bin/ld: ffmpeginput.cpp:(.text+0x339): undefined reference to `QBasicMutex::unlockInternal()'
        /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o: in function `FfmpegInput::isFloatCodec() const':
        ffmpeginput.cpp:(.text+0xbb0): undefined reference to `QString::fromLatin1(QByteArrayView)'
        /usr/bin/ld: ffmpeginput.cpp:(.text+0xc08): undefined reference to `QString::endsWith(QLatin1String, Qt::CaseSensitivity) const'
        /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o: in function `FfmpegInput::FfmpegInput(QString const&)':
        ffmpeginput.cpp:(.text+0xd9c): undefined reference to `QString::toLocal8Bit_helper(QChar const*, long long)'
        /usr/bin/ld: ffmpeginput.cpp:(.text+0x10f8): undefined reference to `QBasicMutex::lockInternal()'
        /usr/bin/ld: ffmpeginput.cpp:(.text+0x110b): undefined reference to `QByteArray::_empty'
        /usr/bin/ld: ffmpeginput.cpp:(.text+0x113f): undefined reference to `QString::fromLatin1(QByteArrayView)'
        /usr/bin/ld: ffmpeginput.cpp:(.text+0x11ca): undefined reference to `QString::fromLatin1(QByteArrayView)'
        /usr/bin/ld: ffmpeginput.cpp:(.text+0x1229): undefined reference to `QString::append(QString const&)'
        /usr/bin/ld: ffmpeginput.cpp:(.text+0x12a3): undefined reference to `QString::toLatin1_helper(QString const&)'
        /usr/bin/ld: ffmpeginput.cpp:(.text+0x14ae): undefined reference to `QByteArray::_empty'
        /usr/bin/ld: ffmpeginput.cpp:(.text+0x14d8): undefined reference to `QBasicMutex::unlockInternal()'
        /usr/bin/ld: ffmpeginput.cpp:(.text+0x14ee): undefined reference to `QBasicMutex::unlockInternal()'
        /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o: in function `FfmpegInput::readFrames()':
        ffmpeginput.cpp:(.text+0x16b0): undefined reference to `QByteArray::QByteArray(char const*, long long)'
        /usr/bin/ld: ffmpeginput.cpp:(.text+0x1b9b): undefined reference to `QByteArray::_empty'
        /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o: in function `FfmpegInput::FfmpegInput(QString const&)':
        ffmpeginput.cpp:(.text+0x13dc): undefined reference to `QBasicMutex::unlockInternal()'
        /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o: in function `QMutex::~QMutex()':
        ffmpeginput.cpp:(.text._ZN6QMutexD2Ev[_ZN6QMutexD5Ev]+0x15): undefined reference to `QBasicMutex::destroyInternal(QMutexPrivate*)'
        /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o: in function `FfmpegInput::~FfmpegInput() [clone .cold]':
        ffmpeginput.cpp:(.text.unlikely+0x14): undefined reference to `qt_assert(char const*, char const*, int)'
        /usr/bin/ld: ffmpeginput.cpp:(.text.unlikely+0x2c): undefined reference to `qt_assert(char const*, char const*, int)'
        /usr/bin/ld: ffmpeginput.cpp:(.text.unlikely+0x44): undefined reference to `qt_assert(char const*, char const*, int)'
        /usr/bin/ld: ffmpeginput.cpp:(.text.unlikely+0x5c): undefined reference to `qt_assert(char const*, char const*, int)'
        /usr/bin/ld: ffmpeginput.cpp:(.text.unlikely+0x74): undefined reference to `qt_assert(char const*, char const*, int)'
        /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o:ffmpeginput.cpp:(.text.unlikely+0x8c): more undefined references to `qt_assert(char const*, char const*, int)' follow
        /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o: in function `FfmpegInput::readFrames() [clone .cold]':
        ffmpeginput.cpp:(.text.unlikely+0x32c): undefined reference to `qt_assert_x(char const*, char const*, char const*, int)'
        /usr/bin/ld: ffmpeginput.cpp:(.text.unlikely+0x344): undefined reference to `qt_assert(char const*, char const*, int)'
        /usr/bin/ld: ffmpeginput.cpp:(.text.unlikely+0x35c): undefined reference to `qt_assert(char const*, char const*, int)'
        /usr/bin/ld: ffmpeginput.cpp:(.text.unlikely+0x37b): undefined reference to `qt_assert_x(char const*, char const*, char const*, int)'
        <SNIP>
        

        it does not seem better

        JonBJ 1 Reply Last reply
        0
        • O ochurlaud

          @SGaist Thank you for the proposition. I made this change and it raised a lot of other issues :

          <SNIP>
           Building CXX object replaygain/CMakeFiles/cantata-replaygain.dir/__/support/thread.cpp.o
          [ 98%] Linking CXX executable ../cantata-replaygain
          /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o: in function `FfmpegInput::~FfmpegInput()':
          ffmpeginput.cpp:(.text+0x328): undefined reference to `QBasicMutex::lockInternal()'
          /usr/bin/ld: ffmpeginput.cpp:(.text+0x339): undefined reference to `QBasicMutex::unlockInternal()'
          /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o: in function `FfmpegInput::isFloatCodec() const':
          ffmpeginput.cpp:(.text+0xbb0): undefined reference to `QString::fromLatin1(QByteArrayView)'
          /usr/bin/ld: ffmpeginput.cpp:(.text+0xc08): undefined reference to `QString::endsWith(QLatin1String, Qt::CaseSensitivity) const'
          /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o: in function `FfmpegInput::FfmpegInput(QString const&)':
          ffmpeginput.cpp:(.text+0xd9c): undefined reference to `QString::toLocal8Bit_helper(QChar const*, long long)'
          /usr/bin/ld: ffmpeginput.cpp:(.text+0x10f8): undefined reference to `QBasicMutex::lockInternal()'
          /usr/bin/ld: ffmpeginput.cpp:(.text+0x110b): undefined reference to `QByteArray::_empty'
          /usr/bin/ld: ffmpeginput.cpp:(.text+0x113f): undefined reference to `QString::fromLatin1(QByteArrayView)'
          /usr/bin/ld: ffmpeginput.cpp:(.text+0x11ca): undefined reference to `QString::fromLatin1(QByteArrayView)'
          /usr/bin/ld: ffmpeginput.cpp:(.text+0x1229): undefined reference to `QString::append(QString const&)'
          /usr/bin/ld: ffmpeginput.cpp:(.text+0x12a3): undefined reference to `QString::toLatin1_helper(QString const&)'
          /usr/bin/ld: ffmpeginput.cpp:(.text+0x14ae): undefined reference to `QByteArray::_empty'
          /usr/bin/ld: ffmpeginput.cpp:(.text+0x14d8): undefined reference to `QBasicMutex::unlockInternal()'
          /usr/bin/ld: ffmpeginput.cpp:(.text+0x14ee): undefined reference to `QBasicMutex::unlockInternal()'
          /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o: in function `FfmpegInput::readFrames()':
          ffmpeginput.cpp:(.text+0x16b0): undefined reference to `QByteArray::QByteArray(char const*, long long)'
          /usr/bin/ld: ffmpeginput.cpp:(.text+0x1b9b): undefined reference to `QByteArray::_empty'
          /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o: in function `FfmpegInput::FfmpegInput(QString const&)':
          ffmpeginput.cpp:(.text+0x13dc): undefined reference to `QBasicMutex::unlockInternal()'
          /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o: in function `QMutex::~QMutex()':
          ffmpeginput.cpp:(.text._ZN6QMutexD2Ev[_ZN6QMutexD5Ev]+0x15): undefined reference to `QBasicMutex::destroyInternal(QMutexPrivate*)'
          /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o: in function `FfmpegInput::~FfmpegInput() [clone .cold]':
          ffmpeginput.cpp:(.text.unlikely+0x14): undefined reference to `qt_assert(char const*, char const*, int)'
          /usr/bin/ld: ffmpeginput.cpp:(.text.unlikely+0x2c): undefined reference to `qt_assert(char const*, char const*, int)'
          /usr/bin/ld: ffmpeginput.cpp:(.text.unlikely+0x44): undefined reference to `qt_assert(char const*, char const*, int)'
          /usr/bin/ld: ffmpeginput.cpp:(.text.unlikely+0x5c): undefined reference to `qt_assert(char const*, char const*, int)'
          /usr/bin/ld: ffmpeginput.cpp:(.text.unlikely+0x74): undefined reference to `qt_assert(char const*, char const*, int)'
          /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o:ffmpeginput.cpp:(.text.unlikely+0x8c): more undefined references to `qt_assert(char const*, char const*, int)' follow
          /usr/bin/ld: CMakeFiles/cantata-replaygain.dir/ffmpeginput.cpp.o: in function `FfmpegInput::readFrames() [clone .cold]':
          ffmpeginput.cpp:(.text.unlikely+0x32c): undefined reference to `qt_assert_x(char const*, char const*, char const*, int)'
          /usr/bin/ld: ffmpeginput.cpp:(.text.unlikely+0x344): undefined reference to `qt_assert(char const*, char const*, int)'
          /usr/bin/ld: ffmpeginput.cpp:(.text.unlikely+0x35c): undefined reference to `qt_assert(char const*, char const*, int)'
          /usr/bin/ld: ffmpeginput.cpp:(.text.unlikely+0x37b): undefined reference to `qt_assert_x(char const*, char const*, char const*, int)'
          <SNIP>
          

          it does not seem better

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @ochurlaud
          Does your ld link line include the necessary Qt libraries? Do you want to show that line?

          O 1 Reply Last reply
          0
          • JonBJ JonB

            @ochurlaud
            Does your ld link line include the necessary Qt libraries? Do you want to show that line?

            O Offline
            O Offline
            ochurlaud
            wrote on last edited by
            #5

            I found a add_target_link error in one of the sub-folder CMakeLists.txt file... Stupid me.

            Compiles better now.

            Could someone explain why the new flag -fPIC is needed in Qt6 and was not in Qt5? And is not needed in other projects ? Thx.

            It's otherwise resolved.

            1 Reply Last reply
            0
            • O ochurlaud has marked this topic as solved on

            • Login

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