Boost logo

Boost-Build :

Subject: [Boost-build] Runtime-Link and windows/gcc
From: Artyom Beilis (artyomtnk_at_[hidden])
Date: 2011-07-25 03:14:23


Hello All, There is a problem with runtime-link options on mingw/gcc compiler for Windows, some gcc/mingw link by default with shared libraries (libgcc/libstdc++) and some versions with static ones. - Cygwin/gcc-cross-compiler - 4.5.3; default: shared link - tdm-gcc: 4.5.2; default: static link - Mingw-gcc 4.5.0 AFAIR: shared link More then that BB does not provide flags: -shared-libgcc and -shared-libstdc++ for case of shared runtime-link and -static-libgcc and -static-libstdc++ for case of static runtime-link. This makes it very problematic for DLL's build with gcc that may use difference instances of the runtime library. This is very critical to thous who for example accesses some global objects form DLL and main progam - which are very common in case of iostreams. Notice: not all gcc versions support -(static|shared)-lib(gcc|stdc++) however if they are not supported they just warn about them so I'd recommend: 1. Add -shared-libgcc and -shared-libstdc++ to both cxxflags and linkflags    for gcc/windows when runtime-link=shared 2. Add -static-libgcc and -static-libstdc++ to both cxxflags and linkflags    for gcc/windows when runtime-link=static And not rely on defaults. Also some gcc versions/builds may not honor these flags but this is the best we can do and it should work well with latest gcc compilers. I've added the shared flags in Boost.Locale mingw build because it is VERY critical for Boost.Locale to have correct runtime to be selected (because std::locale and iostream relate on global objects that Boost.Locale uses) But I think the solution should be global and not library specific. Artyom Beilis -------------- CppCMS - C++ Web Framework:  http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk