Mingw32 Compiling an open source project "undefined referece to .. cxx11_basic_str"
-
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)
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:
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
-
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)
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:
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
-
@pjared Did you add mitie::ner_trainer lib properly? Was this lib built using same compiler as you're using for your Qt project?
@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
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
I point the cmake to the same /tools file
-
@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
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
I point the cmake to the same /tools file
This post is deleted! -
@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
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
I point the cmake to the same /tools file
@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. -
@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.It was a little too large for the forums. I hope that you can view it here.
https://pastebin.com/21cFyyKH -
@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.@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. -
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_stringEven 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").