Bug 192133 - 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)
Summary: graphics/Coin: build with GCC 4.8 fails with /usr/local/lib/gcc48/include/c++...
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: Gerald Pfeifer
URL:
Keywords:
Depends on:
Blocks: 192025
  Show dependency treegraph
 
Reported: 2014-07-26 11:02 UTC by Gerald Pfeifer
Modified: 2014-08-26 07:18 UTC (History)
2 users (show)

See Also:


Attachments
patch for graphics/Coin (567 bytes, patch)
2014-08-25 21:21 UTC, Christoph Moench-Tegeder
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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); }
   ^


http://package23.nyi.freebsd.org/data/10amd64-default-PR192025/2014-07-24_23h12m00s/logs/errors/Coin-3.1.3_6.log
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

Log:
  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>

Changes:
  head/graphics/Coin/Makefile
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!