Opened 11 years ago

Last modified 10 years ago

#6010 reopened Bugs

Linkage problems in assignment.hpp

Reported by: nasos_i@… Owned by: David Bellot
Milestone: Boost 1.48.0 Component: uBLAS
Version: Boost 1.47.0 Severity: Problem
Keywords: Cc:

Description

Original report in uBlas mailing list:

Hi,

I started using ublas's "<<=" assignment, and I'm starting to regret it.
First symptom: if I compile with the gcc flag -Wmissing-prototypes I get the following warnings:

In file included from /Users/devernay/Development/stereocam/surf/CameraMatrixP.hpp:16,
                 from /Users/devernay/Development/stereocam/surf/TriFocalTensor/Trifocaltensor.hpp:18,
                 from /Users/devernay/Development/stereocam/surf/TriFocalTensor/TrifocaltensorBundleAdjustement.cpp:20:
/opt/local/include/boost/numeric/ublas/assignment.hpp:454: warning: no previous prototype for 'boost::numeric::ublas::begin1_manip boost::numeric::ublas::begin1()'
/opt/local/include/boost/numeric/ublas/assignment.hpp:498: warning: no previous prototype for 'boost::numeric::ublas::begin2_manip boost::numeric::ublas::begin2()'
/opt/local/include/boost/numeric/ublas/assignment.hpp:543: warning: no previous prototype for 'boost::numeric::ublas::next_row_manip boost::numeric::ublas::next_row()'
/opt/local/include/boost/numeric/ublas/assignment.hpp:587: warning: no previous prototype for 'boost::numeric::ublas::next_column_manip boost::numeric::ublas::next_column()'
/opt/local/include/boost/numeric/ublas/assignment.hpp:888: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_row_policy<boost::numeric::ublas::traverse_policy::wrap> boost::numeric::ublas::traverse_policy::by_row()'
/opt/local/include/boost/numeric/ublas/assignment.hpp:892: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_row_policy<boost::numeric::ublas::traverse_policy::wrap> boost::numeric::ublas::traverse_policy::by_row_wrap()'
/opt/local/include/boost/numeric/ublas/assignment.hpp:896: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_row_policy<boost::numeric::ublas::traverse_policy::no_wrap> boost::numeric::ublas::traverse_policy::by_row_no_wrap()'
/opt/local/include/boost/numeric/ublas/assignment.hpp:900: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_column_policy<boost::numeric::ublas::traverse_policy::wrap> boost::numeric::ublas::traverse_policy::by_column()'
/opt/local/include/boost/numeric/ublas/assignment.hpp:904: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_column_policy<boost::numeric::ublas::traverse_policy::wrap> boost::numeric::ublas::traverse_policy::by_column_wrap()'
/opt/local/include/boost/numeric/ublas/assignment.hpp:908: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_column_policy<boost::numeric::ublas::traverse_policy::no_wrap> boost::numeric::ublas::traverse_policy::by_column_no_wrap()'

But the second symptom is more critical: Since these symbols are defined in EVERY file that includes them, I cannot link anything and I get tons of "multiply defined symbols".

Looking at the file, I found out that:
- begin1(), begin2(), and a few others are not inlined, but conditionally inlined, using BOOST_UBLAS_INLINE (which inlines only if NDEBUG is defined), and are NOT members of classes, thus the multiply defined symbols...
- boost::numeric::ublas::traverse_policy::by_row() and other are just defined, and not inlined.

So, really, what's the solution?
Here's what I think:

BOOST_UBLAS_INLINE should ONY be used for class members, NOT for functions, which should be simply declared "inline".

by_row() and friends should either be inlined or declared as static members of an empty class.

I tried putting the magic word "inline" in front of each of these, and it works.

fred

Attachments (1)

assignment11102011.patch (1.8 KB ) - added by nasos_i@… 11 years ago.
assignment.hpp patch

Download all attachments as: .zip

Change History (7)

by nasos_i@…, 11 years ago

Attachment: assignment11102011.patch added

assignment.hpp patch

comment:1 by nasos_i@…, 11 years ago

assignment11102011.patch applies the suggested inlines on the non-template functions of assignment.hpp and seems it resolves the linkage problems.

comment:2 by David Bellot, 11 years ago

Owner: changed from Gunter to David Bellot
Status: newassigned

fixed

comment:3 by David Bellot, 11 years ago

Status: assignednew

comment:4 by David Bellot, 11 years ago

Resolution: fixed
Status: newclosed

comment:5 by jeremy.coulon@…, 10 years ago

Shouldn't it be fixed in Boost 1.48 ? This bug is still there in the latest Boost 1.50 ! It looks like the patch has not been applied.

comment:6 by jeremy.coulon@…, 10 years ago

Resolution: fixed
Status: closedreopened

Bug still there in 1.52.

Note: See TracTickets for help on using tickets.