Bug 702843 - expand not defined everywhere it needs to be
Summary: expand not defined everywhere it needs to be
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: wfmath
Version: 15
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Bruno Wolff III
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 551174 674174
TreeView+ depends on / blocked
 
Reported: 2011-05-07 16:36 UTC by Bruno Wolff III
Modified: 2011-05-15 14:45 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-15 14:45:39 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Bruno Wolff III 2011-05-07 16:36:45 UTC
Description of problem:

I can build wfmath 0.3.11 on f14, but not f15.
When linking the vector test as part of the build I see the following error:
./.libs/libwfmath-0.3.so: undefined reference to `WFMath::_Poly2Orient<3>::expand(WFMath::Point<3> const&, WFMath::Point<2>&, double)'

As far as I can tell that function should be defined in the library. I am not real proficient in c++ so it may be that the code isn't valid and works with earlier versions of g++ by luck.

Version-Release number of selected component (if applicable):
gcc-4.6.0-6.fc15.i686

How reproducible:
100%

Steps to Reproduce:
1. fedpkg clone wfmath
2. cd wfmath
3. fedpkg scratch-build

To see it work with older gcc use:
4. fedpkg scratch-build --target dist-f14
  
Actual results:
http://koji.fedoraproject.org/koji/getfile?taskID=3056773&name=build.log

Expected results:

Successful build.

Comment 1 Bruno Wolff III 2011-05-09 17:14:33 UTC
I am still seeing this with gcc-4.6.0-7.fc15.

Comment 2 Jakub Jelinek 2011-05-10 08:30:43 UTC
I believe wfmath is buggy.
In polygon.h included by most sources there is:
template<const int dim>
class _Poly2Orient
{
public:
...
  bool expand(const Point<dim>& pd, Point<2>& p2, double epsilon = WFMATH_EPSILON);
...
};
but expand is only defined in polygon_funcs.h, which is only included in polygon.cpp:
template<const int dim>
bool _Poly2Orient<dim>::expand(const Point<dim>& pd, Point<2>& p2, double epsilon)
{
...
}
There is explicit instantiation in polygon.cpp just for:
template class Polygon<3>;
template Point<3> _Poly2Orient<3>::convert(const Point<2>& p) const;
template _Poly2Orient<3>& _Poly2Orient<3>::operator=(_Poly2Orient<3> const&);
template void _Poly2Orient<3>::rotate(RotMatrix<3> const&, Point<3> const&);

but not for expand (and others).  With g++ 4.5 you just were lucky that expand
has been compiled into polygon.o and not inlined, but even with 4.5 if you say
compile polygon.cpp with -O3 --param=max-inline-insns-auto=5000, wfmath will fail the same way.  In 4.6 it is partially inlined and thus not exported.

You should add:
template bool _Poly2Orient<3>::expand(const Point<3>&, Point<2>&, double);
to polygon.cpp (and similarly for others, really try -O3 --param=max-inline-insns-auto=10000 and see what breaks).

Comment 3 Bruno Wolff III 2011-05-10 12:48:58 UTC
Thanks for helping me out with this one, especially the suggested fixes!
I'll take you off the cc after this comment.

Comment 4 Bruno Wolff III 2011-05-15 14:45:39 UTC
A fixed version is building in rawhide.
Forcing instantiation of the needed instances worked.


Note You need to log in before you can comment on or make changes to this bug.