Opened 9 years ago
Last modified 9 years ago
#9472 new Bugs
Undocumented define causes header-only libraries to have link dependency on system
Reported by: | Owned by: | Beman Dawes | |
---|---|---|---|
Milestone: | To Be Determined | Component: | system |
Version: | Boost 1.55.0 | Severity: | Problem |
Keywords: | header-only | Cc: | soda@… |
Description
Code using the ASIO library must be linked with a boost binary lib, even though asio is considered 'header only' library.
Test system - ubuntu 13.10, using boost 1.55 download archive (not installed package).
Similar problem reported in ticket 7085. Suspect this is systemic.
Demo source code:
/* $ g++ -I. -Wall asio_link_fail.cpp -Wno-unused-local-typedefs /tmp/ccjgSD3Q.o: In function `__static_initialization_and_destruction_0(int, int)': asio_link_fail.cpp:(.text+0x50): undefined reference to `boost::system::generic_category()' asio_link_fail.cpp:(.text+0x5a): undefined reference to `boost::system::generic_category()' asio_link_fail.cpp:(.text+0x64): undefined reference to `boost::system::system_category()' /tmp/ccjgSD3Q.o: In function `boost::asio::error::get_system_category()': asio_link_fail.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[_ZN5boost4asio5error19get_system_categoryEv]+0x7): undefined reference to `boost::system::system_category()' collect2: error: ld returned 1 exit status */ #include "boost/asio.hpp" int main() { return 1; }
Change History (5)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Cc: | added |
---|---|
Component: | asio → Documentation |
Owner: | changed from | to
Summary: | ASIO library has link dependency, even though it claims to be header only → Undocumented define causes header-only libraries to have link dependency on system |
Fixed by adding:
#define BOOST_ERROR_CODE_HEADER_ONLY
before including boost headers.
Given that this undocumented feature appears to work properly now (outstanding bug seems to have been recently fixed), said feature should probably be documented.
Not the problem of ASIO module owner. Changing to documentation.
comment:3 by , 9 years ago
You should change it to the module which you think it should be documented in. The documentation category isn't for individual library documentation.
comment:4 by , 9 years ago
It's a system-wide setting that affects at least two modules (asio and threads), and probably quite a few more than that. The setting appears to work, it just needs to be included in the various docs on building/linking/header only libraries. Perhaps the 'system' module? I don't know enough about how this project is structured to know where it should go.
comment:5 by , 9 years ago
Component: | Documentation → system |
---|---|
Owner: | changed from | to
It should be documented in System library.
Verified failure in 131204 trunk as well.