Building an ARM cross compiler

Iain Buclaw ibuclaw at ubuntu.com
Mon Nov 15 12:20:01 PST 2010


== Quote from Johannes Pfau (spam at example.com)'s article
> Hi, has anyone successfully built an arm cross compiler yet?
> GCC: 4.4.5 GDC: Latest D2 (r357)
> I always get the following error:
> -----------------------------------------------------------------
> i686-pc-linux-gnu-gcc  -O2 -pipe -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -=
> W  =
> -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes  =
> -Wcast-qual    -DHAVE_CONFIG_H -I. -Id -I../../gcc-4.4.5-build/gcc  =
> -I../../gcc-4.4.5-build/gcc/d -I../../gcc-4.4.5-build/gcc/../include  =
> -I../../gcc-4.4.5-build/gcc/../libcpp/include   =
> -I../../gcc-4.4.5-build/gcc/../libdecnumber  =
> -I../../gcc-4.4.5-build/gcc/../libdecnumber/dpd -I../libdecnumber   =
> -I/include -DCLOOG_PPL_BACKEND   -I. -Id -I../../gcc-4.4.5-build/gcc  =
> -I../../gcc-4.4.5-build/gcc/d -I../../gcc-4.4.5-build/gcc/../include  =
> -I../../gcc-4.4.5-build/gcc/../libcpp/include   =
> -I../../gcc-4.4.5-build/gcc/../libdecnumber  =
> -I../../gcc-4.4.5-build/gcc/../libdecnumber/dpd -I../libdecnumber   =
> -I/include -DCLOOG_PPL_BACKEND  -I../../gcc-4.4.5-build/gcc/d  =
> -I../../gcc-4.4.5-build/gcc/d/dmd2 -Id -D_GNU_SOURCE=3D1 -D_DH=3D1  =
> -DD_NO_TRAMPOLINES=3D1 -DELFOBJ=3D1 -DLIBPHOBOS=3D\"-lgphobos2\"  =
> -DLIBPHOBOS_PROFILE=3D\"-lgphobos2\" -DLIBDRUNTIME=3D\"-lgdruntime\"  =
> -DLIBDRUNTIME_PROFILE=3D\"-lgdruntime\" -DD_GCC_VER=3D44 -Wno-missing-br=
> aces  =
> -fmessage-length=3D0 -o d/d-c-stubs.cglue.o -c  =
> ../../gcc-4.4.5-build/gcc/d/d-c-stubs.c
> i686-pc-linux-gnu-g++  -O2 -pipe -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -=
> W  =
> -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qu=
> al  =
> -Wold-style-definition -Wc++-compat -Wmissing-format-attribute -pedantic=
>   =
> -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings    =
> -DHAVE_CONFIG_H -I. -I. -I../../gcc-4.4.5-build/gcc  =
> -I../../gcc-4.4.5-build/gcc/. -I../../gcc-4.4.5-build/gcc/../include  =
> -I../../gcc-4.4.5-build/gcc/../libcpp/include   =
> -I../../gcc-4.4.5-build/gcc/../libdecnumber  =
> -I../../gcc-4.4.5-build/gcc/../libdecnumber/dpd -I../libdecnumber   =
> -I/include -DCLOOG_PPL_BACKEND   -I. -I. -I../../gcc-4.4.5-build/gcc  =
> -I../../gcc-4.4.5-build/gcc/. -I../../gcc-4.4.5-build/gcc/../include  =
> -I../../gcc-4.4.5-build/gcc/../libcpp/include   =
> -I../../gcc-4.4.5-build/gcc/../libdecnumber  =
> -I../../gcc-4.4.5-build/gcc/../libdecnumber/dpd -I../libdecnumber   =
> -I/include -DCLOOG_PPL_BACKEND  -I../../gcc-4.4.5-build/gcc/d  =
> -I../../gcc-4.4.5-build/gcc/d/dmd2 -Id -D_GNU_SOURCE=3D1 -D_DH=3D1  =
> -DD_NO_TRAMPOLINES=3D1 -DELFOBJ=3D1 -DLIBPHOBOS=3D\"-lgphobos2\"  =
> -DLIBPHOBOS_PROFILE=3D\"-lgphobos2\" -DLIBDRUNTIME=3D\"-lgdruntime\"  =
> -DLIBDRUNTIME_PROFILE=3D\"-lgdruntime\" -DD_GCC_VER=3D44 -Wno-missing-br=
> aces  =
> -fmessage-length=3D0 -Wl,--hash-style=3Dgnu -Wl,--as-needed -o cc1d \
> 		d/id.gen.o d/impcnvtab.gen.o attribs.o cppdefault.o stub-objc.o prefix=
> .o  =
> arm-c.o gimplify.o tree-iterator.o  d/aav.dmd.o d/access.dmd.o  =
> d/aliasthis.dmd.o d/array.dmd.o d/arrayop.dmd.o d/async.dmd.o  =
> d/attrib.dmd.o d/cast.dmd.o d/class.dmd.o d/clone.dmd.o d/cond.dmd.o  =
> d/constfold.dmd.o d/dchar.dmd.o d/declaration.dmd.o d/delegatize.dmd.o  =
> d/doc.dmd.o d/dsymbol.dmd.o d/dump.dmd.o d/entity.dmd.o d/enum.dmd.o  =
> d/expression.dmd.o d/func.dmd.o d/gnuc.dmd.o d/hdrgen.dmd.o d/html.dmd.o=
>   =
> d/identifier.dmd.o d/imphint.dmd.o d/import.dmd.o d/init.dmd.o  =
> d/inline.dmd.o d/interpret.dmd.o d/json.dmd.o d/lexer.dmd.o  =
> d/lstring.dmd.o d/macro.dmd.o d/mangle.dmd.o d/mars.dmd.o d/mtype.dmd.o =
>  =
> d/module.dmd.o d/opover.dmd.o d/optimize.dmd.o d/parse.dmd.o d/rmem.dmd.=
> o  =
> d/root.dmd.o d/scope.dmd.o d/speller.dmd.o d/statement.dmd.o  =
> d/staticassert.dmd.o d/stringtable.dmd.o d/struct.dmd.o d/template.dmd.o=
>   =
> d/todt.dmd.o d/toobj.dmd.o d/typinf.dmd.o d/unialpha.dmd.o d/utf.dmd.o  =
> d/unittests.dmd.o d/version.dmd.o d/builtin.dmd.o d/traits.dmd.o  =
> d/d-lang.glue.o d/d-decls.glue.o d/d-codegen.glue.o d/d-objfile.glue.o  =
> d/d-irstate.glue.o d/d-glue.glue.o d/d-convert.glue.o d/d-todt.glue.o  =
> d/d-gcc-real.glue.o d/d-gt.cglue.o d/d-builtins.cglue.o d/d-misc.cglue.o=
>   =
> d/d-builtins2.glue.o d/symbol.glue.o d/asmstmt.glue.o d/dt.glue.o  =
> d/d-cppmngl.glue.o d/d-c-stubs.cglue.o main.o  libbackend.a  =
> ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a -L/lib -lcloog  -lmpfr=
>   =
> -lgmp ../libcpp/libcpp.a   ../libiberty/libiberty.a  =
> ../libdecnumber/libdecnumber.a
> arm-c.o: In function `arm_output_c_attributes':
> arm-c.c:(.text+0x7): undefined reference to `c_global_trees'
> collect2: ld gab 1 als Ende-Status zur=C3=BCck
> make[1]: *** [cc1d] Fehler 1
> make[1]: Leaving directory  =
> `/var/abs/local/cross-arm-elf-gdc2-hg/src/gcc-build/gcc'
> make: *** [all-gcc] Fehler 2
> -----------------------------------------------------------------
> (Sorry about the German error messages, forgot to use LANG=3DC but I thi=
> nk  =
> the most important part is in English anyway)
> As the error message states the c_global_trees symbol is not linked in. =
>  =
> It's used in arm-c.c and defined in c-common.c. Just linking against  =
> c-common.o isn't enough though as c-common needs more object files to be=
>   =
> linked against.
> This seems to be a D frontend related problem, building a gcc c cross  =
> compiler works. I tried building a native compiler on the arm machine an=
> d  =
> that worked (but it's painfully slow), so it's likely a cross compiler  =
> only problem.
> I used the following script (custom Archlinux PKGBUILD, based on the  =
> cross-arm-elf-gcc-base and gdc2-hg PKGBUILDS):
> http://pastebin.ca/1992505
> -- =
> Johannes Pfau


There's a patch in Debian which addresses this. Last time I tried (a nice fella
allowed me to work via ssh'ing onto a sheevaplug) it mostly works, but you'll need
to use the gcstub sources, as the normal gc don't work (2.035~ish time this was I
think, so things may have improved since).

Regards


More information about the D.gnu mailing list