What is different about the way Apple builds GCC ?
What is different about the way Apple builds GCC ?
- Subject: What is different about the way Apple builds GCC ?
- From: Sam Hart <email@hidden>
- Date: Fri, 23 Sep 2005 13:34:40 +0100
Hi,
my apologies in advance, this is going to be a loooong mail, I
can feel it.
To build Apple's branch of GCC there are 2 ways to build it
The FSF way :
% mkdir darwin
% cd darwin
.% ../configure --prefix=/tmp/testplace
% make bootstrap
# make install
or the Apple way :
% mkdir -p build/obj build/dst build/sym
% gnumake install RC_OS=macos RC_ARCHS=ppc TARGETS=ppc \
SRCROOT=`pwd` OBJROOT=`pwd`/build/obj \
DSTROOT=`pwd`/build/dst SYMROOT=`pwd`/build/sym
# ditto build/dst /
This is the same for both the apple-local-200502-branch ( formally
apple-ppc-branch )
maintained on the CVS over at gcc.gnu.org, or for the tarballs from
developer.apple.com
I've been putting together patches for Apple's GCCs and I am having
some problems that show up when building the Apple way, although I
like to play with GCC internals, and I will eventually track down the
problem given enough time, I am admittedly a bit stumped and it would
probably be worth me putting it out to the community and just get it
resolved rather than pushing on regardless.
Lets take an example of Apple's gcc-1495[1] which I produced a patch
[2] for last year.
This built fine the fsf-way and install and work correctly but would
fail when building the Apple way with :
ld: Undefined symbols:
___guard
___stack_smash_handler
That was a while ago and I got distracted with other work to really
track down the problem.
Anyway not so long ago I started taking another look, updating
versions of GCC and redoing the diffs. The most progress has been
made with Apple's gcc-1809[3], however with or without the patch[4]
it b0rks during compilation with :
<-- snip -->
rm -f f771
stage1/xgcc -Bstage1/ -B/usr/local/powerpc-apple-darwin8.2.0/bin/ -no-
cpp-precomp -g -O2 -no-cpp-precomp -DIN_GCC -W -Wall -Wwrite-
strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -
pedantic -Wno-long-long -mdynamic-no-pic -DHAVE_CONFIG_H -o f771 f/
bad.o f/bit.o f/bld.o f/com.o f/data.o f/equiv.o f/expr.o f/global.o
f/implic.o f/info.o f/intrin.o f/lab.o f/lex.o f/malloc.o f/name.o f/
parse.o f/src.o f/st.o f/sta.o f/stb.o f/stc.o f/std.o f/ste.o f/
storag.o f/stp.o f/str.o f/sts.o f/stt.o f/stu.o f/stv.o f/stw.o f/
symbol.o f/target.o f/top.o f/type.o f/where.o main.o libbackend.a ./
intl/libintl.a -liconv ../libiberty/libiberty.a \
stub-genindex.o
ld: warning multiple definitions of symbol _asprintf
../libiberty/libiberty.a(asprintf.o) definition of _asprintf in
section (__TEXT,__text)
/usr/lib/libSystem.dylib(asprintf-LDBL.So) definition of _asprintf
ld: warning multiple definitions of symbol _locale_charset
./intl/libintl.a(localcharset.o) definition of _locale_charset in
section (__TEXT,__text)
/usr/lib/libiconv.dylib(localcharset.o) definition of _locale_charset
ld: Undefined symbols:
_cpp_token_val_index
make[2]: *** [f771] Error 1
make[1]: *** [stage2_build] Error 2
make: *** [bootstrap-lean] Error 2
so it is consistent. This isn't really a problem as building the
Apple way is the goal.
I also tried to build the Apple way without the patch and it built
fine, however adding the patch brought back a familiar message
<-- snip -->
echo timestamp > stmp-multilib
echo timestamp > stage3_build
echo stage3_build > stage_last
Bootstrap complete - make "quickstrap" to redo last build,
or "cleanstrap" to redo the bootstrap from scratch.
rm -f .bad_compare
case "gnucompare" in gnucompare | gnucompare-lean ) stage=2 ;; * )
stage=`echo gnucompare | sed -e 's,^gnucompare\([0-9][0-9]*\).*,
\1,'` ;; esac; \
for file in *.o; do \
cmp --ignore-initial=16 $file stage$stage/$file > /dev/null 2>&1; \
test $? -eq 1 && echo $file differs >> .bad_compare || true; \
done
case "gnucompare" in gnucompare | gnucompare-lean ) stage=2 ;; * )
stage=`echo gnucompare | sed -e 's,^gnucompare\([0-9][0-9]*\).*,
\1,'` ;; esac; \
for dir in tmp-foo intl cp objc objcp; do \
if [ "`echo $dir/*.o`" != "$dir/*.o" ] ; then \
for file in $dir/*.o; do \
cmp --ignore-initial=16 $file stage$stage/$file > /dev/null
2>&1; \
test $? -eq 1 && echo $file differs >> .bad_compare || true; \
done; \
else true; fi; \
done
case "gnucompare" in gnucompare | gnucompare-lean ) stage=2 ;; * )
stage=`echo gnucompare | sed -e 's,^gnucompare\([0-9][0-9]*\).*,
\1,'` ;; esac; \
if [ -f .bad_compare ]; then \
echo "Bootstrap comparison failure!"; \
cat .bad_compare; \
exit 1; \
else \
case "gnucompare" in \
*-lean ) rm -rf stage$stage ;; \
esac; true; \
fi
rm -f ppc-rtl.c
sed -e 's/config[.]h/hconfig.h/' /SourceCache/gcc_os/gcc_os-1809/gcc/
rtl.c > ppc-rtl.c
cc -arch ppc -no-cpp-precomp -c -no-cpp-precomp -pipe -no-cpp-
precomp -g -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -
Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long -mdynamic-
no-pic -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -I. -I/SourceCache/
gcc_os/gcc_os-1809/gcc -I/SourceCache/gcc_os/gcc_os-1809/gcc/. -I/
SourceCache/gcc_os/gcc_os-1809/gcc/config -I/SourceCache/gcc_os/
gcc_os-1809/gcc/../include -I/SourceCache/gcc_os/gcc_os-1809/gcc/../
more-hdrs ppc-rtl.c -o ppc-rtl.o
In file included from ppc-rtl.c:26:
/SourceCache/gcc_os/gcc_os-1809/gcc/ggc.h:279: warning: ISO C forbids
forward references to `enum' types
rm -f ppc-bitmap.c
sed -e 's/config[.]h/hconfig.h/' /SourceCache/gcc_os/gcc_os-1809/gcc/
bitmap.c > ppc-bitmap.c
cc -arch ppc -no-cpp-precomp -c -no-cpp-precomp -pipe -no-cpp-
precomp -g -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -
Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long -mdynamic-
no-pic -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -I. -I/SourceCache/
gcc_os/gcc_os-1809/gcc -I/SourceCache/gcc_os/gcc_os-1809/gcc/. -I/
SourceCache/gcc_os/gcc_os-1809/gcc/config -I/SourceCache/gcc_os/
gcc_os-1809/gcc/../include -I/SourceCache/gcc_os/gcc_os-1809/gcc/../
more-hdrs ppc-bitmap.c -o ppc-bitmap.o
In file included from ppc-bitmap.c:27:
/SourceCache/gcc_os/gcc_os-1809/gcc/ggc.h:279: warning: ISO C forbids
forward references to `enum' types
rm -f ppc-ggc-none.c
sed -e 's/config[.]h/hconfig.h/' /SourceCache/gcc_os/gcc_os-1809/gcc/
ggc-none.c > ppc-ggc-none.c
cc -arch ppc -no-cpp-precomp -c -no-cpp-precomp -pipe -no-cpp-
precomp -g -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -
Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long -mdynamic-
no-pic -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -I. -I/SourceCache/
gcc_os/gcc_os-1809/gcc -I/SourceCache/gcc_os/gcc_os-1809/gcc/. -I/
SourceCache/gcc_os/gcc_os-1809/gcc/config -I/SourceCache/gcc_os/
gcc_os-1809/gcc/../include -I/SourceCache/gcc_os/gcc_os-1809/gcc/../
more-hdrs ppc-ggc-none.c -o ppc-ggc-none.o
In file included from ppc-ggc-none.c:27:
/SourceCache/gcc_os/gcc_os-1809/gcc/ggc.h:279: warning: ISO C forbids
forward references to `enum' types
/SourceCache/gcc_os/gcc_os-1809/gcc/ggc.h:280: warning: ISO C forbids
forward references to `enum' types
rm -f ppc-errors.c
sed -e 's/config[.]h/hconfig.h/' /SourceCache/gcc_os/gcc_os-1809/gcc/
errors.c > ppc-errors.c
cc -arch ppc -no-cpp-precomp -c -no-cpp-precomp -pipe -no-cpp-
precomp -g -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -
Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long -mdynamic-
no-pic -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -I. -I/SourceCache/
gcc_os/gcc_os-1809/gcc -I/SourceCache/gcc_os/gcc_os-1809/gcc/. -I/
SourceCache/gcc_os/gcc_os-1809/gcc/config -I/SourceCache/gcc_os/
gcc_os-1809/gcc/../include -I/SourceCache/gcc_os/gcc_os-1809/gcc/../
more-hdrs ppc-errors.c -o ppc-errors.o
cc -arch ppc -no-cpp-precomp -no-cpp-precomp -pipe -no-cpp-precomp
-g -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-
prototypes -Wtraditional -pedantic -Wno-long-long -mdynamic-no-pic -
DHAVE_CONFIG_H -DGENERATOR_FILE -o genconstants \
genconstants.o gensupport.o dummy-conditions.o ppc-rtl.o read-rtl.o
ppc-bitmap.o ppc-ggc-none.o \
ppc-errors.o ../libiberty/libiberty.a
ld: Undefined symbols:
___guard
___stack_smash_handler
gnumake[1]: *** [genconstants] Error 1
+ status=2
+ command set +x
+ set +x
********************************************
* *** gnumake failed building compiler *** *
********************************************
make: *** [build] Error 1
+++++++++++++++++++++++++++++++++++++++++
EXIT STATUS: 2
of particular interest to me is near the start where it says
"Bootstrap complete", but the real problem is once again the
undefined symbols.
Of all the object files in the last cc, read-rtl.o requires the
missing symbols.
I've found in the past that by the time I email a list the solution
pops into my head so this email is hopefully tempting fate,
alternatively it might be gaps in my knowledge of gcc internals
showing themselves up. I guess the last alternative is that I just
need a short rap on the head with a clue stick to dislodge a thinko.
Anyway any help would be appreciated :)
Out of interest, I tried to build it with DarwinBuild[5] and it built
without problems, but upon testing the front end ( gcc, g++ etc. )
were missing the -foptions, but the backend ( cc1 etc. ) had included
my changes. I'm not sure if this is a problem with DarwinBuild, or
this is the way Apple build it internally but it's a bit weird.
S a m
[1] <http://www.opensource.apple.com/darwinsource/tarballs/other/
gcc-1495.tar.gz>
[2] <http://optimist.sdf-eu.org/propolice/darwin7.2.1gcc-propolice.diff>
[3] <http://www.opensource.apple.com/darwinsource/tarballs/other/
gcc_os-1809.tar.gz>
[4] <http://optimist.sdf-eu.org/ssp/ssp-gcc_os-1809.diff>
[5] <http://opendarwin.org/projects/darwinbuild/>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden