Bug 192133

Summary: graphics/Coin: build with GCC 4.8 fails with /usr/local/lib/gcc48/include/c++/cstdlib:174:20: error: declaration of C function 'long long int std::abs(long long int)' conflicts with abs(long long __x)
Product: Ports & Packages Reporter: Gerald Pfeifer <gerald>
Component: Individual Port(s)Assignee: Gerald Pfeifer <gerald>
Status: Closed FIXED    
Severity: Affects Only Me CC: cmt, cristianorolim
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 192025    
Description Flags
patch for graphics/Coin none

Description Gerald Pfeifer freebsd_committer 2014-07-26 11:02:32 UTC
if /bin/sh ../../libtool --mode=compile g++48 -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 -Wl,-rpath=/usr/local/lib/gcc48 -fno-strict-aliasing -Wl,-rpath=/usr/local/lib/gcc48 -W -Wall -Wno-unused -Wno-multichar -Woverloaded-virtual -MT freetype.lo -MD -MP -MF ".deps/freetype.Tpo" -c -o freetype.lo freetype.cpp;  then mv -f ".deps/freetype.Tpo" ".deps/freetype.Plo"; else rm -f ".deps/freetype.Tpo"; exit 1; fi
 g++48 -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 -Wl,-rpath=/usr/local/lib/gcc48 -fno-strict-aliasing -Wl,-rpath=/usr/local/lib/gcc48 -W -Wall -Wno-unused -Wno-multichar -Woverloaded-virtual -MT freetype.lo -MD -MP -MF .deps/freetype.Tpo -c freetype.cpp  -fPIC -DPIC -o .libs/freetype.o
In file included from ../../src/base/dict.h:31:0,
                 from freetype.cpp:142:
/usr/local/lib/gcc48/include/c++/cstdlib: In function 'long long int std::abs(long long int)':
/usr/local/lib/gcc48/include/c++/cstdlib:174:20: error: declaration of C function 'long long int std::abs(long long int)' conflicts with
   abs(long long __x) { return __builtin_llabs (__x); }
/usr/local/lib/gcc48/include/c++/cstdlib:166:3: error: previous declaration 'long int std::abs(long int)' here
   abs(long __i) { return __builtin_labs(__i); }

has the full build log.
Comment 1 John Marino freebsd_committer 2014-07-26 12:37:12 UTC
This port has no maintainer; who is going to fix it?
Comment 2 Christoph Moench-Tegeder freebsd_committer 2014-07-26 12:48:15 UTC
I'll go through the unmaintained ports first.
Comment 3 Christoph Moench-Tegeder freebsd_committer 2014-08-25 21:21:02 UTC
Created attachment 146273 [details]
patch for graphics/Coin

Coin mixes stdlib.h and cstdlib (the C++ variant of stdlib.h) quite freely, but that does not work out with recent compilers - it results in conflicts as seen in the build log (the only place I could find in Coin where stdlib.h is needed is src/xml/expat/expat.h, which is used from "real C" and thus cannot use C++ headers).
Instead of going through >100 files including stdlib.h and creating one-line patches for around 70 of them (some are documentation/examples only or otherwise unused in our build), I opted for using post-patch to fix the include lines.
Comment 4 Gerald Pfeifer freebsd_committer 2014-08-25 22:15:37 UTC
Thanks, Christoph!  I'll do a test build on my side and hope to then
apply this patch tomorrow or so.
Comment 5 commit-hook freebsd_committer 2014-08-26 07:17:20 UTC
A commit references this bug:

Author: gerald
Date: Tue Aug 26 07:16:22 UTC 2014
New revision: 366193
URL: http://svnweb.freebsd.org/changeset/ports/366193

  Fix the build with GCC 4.8.  Coin mixes stdlib.h (the C header) and cstdlib
  (the C++ header) quite freely, which results in conflicts and fails with
  recent compilers.  Address this via a post-patch substitution to avoid some
  70 individual patches.

  PR:		192133
  Submitted by:	Christoph Moench-Tegeder <cmt@burggraben.net>

Comment 6 Gerald Pfeifer freebsd_committer 2014-08-26 07:18:59 UTC
I just committed your patch after testing on redports (before/after).

Thank you!