Opened 10 years ago

Closed 10 years ago

#7347 closed Bugs (fixed)

duplicate symbol while BOOST_ERROR_CODE_HEADER_ONLY is defined

Reported by: viboes Owned by: Beman Dawes
Milestone: To Be Determined Component: system
Version: Boost 1.51.0 Severity: Problem
Keywords: Cc: viboes

Description

Even if BOOST_ERROR_CODE_HEADER_ONLY is not documented I wanted to report this defect.

When I define BOOST_ERROR_CODE_HEADER_ONLY building Boost.Thread I get the following error:

ld: duplicate symbol boost::system::system_category()     in ../../../bin.v2/libs/thread/build/darwin-4.2.1/debug/threading-multi/future.o and ../../../bin.v2/libs/thread/build/darwin-4.2.1/debug/threading-multi/pthread/thread.o for architecture x86_64
collect2: ld returned 1 exit status

    "g++" -dynamiclib -Wl,-single_module -install_name "libboost_thread.dylib"  -o "../../../bin.v2/libs/thread/build/darwin-4.2.1/debug/threading-multi/libboost_thread.dylib" "../../../bin.v2/libs/thread/build/darwin-4.2.1/debug/threading-multi/pthread/thread.o" "../../../bin.v2/libs/thread/build/darwin-4.2.1/debug/threading-multi/pthread/once.o" "../../../bin.v2/libs/thread/build/darwin-4.2.1/debug/threading-multi/future.o"      -headerpad_max_install_names -g

I guess that you need to declare the following functions inline.

    BOOST_SYSTEM_DECL const error_category &  system_category();
    BOOST_SYSTEM_DECL const error_category &  generic_category();

Attachments (2)

7347.patch (4.6 KB ) - added by viboes 10 years ago.
Simple patch that solves my issue. OK to commit?
7347_2.patch (1.9 KB ) - added by viboes 10 years ago.
Needed to run the Boost.Thread test if BOOST_ERROR_CODE_HEADER_ONLY is defined

Download all attachments as: .zip

Change History (6)

comment:1 by viboes, 10 years ago

Summary: BOOST_ERROR_CODE_HEADER_ONLYduplicate symbol while BOOST_ERROR_CODE_HEADER_ONLY is defined

by viboes, 10 years ago

Attachment: 7347.patch added

Simple patch that solves my issue. OK to commit?

comment:2 by viboes, 10 years ago

Cc: viboes added

by viboes, 10 years ago

Attachment: 7347_2.patch added

Needed to run the Boost.Thread test if BOOST_ERROR_CODE_HEADER_ONLY is defined

comment:3 by viboes, 10 years ago

The fact that the boost/../libs/system/src/error_code.cpp introduce too much symbols because of the using statements has as consequence.

test_7328.cpp: In function ‘void f()’:
test_7328.cpp:26: error: reference to ‘interrupted’ is ambiguous
test_7328.cpp:13: error: candidates are: bool interrupted
../../../boost/system/error_code.hpp:84: error:                 boost::system::errc::errc_t boost::system::errc::interrupted

The patch 7347_2 contribute to solve these issues.

Last edited 10 years ago by viboes (previous) (diff)

comment:4 by viboes, 10 years ago

Resolution: fixed
Status: newclosed

It seems to me that these patches have been applied without closing the ticket.

Note: See TracTickets for help on using tickets.