Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Mingw32 Compiling an open source project "undefined referece to .. cxx11_basic_str"
Qt 6.12 LTS is out! See what's new in the release blog

Mingw32 Compiling an open source project "undefined referece to .. cxx11_basic_str"

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 1.7k 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
    pjared
    wrote on last edited by pjared
    #1

    First post, so I hope i'm doing this correctly

    System: Windows 10, Qt Widgets application, QMake

    I am currently trying to add an open source project. The code can be found https://github.com/mit-nlp/MITIE.

    I have built the library by:
    Ubuntu WSL running make.
    CMake GUI, Powershell with mingw32-make. I compiled with with the same gcc, g++, and mingw32-make that I am using in my project (located in my /Qt/Tools directory). I also used the CMake gui in the Qt tools.
    (Like so)
    cmdRun.PNG

    When I use the "add library" feature to point to the library files, the library will connect. It can recognize header files within the project.

    However, when I build or run the code, I get the following errors:
    buildErrors.PNG

    I've spent about 25 hours trying/reading posts to do this, so I have some possible input to the solutions (however I am completely lost):
    The undefined reference is due to a mismatch of strings, namely the compiled cxx11 strings. I was confused that even though I used the same gcc and g++ files that this happened. I feel that this is the real problem, however I am stuck on how to solve this.

    I am trying to create a wrapper using the Facade pattern to use MITIE from my Project. I set up two different libraries for testing, a shared and static. The shared library runs into the problems when building. The static library built my wrapper fine, but when I went to test it I ran into the same build problem (that little time when I thought it worked was a nice relief, but it was not too long before I realized that it was not working)
    It will also build in other sub directory projects, but when I go to run I will get the "undefined reference"

    So hopefully this post was informative enough to give you an overview of the problem.

    Here is my cmake gui file, in case there is something that i'm missing
    CMake.PNG

    jsulmJ 1 Reply Last reply
    0
    • P pjared

      First post, so I hope i'm doing this correctly

      System: Windows 10, Qt Widgets application, QMake

      I am currently trying to add an open source project. The code can be found https://github.com/mit-nlp/MITIE.

      I have built the library by:
      Ubuntu WSL running make.
      CMake GUI, Powershell with mingw32-make. I compiled with with the same gcc, g++, and mingw32-make that I am using in my project (located in my /Qt/Tools directory). I also used the CMake gui in the Qt tools.
      (Like so)
      cmdRun.PNG

      When I use the "add library" feature to point to the library files, the library will connect. It can recognize header files within the project.

      However, when I build or run the code, I get the following errors:
      buildErrors.PNG

      I've spent about 25 hours trying/reading posts to do this, so I have some possible input to the solutions (however I am completely lost):
      The undefined reference is due to a mismatch of strings, namely the compiled cxx11 strings. I was confused that even though I used the same gcc and g++ files that this happened. I feel that this is the real problem, however I am stuck on how to solve this.

      I am trying to create a wrapper using the Facade pattern to use MITIE from my Project. I set up two different libraries for testing, a shared and static. The shared library runs into the problems when building. The static library built my wrapper fine, but when I went to test it I ran into the same build problem (that little time when I thought it worked was a nice relief, but it was not too long before I realized that it was not working)
      It will also build in other sub directory projects, but when I go to run I will get the "undefined reference"

      So hopefully this post was informative enough to give you an overview of the problem.

      Here is my cmake gui file, in case there is something that i'm missing
      CMake.PNG

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @pjared Did you add mitie::ner_trainer lib properly? Was this lib built using same compiler as you're using for your Qt project?

      P 1 Reply Last reply
      0
      • jsulmJ jsulm

        @pjared Did you add mitie::ner_trainer lib properly? Was this lib built using same compiler as you're using for your Qt project?

        P Offline
        P Offline
        pjared
        wrote on last edited by
        #3

        @jsulm said in Mingw32 Compiling an open source project "undefined referece to .. cxx11_basic_str":

        mitie::ner_trainer

        As for adding ner_trainer, I have tried using both a static and dynamic library
        addingLib.PNG

        Mingw32 Is generating a .dll and .dll.a, so i've been adding the .a file

        As for the compilers, I have made sure that i'm using the same compilers that my project has been run on
        Kit.PNG

        Compilers.PNG

        I point the cmake to the same /tools file

        jsulmJ 2 Replies Last reply
        0
        • P pjared

          @jsulm said in Mingw32 Compiling an open source project "undefined referece to .. cxx11_basic_str":

          mitie::ner_trainer

          As for adding ner_trainer, I have tried using both a static and dynamic library
          addingLib.PNG

          Mingw32 Is generating a .dll and .dll.a, so i've been adding the .a file

          As for the compilers, I have made sure that i'm using the same compilers that my project has been run on
          Kit.PNG

          Compilers.PNG

          I point the cmake to the same /tools file

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4
          This post is deleted!
          1 Reply Last reply
          0
          • P pjared

            @jsulm said in Mingw32 Compiling an open source project "undefined referece to .. cxx11_basic_str":

            mitie::ner_trainer

            As for adding ner_trainer, I have tried using both a static and dynamic library
            addingLib.PNG

            Mingw32 Is generating a .dll and .dll.a, so i've been adding the .a file

            As for the compilers, I have made sure that i'm using the same compilers that my project has been run on
            Kit.PNG

            Compilers.PNG

            I point the cmake to the same /tools file

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @pjared said in Mingw32 Compiling an open source project "undefined referece to .. cxx11_basic_str":

            Mingw32 Is generating a .dll and .dll.a, so i've been adding the .a file

            .a is static lib, use the dll.
            Also, post the whole build log here (please as text!), so we can see what happens.

            P 2 Replies Last reply
            0
            • jsulmJ jsulm

              @pjared said in Mingw32 Compiling an open source project "undefined referece to .. cxx11_basic_str":

              Mingw32 Is generating a .dll and .dll.a, so i've been adding the .a file

              .a is static lib, use the dll.
              Also, post the whole build log here (please as text!), so we can see what happens.

              P Offline
              P Offline
              pjared
              wrote on last edited by
              #6

              It was a little too large for the forums. I hope that you can view it here.
              https://pastebin.com/21cFyyKH

              1 Reply Last reply
              0
              • jsulmJ jsulm

                @pjared said in Mingw32 Compiling an open source project "undefined referece to .. cxx11_basic_str":

                Mingw32 Is generating a .dll and .dll.a, so i've been adding the .a file

                .a is static lib, use the dll.
                Also, post the whole build log here (please as text!), so we can see what happens.

                P Offline
                P Offline
                pjared
                wrote on last edited by
                #7

                @jsulm
                Through the research that i've been doing, I believe that it is an ABI mismatch.
                A similar problem is from this stack overflow, https://stackoverflow.com/questions/33394934/converting-std-cxx11string-to-stdstring . I have tried to implement the solutions but I'm not sure if i'm doing it correctly.

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

                  Another update. I compiled with the flag -Wabi-tag, and got the following errors:

                  warning: 'const string dlib::get_stack_trace()' inherits the "cxx11" ABI tag that 'const string' {aka 'const std::__cxx11::basic_string<char>'} (used in its return type) has [-Wabi-tag]
                  
                  C:/Qt6.2/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/basic_string.h:77:11: note: 'const string' {aka 'const std::__cxx11::basic_string<char>'} declared here
                       class basic_string
                  

                  Even if I compile with the flags, -D_GLIBCXX_USE_CXX11_ABI=1 OR -D_GLIBCXX_USE_CXX11_ABI=0, same bugs occur.

                  I am going to manually add #define D_GLIBCXX_USE_CXX11_ABI=1 to the header files and will post results.

                  Official GCC comment on dual ABI: https://gcc.gnu.org/onlinedocs/gcc-5.2.0/libstdc++/manual/manual/using_dual_abi.html

                  EDIT: Compiling the flags with either value results in the same error ("cx11").

                  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
                  • Unsolved