Building an ARM cross compiler
Johannes Pfau
spam at example.com
Mon Nov 15 11:41:19 PST 2010
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=1 -D_DH=1
-DD_NO_TRAMPOLINES=1 -DELFOBJ=1 -DLIBPHOBOS=\"-lgphobos2\"
-DLIBPHOBOS_PROFILE=\"-lgphobos2\" -DLIBDRUNTIME=\"-lgdruntime\"
-DLIBDRUNTIME_PROFILE=\"-lgdruntime\" -DD_GCC_VER=44 -Wno-missing-braces
-fmessage-length=0 -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-qual
-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=1 -D_DH=1
-DD_NO_TRAMPOLINES=1 -DELFOBJ=1 -DLIBPHOBOS=\"-lgphobos2\"
-DLIBPHOBOS_PROFILE=\"-lgphobos2\" -DLIBDRUNTIME=\"-lgdruntime\"
-DLIBDRUNTIME_PROFILE=\"-lgdruntime\" -DD_GCC_VER=44 -Wno-missing-braces
-fmessage-length=0 -Wl,--hash-style=gnu -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ück
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=C but I think
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 and
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
More information about the D.gnu
mailing list