Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

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

    General and Desktop
    boost migration qt5.5 linker errors windows7 desktop mingw32
    3
    11
    5275
    Loading More Posts
    • 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 last edited by

      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 1 Reply Last reply Reply Quote 0
      • C
        Claude @Claude last edited by

        @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 Reply Quote 0
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          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 Reply Quote 0
          • C
            Claude @SGaist last edited by

            @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 Reply Quote 0
            • SGaist
              SGaist Lifetime Qt Champion last edited by

              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 Reply Quote 0
              • C
                Claude @SGaist last edited by

                @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 Reply Quote 0
                • SGaist
                  SGaist Lifetime Qt Champion last edited by

                  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 Reply Quote 0
                  • P
                    piJar last edited by piJar

                    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 Reply Quote 0
                    • SGaist
                      SGaist Lifetime Qt Champion last edited by

                      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 Reply Quote 1
                      • P
                        piJar last edited by

                        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 Reply Quote 0
                        • SGaist
                          SGaist Lifetime Qt Champion last edited by

                          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 Reply Quote 0
                          • First post
                            Last post