On 7/28/2015 8:49 AM, Ruben Van Boxem wrote:
> 2015-07-28 14:44 GMT+02:00 Edward Diener <[email protected]
> <mailto:[email protected]>>:
>
>     On 7/28/2015 8:27 AM, Edward Diener wrote:
>      > Without trying immediately to give specific code for what is a large
>      > project, I am getting linker errors when trying to link a second
>     shared
>      > library which depends on a first shared library that has linked
>      > successfully. The errors are:
>      >
>      >
>     
> xml_wgrammar.o:xml_wgrammar.cpp:(.rdata$_ZTVN5boost7archive21xml_archive_exceptionE[__ZTVN5boost7archive21xml_archive_exceptionE]+0x20):
>      > undefined reference to `virtual thunk to
>      > boost::archive::archive_exception::what() const'
>      >
>     
> xml_wgrammar.o:xml_wgrammar.cpp:(.rdata$_ZTCN5boost7archive21xml_archive_exceptionE4_NS0_17archive_exceptionE[__ZTCN5boost7archive21xml_archive_exceptionE4_NS0_17archive_exceptionE]+0x38):
>      > undefined reference to `virtual thunk to
>      > boost::archive::archive_exception::what() const'
>      > collect2.exe: error: ld returned 1 exit status
>      >
>      > The xml_wgrammar.o file is being linked into the second shared
>     library.
>      > The xml_wgrammar.cpp file includes xml_archive_exception.hpp. The
>      > xml_archive_exception.hpp includes and derives from
>      > archive_exception.hpp. Both xml_archive_exception and
>     archive_exception
>      > have their implementation in the first shared library and have their
>      > necessary implementations exported. The implementation of
>      > archive_exception::what() is exported in the first shared library
>     and is
>      > imported when seen by xml_wgrammar.cpp.
>      >
>      > What is so strange is that there is no call to
>     archive_exception::what()
>      > in the preprocessed output of xml_wgrammar.cpp.
>      >
>      > Does anybody have any idea what might be going on here before I
>     take the
>      > time to reduce this situation into a short enough fragment to
>     show in a
>      > subsequent thread in this post ?
>
>     After adding an xml_archive_exception::what() implementation which just
>     calls its base class archive_exception::what() implementation I now
>     receive the linker errors:
>
>     xml_wgrammar.o: In function
>     `ZN5boost7archive21xml_archive_exceptionD1Ev':
>     xml_archive_exception.hpp:34: undefined reference to `vtable for
>     boost::archive::xml_archive_exception'
>     xml_archive_exception.hpp:34: undefined reference to `vtable for
>     boost::archive::xml_archive_exception'
>     xml_archive_exception.hpp:34: undefined reference to `vtable for
>     boost::archive::xml_archive_exception'
>     xml_archive_exception.hpp:34: undefined reference to `VTT for
>     boost::archive::xml_archive_exception'
>     collect2.exe: error: ld returned 1 exit status
>
>     Perhaps this will give someone an idea of what might be happening.
>
>
> You're not linking to the boost_serialization library. At least on my
> system (Linux) boost::archive::{xml_,}archive_exception::what() is
> defined there.

I am working to get the latest version of the Boost serialization 
library from source on Github to build under mingw-64/gcc-5.1 on 
Windows. I am now to the point where I can build the narrow character 
version of the library but when attempting to link the wide character 
version of the library, which depends on classes in the narrow character 
version of the library, I am encountering the errors in this post, as 
specified above. The linker line, from Boost build ( I have elided the 
full paths ), is:

g++ "-Wl,--out-implib,libboost_wserialization-mgw51-d-1_59.dll.a" -o 
"libboost_wserialization-mgw51-d-1_59.dll"  -shared -Wl,--start-group 
"basic_text_wiprimitive.o" "basic_text_woprimitive.o" "text_wiarchive.o" 
"text_woarchive.o" "utf8_codecvt_facet.o" "xml_wgrammar.o" 
"xml_wiarchive.o" "xml_woarchive.o" "codecvt_null.o" 
"libboost_serialization-mgw51-d-1_59.dll.a"  -Wl,-Bstatic  -Wl,-Bdynamic 
  -Wl,--end-group -g -march=i686 -m32

You can see that the I am linking in the boost serialization library 
when attempting to build the wide character version of the library.

>
> Add "-lboost_serialization" to your linker command or do the same
> through your build system.
> Note that Boost has #pragma lib ... to tell MSVC to link the required
> libraries. GCC does not have such a functionality.

Yes, I understand all that.



------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to