Problems binding buffer log 1_60 with MinGw on Windows 7

When upgrading to boost 1.60.0, some applications cannot communicate with boost log when building with MinGw 4.9.2 on Windows 7.

I get the following linker errors:

undefined reference to `_imp___ZN5boost3log9v2_mt_nt67trivial6logger3getEv' undefined reference to `_imp___ZN5boost3log9v2_mt_nt63aux15stream_providerIcE17allocate_compoundERNS1_6recordE' undefined reference to `_imp___ZN5boost3log9v2_mt_nt63aux25unhandled_exception_countEv' undefined reference to `_imp___ZN5boost3log9v2_mt_nt611record_view11public_data7destroyEPKS3_' bad reloc address 0x1 in section `.text$_ZNK5boost4asio5error6detail13misc_category4nameEv[__ZNK5boost4asio5error6detail13misc_category4nameEv]' 

Note: BOOST_LOG_DYN_LINK is determined by:

 g++ -c -pipe -fno-keep-inline-dllexport -Wall -Wextra -Wpedantic -Ofast -std=c++1y -frtti -fexceptions -mthreads -DUNICODE -DLOGGING_ENABLED -DNTDDI_VERSION=NTDDI_WIN7 -D_WIN32_WINNT=_WIN32_WINNT_WIN7 -DBOOST_THREAD_USE_LIB=1 -DBOOST_LOG_DYN_LINK=1 

The boost 1.60.0 build log file shows that both boost and boost log_setup files are created without any errors or warnings, including some of the files that it cannot link to, for example:

 gcc.compile.c++ bin.v2\libs\log\build\gcc-mingw-4.9.2\release\threading-multi\trivial.o gcc.compile.c++ bin.v2\libs\log\build\gcc-mingw-4.9.2\release\threading-multi\unhandled_exception_count.o 

Links to OK applications using boost 1.59.0 with MinGw 4.9.2 on Windows 7, as well as OK links using boost 1.60.0 with gcc 5.1.1 on Fedora 23.

boost asio has not changed since forcing 1.58.0. So, what has changed in increasing the log between boost 1.59.0 and boost 1.60.0 to cause MinGw to fail with Windows?

+2
source share
1 answer

Boost.Log was probably built with different parameters than your application, therefore it has a namespace with a named version. Look at the exported Dependency Walker characters and look at the description . I suspect that the difference will be in the OS component of the namespace API, since the configuration of the target version of Windows has changed to 1.60. You are building an application for Windows 7, while Boost.Log is most likely built for Windows XP.

When you make the difference, you need to fix the Boost build options and rebuild the Boost. For instance. to set the target version of Windows to 7, define BOOST_USE_WINAPI_VERSION - 0x0601 . If you do not want to change the version of Windows that Boost is configured for, you can define BOOST_USE_WINAPI_VERSION to 0x0501 when you create your application, indicating that you want Boost to keep XP targeting even if your application targets 7.

+4
source

Source: https://habr.com/ru/post/1270251/


All Articles