Subject: Cross-compile for ARM
From: Toon Claes <[email-masked]>
To: [email-masked]
Date: Thu, 28 Jul 2011 20:53:40 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

I was trying to cross-compile emacs for ARM (don't ask me why).
But got an error during 'make' (see output below FIRST RUN).

So it's for sure 'test-distrub' was build for ARM, while it is trying to run on i686.

On the second run (just, ran 'make again), I got a similar error on 'prefix-args'.
But for some reason the 'test-distrub' error is gone (probably because 'make' thinks it is already finished.

So I have to compile them with the host compiler (i686).
But I'm not sure how to implement this properly.

Also I would like to get rid of the warning: "LIB_GCC" redefined

Regards,
Toon

-------------- FIRST RUN -------------------
system call: make
cd lib-src; make all                            \
          CC='arm-none-linux-gnueabi-gcc' CFLAGS='-DHAVE_STRERROR' CPPFLAGS='-D_BSD_SOURCE  ' \
          LDFLAGS='-L/home/toon/sandbox/os/Sync/imx31d/Archives -L/home/toon/sandbox/os/Sync/imx31d/Libs -Wl,-znocombreloc ' MAKE='make'
make[1]: Entering directory `/home/toon/sandbox/os/Build/imx31d/emacs-23.3/lib-src'
arm-none-linux-gnueabi-gcc -D_BSD_SOURCE -DHAVE_CONFIG_H -I. -I../src -I/home/toon/sandbox/os/Build/imx31d/emacs-23.3/lib-src -I/home/toon/sandbox/os/Build/imx31d/emacs-23.3/lib-src/../src -L/home/toon/sandbox/os/Sync/imx31d/Archives -L/home/toon/sandbox/os/Sync/imx31d/Libs -Wl,-znocombreloc  -D_BSD_SOURCE   -DHAVE_STRERROR -o test-distrib /home/toon/sandbox/os/Build/imx31d/emacs-23.3/lib-src/test-distrib.c
In file included from ../src/config.h:1075,
                 from /home/toon/sandbox/os/Build/imx31d/emacs-23.3/lib-src/test-distrib.c:23:
../src/m/arm.h:42:1: warning: "LIB_GCC" redefined
In file included from ../src/config.h:1074,
                 from /home/toon/sandbox/os/Build/imx31d/emacs-23.3/lib-src/test-distrib.c:23:
../src/s/gnu-linux.h:200:1: warning: this is the location of the previous definition
./test-distrib /home/toon/sandbox/os/Build/imx31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\M-e^C0b\M-`Ca\M-0\M-a\M-p\M-^G\M-=^H^@@\M- \M-c^AP\M- \M-a\t^@\M- \M-a^H^P\M- \M-a^G \M- \M-a^O\M-`\M- \M-a^D\M-p\M-^U\M-d^A@\M-^D\M-b^D^@V\M-a\M-w\M-^?\M-^?^Z\M-p\M-^G\M-=\M-h$\M-^B^@^@^L\M-^?\M-^?\M-^?^P\M-^?\M-^?\M-^?^D\M-`-\M-e^D\M-PM\M-b^DЍ\M-b^@\M-^@\M-=\M-h^A^@^B^@Usage: %s testfile\n^@Data in file `%s
./test-distrib:18: command not found: Most
./test-distrib:19: command not found: have
./test-distrib:39: unmatched '
make[1]: *** [test-distrib] Error 127

-------------- SECOND RUN -------------------
arm-none-linux-gnueabi-gcc -c -D_BSD_SOURCE   -Demacs -DHAVE_CONFIG_H  -I. -I/home/toon/sandbox/os/Build/imx31d/emacs-23.3/src -D_BSD_SOURCE     -DHAVE_STRERROR -MMD -MF deps/prefix-args.d prefix-args.c
In file included from ./config.h:1075,
                 from prefix-args.c:46:
./m/arm.h:42:1: warning: "LIB_GCC" redefined
In file included from ./config.h:1074,
                 from prefix-args.c:46:
./s/gnu-linux.h:200:1: warning: this is the location of the previous definition
arm-none-linux-gnueabi-gcc -Demacs -DHAVE_CONFIG_H  -I. -I/home/toon/sandbox/os/Build/imx31d/emacs-23.3/src -D_BSD_SOURCE     -DHAVE_STRERROR -MMD -MF deps/.d -L/home/toon/sandbox/os/Sync/imx31d/Archives -L/home/toon/sandbox/os/Sync/imx31d/Libs -Wl,-znocombreloc  prefix-args.o -o prefix-args
arm-none-linux-gnueabi-gcc -nostdlib `./prefix-args -Xlinker  -z nocombreloc` -L/home/toon/sandbox/os/Sync/imx31d/Archives -L/home/toon/sandbox/os/Sync/imx31d/Libs -Wl,-znocombreloc  -o temacs pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o dispnew.o frame.o scroll.o xdisp.o menu.o  window.o charset.o coding.o category.o ccl.o character.o chartab.o cm.o term.o terminal.o xfaces.o    emacs.o keyboard.o macros.o keymap.o sysdep.o buffer.o filelock.o insdel.o marker.o minibuf.o fileio.o dired.o filemode.o cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o alloc.o data.o doc.o editfns.o callint.o eval.o floatfns.o fns.o font.o print.o lread.o syntax.o unexelf.o bytecode.o process.o callproc.o region-cache.o sound.o atimer.o doprnt.o strftime.o intervals.o textprop.o composite.o md5.o     terminfo.o lastfile.o   vm-limit.o  mktime.o       -lncurses   -lgcc_s -lm -lgcc -lc -lgcc /usr/lib/crtn.o -lgcc_s
zsh:1: exec format error: ./prefix-args
/home/toon/sandbox/os/Ref/imx31d/imx31-toolchain/Imx31/bin/../lib/gcc/arm-none-linux-gnueabi/4.1.2/../../../../arm-none-linux-gnueabi/bin/ld: /usr/lib/crt1.o: Relocations in generic ELF (EM: 3)
/home/toon/sandbox/os/Ref/imx31d/imx31-toolchain/Imx31/bin/../lib/gcc/arm-none-linux-gnueabi/4.1.2/../../../../arm-none-linux-gnueabi/bin/ld: /usr/lib/crt1.o: Relocations in generic ELF (EM: 3)
/home/toon/sandbox/os/Ref/imx31d/imx31-toolchain/Imx31/bin/../lib/gcc/arm-none-linux-gnueabi/4.1.2/../../../../arm-none-linux-gnueabi/bin/ld: /usr/lib/crt1.o: Relocations in generic ELF (EM: 3)
/usr/lib/crt1.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[1]: *** [temacs] Error 1
make[1]: Leaving directory `/home/toon/sandbox/os/Build/imx31d/emacs-23.3/src'
make: *** [src] Error 2