tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: buildlink adds -std=gnu99 to gcc, breaks x11/gtk build on macosx
On Mon, Nov 10, 2008 at 06:31:10PM +0000, Chuck Cranor wrote:
> I've got a new macbook pro laptop with the latest xcode and i'm
> trying to duplicate my desktop netbsd environment on it, but pkgsrc
> is failing to build x11/gtk because it is silently adding -std=gnu99
> to the gcc command line and causing glib inline functions to mess
> up --- they don't inline and end up generating multi-defined symbol
> error (see bottom for example compile failure).
Following up on my own message:
[1] commenting out "USE_LANGUAGES+=c99" in x11/gtk/Makefile fixes the problem
[2] the root cause is that -std=gnu99 has a different effect on the macosx
than netbsd, as shown by following simple example (src below) that
compiles OK on macosx without -std=gnu99, but fails with -std=gnu99.
note that it compiles fine both ways on NetBSD/i386 4.0.
% ./DOIT
+ cc -O -o plain main.c aux.c
+ ./plain
barf-main
barf-aux
+ cc -std=gnu99 -O -o g99 main.c aux.c
main.c: In function 'main':
main.c:12: warning: implicit declaration of function ‘aux’
ld: duplicate symbol _barf in
/var/folders/oF/oFRnqBEvF4W3LFRSeCKqCU+++TI/-Tmp-//cc2YNI6Z.o and
/var/folders/oF/oFRnqBEvF4W3LFRSeCKqCU+++TI/-Tmp-//ccGI3ico.o
collect2: ld returned 1 exit status
+ ./g99
./DOIT: line 7: ./g99: No such file or directory
+ rm -f ./plain ./g99
%
chuck
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# DOIT
# aux.c
# main.c
#
echo x - DOIT
sed 's/^X//' >DOIT << 'END-of-DOIT'
X#!/bin/sh -x
X
Xcc -O -o plain main.c aux.c
X./plain
X
Xcc -std=gnu99 -O -o g99 main.c aux.c
X./g99
X
X
Xrm -f ./plain ./g99
END-of-DOIT
echo x - aux.c
sed 's/^X//' >aux.c << 'END-of-aux.c'
X#include <stdio.h>
X
Xextern inline int barf() {
X printf("barf-aux\n");
X}
X
Xint aux() {
X
X barf();
X
X}
END-of-aux.c
echo x - main.c
sed 's/^X//' >main.c << 'END-of-main.c'
X#include <stdio.h>
X
Xextern inline int barf() {
X printf("barf-main\n");
X}
X
X
X
Xint main() {
X
X barf();
X aux();
X
X}
END-of-main.c
exit
Home |
Main Index |
Thread Index |
Old Index