From: Tom on
Is this an appropriate forum for discussing GNAT build problems? I am
attempting to build a GNAT cross compiler targeting bare metal PowerPC
platforms. After successfully getting past binutils, the first pass
of GCC, and Newlib, I'm getting stuck on the final pass of GCC and
GNAT. When linking gnatmake, the linker is throwing a bunch of
undefined references from osint.adb (such as
__gnat_is_writable_file_attr). See log below.

Many of the challenges I've had to this point have been around this
use of <derint.h> and sockets, neither of which are needed on my
target platform. Is there any way to configure GNAT not to build all
this OS related stuff?

Recent discussions I've have with some of the issues encountered so
far:

http://comments.gmane.org/gmane.comp.lib.newlib/6132
http://comments.gmane.org/gmane.comp.gcc.help/32672

Thanks for any help!

-Tom


gcc -c -I./ -I/usr/lib/gcc/i486-linux-gnu/4.4.3/adalib/../adainclude -
I/usr/lib/gcc/i486-linux-gnu/4.4.3/adalib/ -I. -I/home/e0082888/build-
powerpc-eabi/gcc-4.5.0/gcc/ada -g -O2 -W -Wall -Wwrite-strings -
Wstrict-prototypes -Wmissing-prototypes -gnatpg -gnata -I- /home/
e0082888/build-powerpc-eabi/gcc-4.5.0/gcc/ada/prj-strt.adb
gnatbind -I/usr/lib/gcc/i486-linux-gnu/4.4.3/adalib/../adainclude -I/
usr/lib/gcc/i486-linux-gnu/4.4.3/adalib/ -I. -I/home/e0082888/build-
powerpc-eabi/gcc-4.5.0/gcc/ada -static -x gnatmake
gnatlink -v gnatmake -o ../../gnatmake \
--GCC="gcc -static-libgcc -I/usr/lib/gcc/i486-linux-gnu/4.4.3/
adalib/../adainclude -I/usr/lib/gcc/i486-linux-gnu/4.4.3/adalib/ -I. -
I/home/e0082888/build-powerpc-eabi/gcc-4.5.0/gcc/ada" ../../
prefix.o ../../version.o targext.o link.o ../../../libiberty/
libiberty.a

GNATLINK 4.4.3
Copyright (C) 1995-2008, Free Software Foundation, Inc.
gcc -c -gnatA -gnatWb -gnatiw -static-libgcc -I/usr/lib/gcc/i486-linux-
gnu/4.4.3/adalib/../adainclude -I/usr/lib/gcc/i486-linux-gnu/4.4.3/
adalib/ -I. -I/home/e0082888/build-powerpc-eabi/gcc-4.5.0/gcc/ada -
gnatws /home/e0082888/build-powerpc-eabi/build-gcc/gcc/ada/tools/
b~gnatmake.adb
/usr/bin/gcc b~gnatmake.o ../../prefix.o ../../version.o targext.o
link.o ./alloc.o ./debug.o ./gnatvsn.o ./gnatmake.o ./rident.o ./
sfn_scan.o ./types.o ./hostparm.o ./krunch.o ./csets.o ./output.o ./
stylesw.o ./tree_io.o ./stand.o ./opt.o ./table.o ./stringt.o ./
binderr.o ./fname.o ./fname-sf.o ./fmap.o ./ali.o ./switch.o ./
sdefault.o ./sinput-c.o ./snames.o ./targparm.o ./osint.o ./butil.o ./
tempdir.o ./uintp.o ./err_vars.o ./erroutc.o ./urealp.o ./scans.o ./
mlib-utl.o ./mlib-fil.o ./mlib-tgt-specific.o ./prj-attr-pm.o ./prj-
com.o ./prj-attr.o ./mlib-tgt.o ./mlib.o ./prj-env.o ./prj-ext.o ./prj-
pp.o ./prj-util.o ./makeutl.o ./atree.o ./sinfo.o ./einfo.o ./
uname.o ./lib.o ./styleg.o ./nlists.o ./mlib-prj.o ./switch-m.o ./
usage.o ./makeusg.o ./widechar.o ./sinput.o ./fname-uf.o ./namet.o ./
osint-m.o ./scng.o ./casing.o ./ali-util.o ./errutil.o ./make.o ./prj-
err.o ./sinput-p.o ./prj-strt.o ./prj-proc.o ./prj-part.o ./prj-
pars.o ./prj-dect.o ./prj-conf.o ./prj-tree.o ./prj-nmsc.o ./prj.o -
o ../../gnatmake ../../../libiberty/libiberty.a -L./ -L/usr/lib/gcc/
i486-linux-gnu/4.4.3/adalib/../adainclude/ -L/usr/lib/gcc/i486-linux-
gnu/4.4.3/adalib/ -L./ -L/home/e0082888/build-powerpc-eabi/gcc-4.5.0/
gcc/ada/ -L/usr/lib/gcc/i486-linux-gnu/4.4.3/adalib/ /usr/lib/gcc/i486-
linux-gnu/4.4.3/adalib/libgnat.a -static-libgcc -static-libgcc -I/usr/
lib/gcc/i486-linux-gnu/4.4.3/adalib/../adainclude -I/usr/lib/gcc/i486-
linux-gnu/4.4.3/adalib/ -I. -I/home/e0082888/build-powerpc-eabi/
gcc-4.5.0/gcc/ada
../osint.o: In function `osint__is_writable_file':
/home/e0082888/build-powerpc-eabi/gcc-4.5.0/gcc/ada/osint.adb:1767:
undefined reference to `__gnat_is_writable_file_attr'
../osint.o: In function `osint__is_symbolic_link':
/home/e0082888/build-powerpc-eabi/gcc-4.5.0/gcc/ada/osint.adb:1754:
undefined reference to `__gnat_is_symbolic_link_attr'
../osint.o: In function `osint__is_regular_file':
/home/e0082888/build-powerpc-eabi/gcc-4.5.0/gcc/ada/osint.adb:1741:
undefined reference to `__gnat_is_regular_file_attr'
/home/e0082888/build-powerpc-eabi/gcc-4.5.0/gcc/ada/osint.adb:1741:
undefined reference to `__gnat_is_regular_file_attr'
From: Simon Wright on
I think your problem may be that your host compiler is an older version
(4.4.3) than the source tree you're using to build the cross compiler
(4.5.0). The recommendation is to build the host compiler first, then
use that to build the cross.

The symbols you're missing are (in 4.5.0 but not in 4.3.4, the only
handy version I have for comparison) defined in adaint.c, and it looks
as though adaint.o is being picked up from the pre-built host libraries
(not surprising, the cross-compiler has to run on the host so needs to
use host file attributes etc).