[filesystem] [system] Suddenly, dynamic linking by default

Hello list. I have a habit of tracking trunk to find out if there's any strangeness or mistakes done on the platforms I target. A while ago I encountered some strange linking errors on some of my projects, which in the end turned out to be because for some reason, Boost.Filesystem and Boost.System now attempt to be dynamically linked by default, both symbol-decoration-wise and auto-link filename-wise. I happened to have some older shared libraries from an older trunk version lying around, so they were suddenly and unexpectedly picked up instead of my fresh static libraries. Even without my library hygiene deficiencies, the decision (which I have yet to see a rationale or announcement about) will cause a lot of problems. Why is it that System/Filesystem suddenly default to dynamic linking? Are there problems about linking statically? Why are there then static libraries built at all? Is this just some personal preference of the author that goes contrary to the general approach of Boost? Such choices have _massive_ impacts on consumers of the code, they should not be made lightly and if there is a really concrete need to do so, why is it not documented and thoroughly explained? Linking dynamically requires you to deploy the Boost DLLs to the end user, which prevents any plugin-like deployment, as they tend to require a single self-contained shared library with no dependencies, which implies linking to a static language runtime of choice. Dynamic linking of Boost means that you need to share a CRT between the project and Boost, which implies that the only CRT choice is the dynamic one, which prevents many deployment scenarios, as you have to deploy _that_ as well to the end user, either as a redistributable install or as a private deployment. This also has an impact on code size, as there is no dead-code elimination possible when the code resides in a DLL, you have to ship _all_ of the library even if you use a few convenience functions. For one of my projects (an extension to a popular music player), this would inflate its size many times for each and every download, as the software is deployed as a single ZIP archive through automatic update services. Additionally, the autolink macros to force symbol decoration and linking for a static link are undocumented in the Boost.Config table [1], which explicitly states that all libraries that can be statically linked will be statically linked. There is no mention of libraries that arbitrarily decide to go dynamic, just that some libraries are only available in dynamic form. For future reference for anyone finding this in archives, the undocumented, and in this case required, macros to force a static link and symbol decoration are: BOOST_<WHATEVER>_STATIC_LINK or BOOST_ALL_STATIC_LINK [1] http://www.boost.org/doc/libs/1_49_0/libs/config/doc/html/index.html#boost_c... -- Lars Viklund | zao@acc.umu.se

on Sun Apr 29 2012, Lars Viklund <zao-AT-acc.umu.se> wrote:
Hello list.
I have a habit of tracking trunk to find out if there's any strangeness or mistakes done on the platforms I target.
A while ago I encountered some strange linking errors on some of my projects, which in the end turned out to be because for some reason, Boost.Filesystem and Boost.System now attempt to be dynamically linked by default, both symbol-decoration-wise and auto-link filename-wise.
Have you identified the source code change that caused this change in behavior? I'm just wondering if you're reporting it to the right place (e.g., maybe the boost-build list needs to hear about it). -- Dave Abrahams BoostPro Computing http://www.boostpro.com

Dave Abrahams wrote:
on Sun Apr 29 2012, Lars Viklund <zao-AT-acc.umu.se> wrote:
Hello list.
I have a habit of tracking trunk to find out if there's any strangeness or mistakes done on the platforms I target.
A while ago I encountered some strange linking errors on some of my projects, which in the end turned out to be because for some reason, Boost.Filesystem and Boost.System now attempt to be dynamically linked by default, both symbol-decoration-wise and auto-link filename-wise.
Have you identified the source code change that caused this change in behavior? I'm just wondering if you're reporting it to the right place (e.g., maybe the boost-build list needs to hear about it).
I believe Lars reported to the right place as his problems are the result of configuration changes in Boost.Filesystem and Boost.System which break backwards compatibility for users (it does for me as well, btw). The changes to Boost.System affect other libraries as well (all libraries depending on Boost.System). These changes are unrelated to Boost.Build as they affect users while building _their_ code. Regards Hartmut --------------- http://boost-spirit.com http://stellar.cct.lsu.edu

On Sun, Apr 29, 2012 at 09:53:31AM -0400, Dave Abrahams wrote:
on Sun Apr 29 2012, Lars Viklund <zao-AT-acc.umu.se> wrote:
A while ago I encountered some strange linking errors on some of my projects, which in the end turned out to be because for some reason, Boost.Filesystem and Boost.System now attempt to be dynamically linked by default, both symbol-decoration-wise and auto-link filename-wise.
Have you identified the source code change that caused this change in behavior? I'm just wondering if you're reporting it to the right place (e.g., maybe the boost-build list needs to hear about it).
I have been travelling all of April, but it's most probably a few weeks old as I detected the first symptoms of it before heading out, back when I assumed it was a problem with a recent change of platform in my code. No other library that this codebase currently autolinks [1] exhibits this behaviour, just System and Filesystem. I do not believe that this is appropriate for boost-build@, as this is all about how the library instructs the headers responsible for symbol decoration and autolinking, not anything that Boost.Build does. [1] BOOST_LIB_DIAGNOSTIC says: Linking to lib file: boost_system-vc90-mt-gd-1_50.lib Linking to lib file: libboost_date_time-vc90-mt-gd-1_50.lib Linking to lib file: libboost_regex-vc90-mt-gd-1_50.lib Linking to lib file: boost_filesystem-vc90-mt-gd-1_50.lib Linking to lib file: libboost_thread-vc90-mt-gd-1_50.lib Linking to lib file: libboost_chrono-vc90-mt-gd-1_50.lib -- Lars Viklund | zao@acc.umu.se

Le 29/04/12 15:05, Lars Viklund a écrit :
Additionally, the autolink macros to force symbol decoration and linking for a static link are undocumented in the Boost.Config table [1], which explicitly states that all libraries that can be statically linked will be statically linked. There is no mention of libraries that arbitrarily decide to go dynamic, just that some libraries are only available in dynamic form.
For future reference for anyone finding this in archives, the undocumented, and in this case required, macros to force a static link and symbol decoration are: BOOST_<WHATEVER>_STATIC_LINK or BOOST_ALL_STATIC_LINK
[1] http://www.boost.org/doc/libs/1_49_0/libs/config/doc/html/index.html#boost_c...
Hi, instead of documenting these macros, I will prefer that the the libraries authors that are using _STATIC_LINK follows the protocol as defined in Boost.Config. Best, Vicente

On Sun, Apr 29, 2012 at 9:05 AM, Lars Viklund <zao@acc.umu.se> wrote:
Hello list.
I have a habit of tracking trunk to find out if there's any strangeness or mistakes done on the platforms I target.
A while ago I encountered some strange linking errors on some of my projects, which in the end turned out to be because for some reason, Boost.Filesystem and Boost.System now attempt to be dynamically linked by default, both symbol-decoration-wise and auto-link filename-wise.
Ouch! 1.49.0 had a problem with static linking on Windows, and in fixing that I screwed up the default. The problem has (hopefully) been fixed in trunk, and a test added to verify the default is correct. Thanks for the report. Please let me know if it isn't work correctly for you. --Beman

On Mon, Apr 30, 2012 at 11:02:32AM -0400, Beman Dawes wrote:
Ouch! 1.49.0 had a problem with static linking on Windows, and in fixing that I screwed up the default.
The problem has (hopefully) been fixed in trunk, and a test added to verify the default is correct.
It indeed seems that by r78273, static linking is preferred by default again. I had a false negative first thanks to ryppl/boost-svn not being quite up to date, but with the proper SVN repository, all is well. -- Lars Viklund | zao@acc.umu.se
participants (5)
-
Beman Dawes
-
Dave Abrahams
-
Hartmut Kaiser
-
Lars Viklund
-
Vicente J. Botet Escriba