Modify

Ticket #6010 (reopened Bugs)

Opened 3 years ago

Last modified 15 months ago

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

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

Change History

Changed 3 years ago by nasos_i@…

assignment.hpp patch

comment:1 Changed 3 years ago by nasos_i@…

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

comment:2 Changed 2 years ago by david.bellot

  • Owner changed from guwi17 to david.bellot
  • Status changed from new to assigned

fixed

comment:3 Changed 2 years ago by david.bellot

  • Status changed from assigned to new

comment:4 Changed 2 years ago by david.bellot

  • Status changed from new to closed
  • Resolution set to fixed

comment:5 Changed 22 months ago by jeremy.coulon@…

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 Changed 15 months ago by jeremy.coulon@…

  • Status changed from closed to reopened
  • Resolution fixed deleted

Bug still there in 1.52.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as reopened
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.