Bug 196127 - Fix math/qhull build with clang 3.5.0
Summary: Fix math/qhull build with clang 3.5.0
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Stephen Montgomery-Smith
URL:
Keywords:
Depends on:
Blocks: 195480
  Show dependency treegraph
 
Reported: 2014-12-19 14:33 UTC by Dimitry Andric
Modified: 2014-12-19 15:02 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (stephen)


Attachments
Fix math/qhull build with clang 3.5.0 (2.09 KB, patch)
2014-12-19 14:33 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2014-12-19 14:33:25 UTC
Created attachment 150764 [details]
Fix math/qhull build with clang 3.5.0

The math/qhull port fails to compile with clang 3.5.0, due to the following error:

In file included from /wrkdirs/usr/ports/math/qhull/work/qhull-2012.1/src/libqhullcpp/Coordinates.cpp:11:
/wrkdirs/usr/ports/math/qhull/work/qhull-2012.1/src/libqhullcpp/Coordinates.h:154:22: error: reference to 'random_access_iterator_tag' is ambiguous
        typedef std::random_access_iterator_tag  iterator_category;
                     ^
/usr/include/c++/v1/iterator:354:30: note: candidate found by name lookup is 'std::__1::random_access_iterator_tag'
struct _LIBCPP_TYPE_VIS_ONLY random_access_iterator_tag : public bidirectional_iterator_tag {};
                             ^
/wrkdirs/usr/ports/math/qhull/work/qhull-2012.1/src/libqhullcpp/QhullIterator.h:20:59: note: candidate found by name lookup is 'std::random_access_iterator_tag'
namespace std { struct bidirectional_iterator_tag; struct random_access_iterator_tag; }
                                                          ^
In file included from /wrkdirs/usr/ports/math/qhull/work/qhull-2012.1/src/libqhullcpp/Coordinates.cpp:11:
/wrkdirs/usr/ports/math/qhull/work/qhull-2012.1/src/libqhullcpp/Coordinates.h:201:22: error: reference to 'random_access_iterator_tag' is ambiguous
        typedef std::random_access_iterator_tag  iterator_category;
                     ^
/usr/include/c++/v1/iterator:354:30: note: candidate found by name lookup is 'std::__1::random_access_iterator_tag'
struct _LIBCPP_TYPE_VIS_ONLY random_access_iterator_tag : public bidirectional_iterator_tag {};
                             ^
/wrkdirs/usr/ports/math/qhull/work/qhull-2012.1/src/libqhullcpp/QhullIterator.h:20:59: note: candidate found by name lookup is 'std::random_access_iterator_tag'
namespace std { struct bidirectional_iterator_tag; struct random_access_iterator_tag; }
                                                          ^
2 errors generated.

This is because qhull tries to avoid including <iterator>, and rolls its own (incompatible) std::random_access_iterator_tag and std::bidrectional_iterator_tag.  These are not full compatible with libc++'s own declarations, and clang 3.5.x has become more strict about matching them.

The fix is to replace the hand-rolled declarations with #include <iterator> statements.  This will work for any C++ standard library.
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2014-12-19 14:33:25 UTC
Auto-assigned to maintainer stephen@FreeBSD.org
Comment 2 commit-hook freebsd_committer freebsd_triage 2014-12-19 14:59:47 UTC
A commit references this bug:

Author: stephen
Date: Fri Dec 19 14:59:11 UTC 2014
New revision: 374949
URL: https://svnweb.freebsd.org/changeset/ports/374949

Log:
  - Fix build error with clang 3.5.0.

  PR:		196127
  Submitted by:	Dimitry Andric <dim@FreeBSD.org>

Changes:
  head/math/qhull/files/patch-src__libqhullcpp__QhullIterator.h
  head/math/qhull/files/patch-src__libqhullcpp__QhullLinkedList.h
Comment 3 Stephen Montgomery-Smith freebsd_committer freebsd_triage 2014-12-19 15:02:39 UTC
This is brilliant!  I had no idea how to fix this, and it would have taken me a while to track it down.  Thank you very much.  The fix is committed.  Please get back to me if more changes are required.