Bug 219290

Summary: cad/calculix: fails to build with lang/gcc6 or later
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Individual Port(s)Assignee: Pedro F. Giffuni <pfg>
Status: Closed FIXED    
Severity: Affects Only Me CC: gerald, maho, pfg, rakuco
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213976
Bug Depends on:    
Bug Blocks: 219275    

Description Jan Beich freebsd_committer freebsd_triage 2017-05-14 22:02:25 UTC
In file included from /usr/local/lib/gcc6/include/c++/bits/char_traits.h:39:0,
                 from /usr/local/lib/gcc6/include/c++/ios:40,
                 from /usr/local/lib/gcc6/include/c++/ostream:38,
                 from /usr/local/lib/gcc6/include/c++/iostream:39,
                 from uselibSNL.cpp:28:
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
                                                        ^
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
                                                        ^
In file included from ../../libSNL/src/snlCurveBase.h:23:0,
                 from ../../libSNL/src/snlCurve.h:25,
                 from ../../libSNL/src/snlSurface.h:20,
                 from uselibSNL.cpp:30:
../../libSNL/src/snlKnotVector.h:115:18: error: macro "max" requires 2 arguments, but only 1 given
         knot max() const;  // Max knot val.
                  ^
../../libSNL/src/snlKnotVector.h:116:18: error: macro "min" requires 2 arguments, but only 1 given
         knot min() const;  // Min knot val.
                  ^
In file included from ./cgx.h:25:0,
                 from uselibSNL.h:8,
                 from uselibSNL.cpp:26:
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:195:5: error: expected unqualified-id before 'const'
     min(const _Tp& __a, const _Tp& __b)
     ^
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:195:5: error: expected ')' before 'const'
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:195:5: error: expected ')' before 'const'
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:195:5: error: expected initializer before 'const'
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:219:5: error: expected unqualified-id before 'const'
     max(const _Tp& __a, const _Tp& __b)
     ^
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:219:5: error: expected ')' before 'const'
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:219:5: error: expected ')' before 'const'
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:219:5: error: expected initializer before 'const'
In file included from /usr/local/lib/gcc6/include/c++/bits/char_traits.h:39:0,
                 from /usr/local/lib/gcc6/include/c++/ios:40,
                 from /usr/local/lib/gcc6/include/c++/ostream:38,
                 from /usr/local/lib/gcc6/include/c++/iostream:39,
                 from uselibSNL.cpp:28:
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:243:5: error: 'std::min' declared as an 'inline' variable
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:246:7: error: expected primary-expression before 'if'
       if (__comp(__b, __a))
       ^~
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:246:7: error: expected '}' before 'if'
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:246:7: error: expected ';' before 'if'
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:248:7: error: expected unqualified-id before 'return'
       return __a;
       ^~~~~~
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:265:5: error: 'max' declared as an 'inline' variable
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:268:7: error: expected primary-expression before 'if'
       if (__comp(__a, __b))
       ^~
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:268:7: error: expected '}' before 'if'
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:268:7: error: expected ';' before 'if'
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:270:7: error: expected unqualified-id before 'return'
       return __a;
       ^~~~~~
/usr/local/lib/gcc6/include/c++/bits/stl_algobase.h:271:5: error: expected declaration before '}' token
     }
     ^

build log: http://sprunge.us/dXhE
Comment 1 Pedro F. Giffuni freebsd_committer freebsd_triage 2017-06-28 03:11:10 UTC
CalculiX graphiX (cgx) is the half of calculix that is failing to build. Even if it builds, it will coredump due to libstdc++ vs libc++ issues.

ccx, the other part, has to be built with GCC (for fortran). The solution seems to be to split the ccx and cgx parts into different ports, which is not at all difficult since both are different programs/tarballs.
Comment 2 Pedro F. Giffuni freebsd_committer freebsd_triage 2017-07-02 17:37:16 UTC
I split the port so the graphic stuff builds with clang.
Comment 3 Gerald Pfeifer freebsd_committer freebsd_triage 2017-08-13 20:47:46 UTC
(In reply to Pedro F. Giffuni from comment #2)
> I split the port so the graphic stuff builds with clang.

Thanks, Pedro.

Pedro, Maho-san, this is now one of only two PRs blocking the update to 
GCC 6.  Can you help getting this closed?  That'd be awesome!
Comment 4 Pedro F. Giffuni freebsd_committer freebsd_triage 2017-08-13 22:10:35 UTC
(In reply to Gerald Pfeifer from comment #3)
...

Unfortunately Maho released maintainership of the port and I am not a ports committer.

If someone approves PRs 220433 and 220434, I can commit it.
Comment 5 Pedro F. Giffuni freebsd_committer freebsd_triage 2017-08-15 00:37:06 UTC
As of r447973, the code in question is built with clang, so this should not be an issue anymore.
Comment 6 Raphael Kubo da Costa freebsd_committer freebsd_triage 2017-08-15 11:53:20 UTC
Is there anything left to do here or can we close this one as fixed?
Comment 7 Gerald Pfeifer freebsd_committer freebsd_triage 2017-08-15 12:29:59 UTC
I think we're done. :-)  Thank you, guys!