Boost.ProgramOptions dynamic linking on mingw

As noted at: http://engineering.meta-comm.com/boost-regression/CVS-HEAD/developer/output/... progopt library fails to link on mingw as dll. After some searching around, I found out that using -Wl,--enable-runtime-pseudo-reloc flag during linking, it works properly. However, one should be warned that this flag should not be used when some of the code isn't compiled with the same compiler (e.g. mixing dlls/binaries from different compilers) - the resulting binary will always crash. Alo

Alo Sarv wrote:
As noted at:
http://engineering.meta-comm.com/boost-regression/CVS-HEAD/developer/output/...
progopt library fails to link on mingw as dll. After some searching around, I found out that using -Wl,--enable-runtime-pseudo-reloc flag during linking, it works properly.
However, one should be warned that this flag should not be used when some of the code isn't compiled with the same compiler (e.g. mixing dlls/binaries from different compilers) - the resulting binary will always crash.
Thanks for looking into it! Two questions: 1. What does the flag do? 2. Somebody else reported successfull built with mingw. Do you know if this problem is specific to some version of mingw? - Volodya

Vladimir Prus wrote:
Alo Sarv wrote:
As noted at:
http://engineering.meta-comm.com/boost-regression/CVS-HEAD/developer/output/...
progopt library fails to link on mingw as dll. After some searching around, I found out that using -Wl,--enable-runtime-pseudo-reloc flag during linking, it works properly.
However, one should be warned that this flag should not be used when some of the code isn't compiled with the same compiler (e.g. mixing dlls/binaries from different compilers) - the resulting binary will always crash.
Thanks for looking into it!
Two questions: 1. What does the flag do? 2. Somebody else reported successfull built with mingw. Do you know if this problem is specific to some version of mingw?
I've checked that it's problem with mingw delivered with latest dev-cpp distribution. With "stand-alone" mingw version (20040916) it works fine. -- Janusz

On 7/18/05, Janusz Piwowarski <jpiw@go2.pl> wrote:
Vladimir Prus wrote:
Two questions: 1. What does the flag do? 2. Somebody else reported successfull built with mingw. Do you know if this problem is specific to some version of mingw?
I cannot find any documentation on the flag; the page where I found this fix is here: http://www.ogre3d.org/phpBB2/viewtopic.php?p=62249& There were several more references to this flag at: http://sourceforge.net/mailarchive/forum.php?thread_id=7643187&forum_id=5121 http://permalink.gmane.org/gmane.os.cygwin.patches/441 (cygwin-related) This issue seems to be specific to mingw 3.4+ versions - just few days ago there was an older mingw in the regression-test tables, and that one reported working fine (A 3.3-based version IIRC, but I can't be sure). A look into few days old regression-test tables could provide the exact mingw version which still worked. Here's a test / proof with mingw 3.4.2, boost CVS (few days old), on Win 2003 SP1: C:\boostcvs-src\libs\program_options\test>g++ -I c:\boostcvs\include\boost-1_33 -L c:\boostcvs\lib variable_map_test.cpp c:\boostcvs\lib\libboost_test_exec_monitor-mgw.lib -lboost_program_options-mgw-d -o test Info: resolving vtable for boost::program_options::variables_mapby linking to __imp___ZTVN5boost15program_options13variables_mapE (auto-import) Info: resolving vtable for boost::program_options::untyped_valueby linking to __imp___ZTVN5boost15program_options13untyped_valueE (auto-import) Info: resolving vtable for boost::program_options::value_semantic_codecvt_helper<char>by linking to __imp___ZTVN5boost15program_options29value_semantic_codecvt_helperIcEE (auto-import) Info: resolving boost::program_options::arg by linking to __imp___ZN5boost15program_options3argE (auto-import) Info: resolving vtable for boost::program_options::validation_errorby linking to __imp___ZTVN5boost15program_options16validation_errorE (auto-import) C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccYncaaa.o(.text$_ZN5boost15program_options13variables_mapD1Ev[boost::program_options::variables_map::~variables_map()]+0x3a):variable_map_test.cpp: variable 'vtable for boost::program_options::variables_map' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details. C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccYncaaa.o(.text$_ZN5boost15program_options13untyped_valueC1Eb[boost::program_options::untyped_value::untyped_value(bool)]+0x1c):variable_map_test.cpp: variable 'vtable for boost::program_options::untyped_value' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details. C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccYncaaa.o(.text$_ZN5boost15program_options29value_semantic_codecvt_helperIcEC2Ev[boost::program_options::value_semantic_codecvt_helper<char>::value_semantic_codecvt_helper()]+0x16):variable_map_test.cpp: variable 'vtable for boost::program_options::value_semantic_codecvt_helper<char>' can't be auto-imported. Please read the documentation forld's --enable-auto-import for details. C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccYncaaa.o(.text$_ZN5boost15program_options29value_semantic_codecvt_helperIcED2Ev[boost::program_options::value_semantic_codecvt_helper<char>::~value_semantic_codecvt_helper()]+0xb):variable_map_test.cpp: variable 'vtable for boost::program_options::value_semantic_codecvt_helper<char>' can't be auto-imported. Please read the documentation forld's --enable-auto-import for details. C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccYncaaa.o(.text$_ZN5boost15program_options16validation_errorD2Ev[boost::program_options::validation_error::~validation_error()]+0x3a):variable_map_test.cpp: variable 'vtable for boost::program_options::validation_error' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details. C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccYncaaa.o(.text$_ZN5boost15program_options16validation_errorC2ERKS1_[boost::program_options::validation_error::validation_error(boost::program_options::validation_error const&)]+0x53):variable_map_test.cpp: variable 'vtable for boost::program_options::validation_error' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details. C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccYncaaa.o(.text$_ZN5boost15program_options16validation_errorD1Ev[boost::program_options::validation_error::~validation_error()]+0x3a):variable_map_test.cpp: variable 'vtable for boost::program_options::validation_error' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details. C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccYncaaa.o(.text$_ZN5boost15program_options16validation_errorC1ERKSs[boost::program_options::validation_error::validation_error(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x53):variable_map_test.cpp: variable 'vtable for boost::program_options::validation_error' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details. collect2: ld returned 1 exit status C:\boostcvs-src\libs\program_options\test>g++ -I c:\boostcvs\include\boost-1_33 -L c:\boostcvs\lib variable_map_test.cpp c:\boostcvs\lib\libboost_test_exec_monitor-mgw.lib -lboost_program_options-mgw-d -o test -Wl,--enable-runtime-pseudo-reloc Info: resolving vtable for boost::program_options::variables_mapby linking to __imp___ZTVN5boost15program_options13variables_mapE (auto-import) Info: resolving vtable for boost::program_options::untyped_valueby linking to __imp___ZTVN5boost15program_options13untyped_valueE (auto-import) Info: resolving vtable for boost::program_options::value_semantic_codecvt_helper<char>by linking to __imp___ZTVN5boost15program_options29value_semantic_codecvt_helperIcEE (auto-import) Info: resolving boost::program_options::arg by linking to __imp___ZN5boost15program_options3argE (auto-import) Info: resolving vtable for boost::program_options::validation_errorby linking to __imp___ZTVN5boost15program_options16validation_errorE (auto-import) C:\boostcvs-src\libs\program_options\test>test Running 1 test case... *** No errors detected C:\boostcvs-src\libs\program_options\test>g++ -v Reading specs from c:/mingw/bin/../lib/gcc/mingw32/3.4.2/specs Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug Thread model: win32 gcc version 3.4.2 (mingw-special) Hope this helps, Alo

"Alo Sarv" <alo.sarv@gmail.com> wrote in message news:14a0620d050717003678007917@mail.gmail.com...
As noted at: http://engineering.meta-comm.com/boost-regression/CVS-HEAD/developer/output/...
progopt library fails to link on mingw as dll. After some searching around, I found out that using -Wl,--enable-runtime-pseudo-reloc flag during linking, it works properly.
Hum... Sounds like the problem that is affecting Boost.Filesystem on certain mingw builds. Could you see if that same flag allows the filesystem _dll tests to pass? Thanks, --Beman

On 7/23/05, Beman Dawes <bdawes@acm.org> wrote:
"Alo Sarv" <alo.sarv@gmail.com> wrote in message news:14a0620d050717003678007917@mail.gmail.com...
As noted at: http://engineering.meta-comm.com/boost-regression/CVS-HEAD/developer/output/...
progopt library fails to link on mingw as dll. After some searching around, I found out that using -Wl,--enable-runtime-pseudo-reloc flag during linking, it works properly.
Hum... Sounds like the problem that is affecting Boost.Filesystem on certain mingw builds. Could you see if that same flag allows the filesystem _dll tests to pass?
Tested by hand, had no effect on Boost.Filesystem mingw _dll builds - still failing. Alo

"Alo Sarv" <alo.sarv@gmail.com> wrote in message news:14a0620d050724031468595107@mail.gmail.com...
On 7/23/05, Beman Dawes <bdawes@acm.org> wrote:
"Alo Sarv" <alo.sarv@gmail.com> wrote in message news:14a0620d050717003678007917@mail.gmail.com...
As noted at: http://engineering.meta-comm.com/boost-regression/CVS-HEAD/developer/output/...
progopt library fails to link on mingw as dll. After some searching around, I found out that using -Wl,--enable-runtime-pseudo-reloc flag during linking, it works properly.
Hum... Sounds like the problem that is affecting Boost.Filesystem on certain mingw builds. Could you see if that same flag allows the filesystem _dll tests to pass?
Tested by hand, had no effect on Boost.Filesystem mingw _dll builds - still failing.
Thanks for trying. I guess just stick with static linking for the moment. --Beman
participants (4)
-
Alo Sarv
-
Beman Dawes
-
Janusz Piwowarski
-
Vladimir Prus