Bug 193598 - devel/gdb fails to build with clang
Summary: devel/gdb fails to build with clang
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: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-13 08:48 UTC by Tobias Berner
Modified: 2014-09-23 08:28 UTC (History)
1 user (show)

See Also:
tcberner: maintainer-feedback? (luca.pizzamiglio)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Berner 2014-09-13 08:48:21 UTC
devel/gdb fails to build with clang on current (see error at the end of the report). 

Solution: USE_GCC=any should probably be added to the ports makefile.


Build errors are:
[...]
In file included from ./cp-demangle.c:128:
./../include/libiberty.h:110:38: error: expected function body after function declarator
extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
                                     ^
./../include/libiberty.h:121:45: error: expected function body after function declarator
extern const char *lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
[...]                              
const char *tempbase) ATTRIBUTE_RETURNS_NONNULL;
                                                       ^
17 errors generated.
gmake[4]: *** [cp-demangle.o] Error 1
gmake[4]: Leaving directory `/tmp/usr/ports/devel/gdb/work/gdb-7.8/libiberty'
gmake[3]: *** [all-libiberty] Error 2
gmake[3]: Leaving directory `/tmp/usr/ports/devel/gdb/work/gdb-7.8'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/tmp/usr/ports/devel/gdb/work/gdb-7.8'
*** Error code 1
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2014-09-13 08:48:21 UTC
Maintainer CC'd
Comment 2 luca.pizzamiglio 2014-09-22 11:55:52 UTC
I'm not able to reproduce the error.

I've successfully built gdb on current r271779, on amd64, without any error.

I need more information: the port's configuration, the make.conf (if you are using something specific), the output of cc --version and cpp --version.
Comment 3 Tobias Berner 2014-09-22 12:30:19 UTC
#  uname -a
FreeBSD noxon.firefly 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r271365: Wed Sep 10 12:13:15 CEST
#  cc --version
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: x86_64-unknown-freebsd11.0
Thread model: posix
#  cpp --version
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: x86_64-unknown-freebsd11.0
# cat /etc/make.conf
<empty>

Port-configuration ist GDB_LINK,THREADS,TUI,PORT_READLINE enabled, rest disabled.

Full buildlog: http://paste.kde.org/plg4mmpsf



I am able to build it on another machine which is at r270781.
Comment 4 luca.pizzamiglio 2014-09-22 15:24:44 UTC
It seems that something in the preprocessing phase of your build gets wrong, but I still cannot reproduce your error (I cannot revers my CURRENT)
The macro ATTRIBUTE_RETURNS_NONNULL should be defined as an empty string.
You could find that definition in include/ansidecl.h

I suggest:
* clang-cpp'ing this http://paste.kde.org/p02trki1d
* update the CURRENT to r271779 (llvm/clang receives again some love)
* MAKE_JOBS_UNSAFE=yes (I don't expect any luck, only if you have time)

The first point is the most important one. It tests the clang-cpp (the clang preprocessor) against the GCC_VERSION macro.

The macro ATTRIBUTE_RETURNS_NONNULL has to be an empty string. On my system I get:

warning: ATTRIBUTE_RETURNS_NONNULL not defined
warning: GCC_VERSION smaller than 4009

as expected.
Comment 5 Tobias Berner 2014-09-22 16:14:37 UTC
# 1 "test.cpp"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 165 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "test.cpp" 2
test.cpp:2:2: warning: ATTRIBUTE_RETURNS_NONNULL not defined [-W#warnings]
#warning ATTRIBUTE_RETURNS_NONNULL not defined
 ^
test.cpp:6:2: warning: GCC_VERSION smaller than 4009 [-W#warnings]
#warning GCC_VERSION smaller than 4009
 ^

2 warnings generated.



I'm now at todays sources. 
Build output with MAKE_JOBS_UNSAFE defined: http://paste.kde.org/prehng9qs
Comment 6 Tobias Berner 2014-09-23 08:14:46 UTC
There was a stale ansidecl.h on my system which caused the error.
Comment 7 luca.pizzamiglio 2014-09-23 08:28:12 UTC
I was asking exactly that.

The error is caused, moreover, because the include path order gives higher priority to /usr/local/include than ../include. I'll try to fix that, to avoid future conflicts.

thanks for the report