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. BOOST link problem related to the migration of Qt4 to Qt5 using MinGW on Windows
Forum Updated to NodeBB v4.3 + New Features

BOOST link problem related to the migration of Qt4 to Qt5 using MinGW on Windows

Scheduled Pinned Locked Moved General and Desktop
boostmigrationqt5.5linker errorswindows7desktopmingw32
11 Posts 3 Posters 6.3k 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.
  • C Claude

    I am doing the migrating from Qt4 to Qt5 using the compiler MinGW on Windows 7, and I get link errors with BOOST.

    Link Error:

    ..\libboost_serialization-mgw49-mt-s-1_59.a(archive_exception.o):-1: error: duplicate section `.rdata$_ZTSN5boost7archive17archive_exceptionE[__ZTSN5boost7archive17archive_exceptionE]' has different size

    I am using:

    Desktop Qt 5.5.0 MinGW 32bit
    The compiler is MinGW 4.9.2
    boost version 1.59

    I have compiled the boost library "serialization" with the same compiler as my Qt application.
    I have tried to use the same compiler options.

    I have not this problem with Qt4.

    Thanks for helping

    C Offline
    C Offline
    Claude
    wrote on last edited by
    #2

    @Claude I fixed my problem by using MinGW 4.8.2 32bit in order to compile both: Boost 1.59 and my application using Qt 5.5.0.

    I don't have the bug with the MinGW versions prior to the 4.8.2 version, but I have the bug with the 4.9.1 and 4.9.2 versions.

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

      Hi and welcome to devnet,

      That might come from a difference between the compiler options used to build boost and Qt.

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

      C 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        That might come from a difference between the compiler options used to build boost and Qt.

        C Offline
        C Offline
        Claude
        wrote on last edited by
        #4

        @SGaist I have tried re-compiling boost with the same default options generated by Qt for my application and I got the problem. Maybe, these options are different from the ones used to compile the Qt libraries, but I don't know these ones.

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

          You should be able to get that information from Qt's mkspec

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

          C 1 Reply Last reply
          0
          • SGaistS SGaist

            You should be able to get that information from Qt's mkspec

            C Offline
            C Offline
            Claude
            wrote on last edited by
            #6

            @SGaist Hi,

            I have replaced the boost library "serialization" by the QDataStream class and I have removed completely boost from my environment of development.

            I have activated the c++11/14 language by adding CONFIG += c++14 in my .pri file.

            I am using Qt5.5.0 with MinGW 4.9.2 32bit.
            This way, my application and the Qt libraries are compiled with the same compiler and the same compilation options, and I can get access to the new C++ features of c++11/14 instead of using boost.

            Also, by eliminating this boost dependence, I will be able to migrate to the next versions of Qt and to the next c++17 to be coming.

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

              Nice !

              Happy coding :)

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

              1 Reply Last reply
              0
              • P Offline
                P Offline
                piJar
                wrote on last edited by piJar
                #8

                Hi,
                Sorry for digging up this thread but I have the same problem with boost::serialization and MinGW.
                I want to port my software from Qt4.8 with MinGW 4.6 to the newest 5.5 MinGW 4.9+ but still with the boost::serialization in use. I have compiled boost libraries with compiler provided with Qt (4.9.2), but still got linker errors:

                ./release\xxx.o:xxx.cpp:(.text$_ZN5boost13serialization15throw_exceptionINS_7archive17archive_exceptionEEEvRKT_[__ZN5boost13serialization15throw_exceptionINS_7archive17archive_exceptionEEEvRKT_]+0x1d): undefined reference to `vtable for boost::archive::archive_exception'
                collect2.exe: error: ld returned 1 exit status
                

                Maybe someone came up with a solution for this tricky problem?

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

                  Hi and welcome to devnet,

                  Do you have boost built also in release mode ? For the same architecture ?

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

                  1 Reply Last reply
                  1
                  • P Offline
                    P Offline
                    piJar
                    wrote on last edited by
                    #10

                    Hello :)

                    As you suggested I putted my eye on architecture (build type was ok) and I found where the problem was. Well, a part of it at least :).
                    There were in fact two issues:

                    • a) wrong address model. Default boost build with mingw492 did a “address-model=32”, I had to change it to “address-model=32_64” explicit.
                    • b) wrong library type. I used a shared library so far. When I switched to static, it went smooth.

                    I can stand the a), but I’m wondering why the b) was the issue? I’m using bunch of other boost libraries from the same package in shared and there were no problems at all.

                    Anyway, for me we can call it "solved".

                    Thanks!

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

                      For b, check whether the library has other dependencies. You might be missing one.

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

                      1 Reply Last reply
                      0

                      • Login

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