Bug 211760 - graphics/Coin: Do not require GCC
Summary: graphics/Coin: Do not require GCC
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Thierry Thomas
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2016-08-11 22:14 UTC by Pedro F. Giffuni
Modified: 2016-08-29 19:27 UTC (History)
4 users (show)

See Also:


Attachments
Use base compiler - bump PORTREVISION. (495 bytes, patch)
2016-08-11 22:14 UTC, Pedro F. Giffuni
no flags Details | Diff
coin_build.log_10.3 (15.75 KB, text/x-log)
2016-08-12 02:48 UTC, Walter Schwarzenfeld
no flags Details
Use base compiler for clang38 (730 bytes, patch)
2016-08-12 03:11 UTC, Pedro F. Giffuni
koobs: maintainer-approval-
Details | Diff
Fix with upstream changes (3.69 KB, patch)
2016-08-13 16:58 UTC, Pedro F. Giffuni
no flags Details | Diff
Keep using GCC on FreeBSD <=10 (3.93 KB, patch)
2016-08-28 16:30 UTC, Pedro F. Giffuni
no flags Details | Diff
Coin patch for clang build failure (506 bytes, patch)
2016-08-29 01:01 UTC, Shane
no flags Details | Diff
Add the patches together (4.90 KB, patch)
2016-08-29 01:26 UTC, Pedro F. Giffuni
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro F. Giffuni freebsd_committer 2016-08-11 22:14:03 UTC
Created attachment 173557 [details]
Use base compiler - bump PORTREVISION.

At least on FreeBSD 11, Coin builds fine with the base clang so I don't see any reason to use GCC. I also tested building SoQt.

The patch needs testing on 10-STABLE though.
Comment 1 Walter Schwarzenfeld freebsd_triage 2016-08-12 02:48:29 UTC
Created attachment 173560 [details]
coin_build.log_10.3
Comment 2 Walter Schwarzenfeld freebsd_triage 2016-08-12 02:49:09 UTC
Sorry, no does not. See attached build.log.
The same result from clang34 till clang37.
Comment 3 Walter Schwarzenfeld freebsd_triage 2016-08-12 02:50:34 UTC
The same result from clang34 to clang37. (german error ;-))
Comment 4 Pedro F. Giffuni freebsd_committer 2016-08-12 02:53:42 UTC
(In reply to w.schwarzenfeld from comment #2)
Thanks for testing.
We should depend on the FreeBSD version then.
Comment 5 Pedro F. Giffuni freebsd_committer 2016-08-12 03:11:44 UTC
Created attachment 173561 [details]
Use base compiler for clang38

Like this.
Comment 6 Shane 2016-08-12 04:54:51 UTC
The USE_GCC option is historic, it was used to make the port build with gcc48 instead of the base gcc4.2 which is still the base compiler on 9.3 that is supported until December 2016.

The correct replacement for USE_GCC would now be USE=compiler:c++11-lang - see /usr/ports/Mk/Uses/compiler.mk for available options.

As for the build failure it starts with "error: use of undeclared identifier 'NO_SINGLEPREC'" these can be found in work/Coin-3.1.3/include/Inventor/C/base/math-undefs.h - reading the comments there shows this as their approach to preventing the use of math functions that take a float parameter, these functions are not used within the Coin source code and the deliberate build breakage can be removed from the build by commenting out the #define lines in that file. I have not dug into this so am unsure if some math functions are called indirectly and lead to float/double conversions that they don't want.

Removing the #defines in math-undefs.h should allow any clang or gcc>4.2 to be used. It was about 2 years ago I looked at this and think this got it to compile on 8.x and 9.x
Comment 7 Pedro F. Giffuni freebsd_committer 2016-08-12 14:28:12 UTC
(In reply to Shane from comment #6)
Sound good, perhaps it's something that should be worked out upstream. The code in bitbucket is under a BSD 3-clause license and maybe it is worth to repackage it.
(DISCLAIMER: I am not a ports committer).
Comment 8 Kubilay Kocak freebsd_committer freebsd_triage 2016-08-12 15:12:19 UTC
Reporter is committer, assign accordingly

Needs ports approval
Comment 9 Shane 2016-08-13 02:20:05 UTC
You may also want to look at building the port from head and at least trying to convince upstream to tag a new release some time. The release used in ports was from 4 years ago, there is recent activity in the repo but no tagged releases.

The current head actually wraps the #defines within #ifndef __clang__
Comment 10 Pedro F. Giffuni freebsd_committer 2016-08-13 03:19:19 UTC
(In reply to Shane from comment #9)
OK .. I am busy now but let me take a look at putting some patches together over the weekend :).
Comment 11 Kubilay Kocak freebsd_committer freebsd_triage 2016-08-13 04:14:34 UTC
(In reply to Pedro F. Giffuni from comment #10

Shouldn't be In Progress without a real (human) Assignee, otherwise bugs get lost.

@Pedro Please assign yourself first if you want to take responsibility for resolution. If you could obsolete any attachments that wont be committed as-is, so viewers don't invariable think those are proposed/complete changes, that would also be great

Thanks
Comment 12 Pedro F. Giffuni freebsd_committer 2016-08-13 04:25:20 UTC
(In reply to Kubilay Kocak from comment #11)
OK (I actually wanted to suspend the PR while I re-examine it but that is not an option). I shouldn't take it since I am not a ports committer so the resolution is not really in my hands.

The patch that is there works: I think I can improve it but I will wait until I have a new patch before obsoleting this one.
Comment 13 Kubilay Kocak freebsd_committer freebsd_triage 2016-08-13 04:38:29 UTC
(In reply to Pedro F. Giffuni from comment #12)

tldr; an issue should reflect the/its latest 'intent' at all times.

One can effectively 'suspend' an issue precisely by obsoleting all patches, leaving nothing proposed/to be done (as seen by issue viewers), hence my suggestion to do so.

Additionally, assigning it to yourself 'until you have something better' is the best way to ensure something else doesn't get done in the meantime, or when you are 'the next step' to moving the issue forward

Assignee just means 'current' assignee and is not set in stone. The type of committer (doc, src, ports) has no bearing on this as all committers can commit anywhere given approval. Obtaining that approval does not require the approver, say me (ports) for you (src) on this issue, to be the Assignee at any time.

Using this issue as an example:

* There's a patch, but now not being proposed as the 'now' fix in lieu of a future one. The issue in totality currently reads as "a better patch will be provided at some point". Therefore:

 - Obsolete patch
 - keywords: needs patch
 - Assign: person-this-issue-is-blocked-on (to provide patch)

Result = issue is effectively suspended, assigned to pfg for the next move.

Hope this helps to clarify some of the reasons for certain things
Comment 14 Pedro F. Giffuni freebsd_committer 2016-08-13 16:58:30 UTC
Created attachment 173632 [details]
Fix with upstream changes

Done:

I updated an existing fix and also brought in an upstream cleanup so that it now builds with clang and GCC. Tested with clang34 port.

Since the new patches are under a 3 Clause BSD license, add a notice about the license change in the pkg-descr.
Comment 15 Pedro F. Giffuni freebsd_committer 2016-08-13 17:00:59 UTC
Reassign back to the pool since the issue is unblocked.
Comment 16 Thierry Thomas freebsd_committer 2016-08-28 14:29:24 UTC
Take it.
Comment 17 Thierry Thomas freebsd_committer 2016-08-28 16:03:03 UTC
I cannot build it in my poudriere, because:
devel/llvm37: Failed: build-depends

so I tried it normally, and it failed on 10.3-STABLE amd64 with the following error:

--- SbTime.lo ---
In file included from SbTime.cpp:42:
/usr/include/c++/v1/cmath:679:91: error: use of undeclared identifier 'NO_SINGLEPREC'
inline _LIBCPP_INLINE_VISIBILITY float       acos(float __lcpp_x) _NOEXCEPT       {return acosf(__lcpp_x);}
                                                                                          ^
../../include/Inventor/C/base/math-undefs.h:54:18: note: expanded from macro 'acosf'
#define acosf(x) NO_SINGLEPREC
                 ^
In file included from SbTime.cpp:42:
/usr/include/c++/v1/cmath:694:91: error: use of undeclared identifier 'NO_SINGLEPREC'
inline _LIBCPP_INLINE_VISIBILITY float       asin(float __lcpp_x) _NOEXCEPT       {return asinf(__lcpp_x);}
                                                                                          ^
../../include/Inventor/C/base/math-undefs.h:56:18: note: expanded from macro 'asinf'
#define asinf(x) NO_SINGLEPREC
                 ^
In file included from SbTime.cpp:42:
/usr/include/c++/v1/cmath:709:91: error: use of undeclared identifier 'NO_SINGLEPREC'
inline _LIBCPP_INLINE_VISIBILITY float       atan(float __lcpp_x) _NOEXCEPT       {return atanf(__lcpp_x);}
                                                                                          ^
../../include/Inventor/C/base/math-undefs.h:58:18: note: expanded from macro 'atanf'
#define atanf(x) NO_SINGLEPREC
                 ^
In file included from SbTime.cpp:42:
/usr/include/c++/v1/cmath:724:131: error: too many arguments provided to function-like macro invocation
inline _LIBCPP_INLINE_VISIBILITY float       atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT             {return atan2f(__lcpp_y, __lcpp_x);}
                                                                                                                                  ^
../../include/Inventor/C/base/math-undefs.h:60:9: note: macro 'atan2f' defined here
#define atan2f(x) NO_SINGLEPREC
        ^
In file included from SbTime.cpp:42:
/usr/include/c++/v1/cmath:724:114: error: cannot initialize return object of type 'float' with an lvalue of type 'float (float, float)'
inline _LIBCPP_INLINE_VISIBILITY float       atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT             {return atan2f(__lcpp_y, __lcpp_x);}
                                                                                                                 ^~~~~~
/usr/include/c++/v1/cmath:765:90: error: use of undeclared identifier 'NO_SINGLEPREC'
inline _LIBCPP_INLINE_VISIBILITY float       cos(float __lcpp_x) _NOEXCEPT       {return cosf(__lcpp_x);}
                                                                                         ^
../../include/Inventor/C/base/math-undefs.h:44:17: note: expanded from macro 'cosf'
#define cosf(x) NO_SINGLEPREC /* whatever that'll give us a compile error... */
                ^
In file included from SbTime.cpp:42:
/usr/include/c++/v1/cmath:949:127: error: too many arguments provided to function-like macro invocation
inline _LIBCPP_INLINE_VISIBILITY float       pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return powf(__lcpp_x, __lcpp_y);}
                                                                                                                              ^
../../include/Inventor/C/base/math-undefs.h:50:9: note: macro 'powf' defined here
#define powf(x) NO_SINGLEPREC
        ^
In file included from SbTime.cpp:42:
/usr/include/c++/v1/cmath:949:112: error: cannot initialize return object of type 'float' with an lvalue of type 'float (float, float)'
inline _LIBCPP_INLINE_VISIBILITY float       pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return powf(__lcpp_x, __lcpp_y);}
                                                                                                               ^~~~
/usr/include/c++/v1/cmath:975:90: error: use of undeclared identifier 'NO_SINGLEPREC'
inline _LIBCPP_INLINE_VISIBILITY float       sin(float __lcpp_x) _NOEXCEPT       {return sinf(__lcpp_x);}
                                                                                         ^
../../include/Inventor/C/base/math-undefs.h:46:17: note: expanded from macro 'sinf'
#define sinf(x) NO_SINGLEPREC
                ^
In file included from SbTime.cpp:42:
/usr/include/c++/v1/cmath:1007:91: error: use of undeclared identifier 'NO_SINGLEPREC'
inline _LIBCPP_INLINE_VISIBILITY float       sqrt(float __lcpp_x) _NOEXCEPT       {return sqrtf(__lcpp_x);}
                                                                                          ^
../../include/Inventor/C/base/math-undefs.h:52:18: note: expanded from macro 'sqrtf'
#define sqrtf(x) NO_SINGLEPREC
                 ^
In file included from SbTime.cpp:42:
/usr/include/c++/v1/cmath:1023:90: error: use of undeclared identifier 'NO_SINGLEPREC'
inline _LIBCPP_INLINE_VISIBILITY float       tan(float __lcpp_x) _NOEXCEPT       {return tanf(__lcpp_x);}
                                                                                         ^
../../include/Inventor/C/base/math-undefs.h:48:17: note: expanded from macro 'tanf'
#define tanf(x) NO_SINGLEPREC
                ^
--- SbVec2ub.lo ---
if /bin/sh ../../libtool --mode=compile c++ -DHAVE_CONFIG_H  -I../../include -I../../include  -I../../src -I../../src   -D_REENTRANT -DNDEBUG -DCOIN_DEBUG=0 -DCOIN_INTERNAL -I/usr/local/include   -O2 -pipe -march=corei7 -fstack-protector -fno-strict-aliasing  -W -Wall -Wno-unused -Wno-multichar -Woverloaded-virtual -MT SbVec2ub.lo -MD -MP -MF ".deps/SbVec2ub.Tpo" -c -o SbVec2ub.lo SbVec2ub.cpp;  then mv -f ".deps/SbVec2ub.Tpo" ".deps/SbVec2ub.Plo"; else rm -f ".deps/SbVec2ub.Tpo"; exit 1; fi
--- SbVec2b.lo ---
 c++ -DHAVE_CONFIG_H -I../../include -I../../include -I../../src -I../../src -D_REENTRANT -DNDEBUG -DCOIN_DEBUG=0 -DCOIN_INTERNAL -I/usr/local/include -O2 -pipe -march=corei7 -fstack-protector -fno-strict-aliasing -W -Wall -Wno-unused -Wno-multichar -Woverloaded-virtual -MT SbVec2b.lo -MD -MP -MF .deps/SbVec2b.Tpo -c SbVec2b.cpp  -fPIC -DPIC -o .libs/SbVec2b.o
--- SbVec2ub.lo ---
 c++ -DHAVE_CONFIG_H -I../../include -I../../include -I../../src -I../../src -D_REENTRANT -DNDEBUG -DCOIN_DEBUG=0 -DCOIN_INTERNAL -I/usr/local/include -O2 -pipe -march=corei7 -fstack-protector -fno-strict-aliasing -W -Wall -Wno-unused -Wno-multichar -Woverloaded-virtual -MT SbVec2ub.lo -MD -MP -MF .deps/SbVec2ub.Tpo -c SbVec2ub.cpp  -fPIC -DPIC -o .libs/SbVec2ub.o
--- SbTime.lo ---
SbTime.cpp:1062:22: warning: unused parameter 'fp' [-Wunused-parameter]
SbTime::print(FILE * fp) const
                     ^
1 warning and 11 errors generated.
*** [SbTime.lo] Error code 1

make[5]: stopped in /usr/ports/graphics/Coin/work/Coin-3.1.3/src/base
1 error

make[5]: stopped in /usr/ports/graphics/Coin/work/Coin-3.1.3/src/base
*** [all-recursive] Error code 1

make[4]: stopped in /usr/ports/graphics/Coin/work/Coin-3.1.3/src
1 error

make[4]: stopped in /usr/ports/graphics/Coin/work/Coin-3.1.3/src
*** [all] Error code 2

make[3]: stopped in /usr/ports/graphics/Coin/work/Coin-3.1.3/src
1 error

make[3]: stopped in /usr/ports/graphics/Coin/work/Coin-3.1.3/src
*** [all-recursive] Error code 1

make[2]: stopped in /usr/ports/graphics/Coin/work/Coin-3.1.3
1 error

make[2]: stopped in /usr/ports/graphics/Coin/work/Coin-3.1.3
*** [all] Error code 2

make[1]: stopped in /usr/ports/graphics/Coin/work/Coin-3.1.3
1 error

make[1]: stopped in /usr/ports/graphics/Coin/work/Coin-3.1.3
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make: stopped in /usr/ports/graphics/Coin
Comment 18 Pedro F. Giffuni freebsd_committer 2016-08-28 16:07:11 UTC
Thank you Thierry;

(In reply to Thierry Thomas from comment #17)

It looks like a libc++ error on FreeBSD 10.  I guess we will have to keep using gcc on 10 and 9 :(
Comment 19 Pedro F. Giffuni freebsd_committer 2016-08-28 16:30:02 UTC
Created attachment 174161 [details]
Keep using GCC on FreeBSD <=10

Back to the basics: as in previous patches, the port builds fine on FreeBSD 11 with clang but now we are using the upstream patches instead of our local hacks.
Comment 20 Shane 2016-08-29 01:01:13 UTC
Created attachment 174170 [details]
Coin patch for clang build failure

The issue is located in include/Inventor/C/base/math-undefs.h which the current Coin master surrounded by #ifndef __clang__ about 2 years ago.

https://bitbucket.org/Coin3D/coin/commits/e0801647b1839a40df71e2d4d37f77eae2730bca

The point of math-undefs.h is to stop the use of the float based math functions that were introduced in C99. No patch has been added to address this.

Coin can be built fine using any gcc or clang on FreeBSD>=9 - either with this patch or even better - a recent commit from master could be tried.
Comment 21 Pedro F. Giffuni freebsd_committer 2016-08-29 01:26:34 UTC
Created attachment 174171 [details]
Add the patches together

OK, I have added Shane's patch and everything still builds here ... Thanks!
Comment 22 Thierry Thomas freebsd_committer 2016-08-29 19:27:46 UTC
Committed, thanks!

Note: since I was here, adding some missing USE_XORG components.
Comment 23 commit-hook freebsd_committer 2016-08-29 19:27:53 UTC
A commit references this bug:

Author: thierry
Date: Mon Aug 29 19:27:42 UTC 2016
New revision: 421092
URL: https://svnweb.freebsd.org/changeset/ports/421092

Log:
  Do not require GCC.

  PR:		211760
  Submitted by:	pfg

Changes:
  head/graphics/Coin/Makefile
  head/graphics/Coin/files/patch-Makefile.in
  head/graphics/Coin/files/patch-include-Inventor-SbBasic.h
  head/graphics/Coin/files/patch-include_Inventor_C_base_math-undefs.h
  head/graphics/Coin/pkg-descr