Creating and using GCJ ARM cross compiler
Matthijs van de Water
matthijs.van.de.water@gmail.com
Fri Apr 18 12:42:00 GMT 2008
Hello,
I'm trying to create an arm-linux toolchain based on GCC 4.2.3 with
working ARM EABI support, inside the Poky Linux OpenEmbedded
environment.
In order to get GCC 4.2.3 with the ARM EABI GCJ, I'm working from the
GCC SVN branch 'branches/ubuntu/gcc-4_2-branch', which should have
full ARM EABI support merged from trunk. Reason for not using GCC 4.3
is that there is no support to create a GCC 4.3-based toolchain in
OpenEmbedded yet.
I have the build process completing successfully and I now have an a
libgcj for arm and arm-poky-linux-gnueabi-gcj. When trying to use
them, I run into some trouble though, so I presume I'm still doing
something wrong (even though the build is successful).
1) arm-poky-linux-gnueabi-gcj can successfully compile an existing
.jar file into an ARM .so file (using -fPIC). So far so good.
2) arm-poky-linux-gnueabi-gcj --main=helloworld -o hello hello.java
complains about ecj1 being missing; it looks like this might be some
configure problem? Is this only a matter of putting ecj.jar with my
sources before configuring and compiling? Looking at the logs, it
seems that the /usr/bin/javac from my local system is used to compile
*.java into *.class during GCC compilation. Is that expected? The
build does not create an ecj1 executable, only a jc1. I'm currently
just using ecj1 from my Ubuntu host, which enables me to compile my
Hello World test.
How would I make sure that ecj1 is also generated in the build?
3) When I try to use the Java shared library that I compiled in (1), I
run into trouble immediately:
$ arm-poky-linux-gnueabi-g++ -g -c
-I/usr/local/poky/eabi-glibc/arm/arm-poky-linux-gnueabi/usr/include/c++/4.2.3/
-I/usr/local/poky/eabi-glibc/arm/lib/gcc/arm-poky-linux-gnueabi/4.2.3/include/
-I. test.cpp -o test.o
In file included from
/usr/local/poky/eabi-glibc/arm/arm-poky-linux-gnueabi/usr/include/c++/4.2.3/java/lang/Object.h:16,
from
/usr/local/poky/eabi-glibc/arm/arm-poky-linux-gnueabi/usr/include/c++/4.2.3/gcj/cni.h:16,
from test.cpp:2:
/usr/local/poky/eabi-glibc/arm/arm-poky-linux-gnueabi/usr/include/c++/4.2.3/gcj/javaprims.h:64:
error: stray '$' in program
[error repeated a lot of times]
If I add "-fdollars-in-identifiers" to my compile statement, it
completes without error, but I would expect this not to be necessary.
Could anyone give me some pointers to create a completely valid build?
Below are my configure options.
Regards,
Matthijs van de Water
--configure options--
gcc-4_2-branch/configure \
--build=i686-linux \
--host=i686-poky-linux \
--target=arm-poky-linux-gnueabi \
--prefix=/usr/local/poky/eabi-glibc/arm \
--exec_prefix=/usr/local/poky/eabi-glibc/arm \
--bindir=/usr/local/poky/eabi-glibc/arm/bin \
--sbindir=/usr/local/poky/eabi-glibc/arm/bin \
--libexecdir=/usr/local/poky/eabi-glibc/arm/libexec \
--datadir=/usr/local/poky/eabi-glibc/arm/share \
--sysconfdir=/usr/local/poky/eabi-glibc/arm/etc \
--sharedstatedir=/usr/local/poky/eabi-glibc/arm/share/com \
--localstatedir=/usr/local/poky/eabi-glibc/arm/var \
--libdir=/usr/local/poky/eabi-glibc/arm/lib \
--includedir=/usr/local/poky/eabi-glibc/arm/include \
--oldincludedir=/usr/local/poky/eabi-glibc/arm/include \
--infodir=/usr/local/poky/eabi-glibc/arm/share/info \
--mandir=/usr/local/poky/eabi-glibc/arm/share/man \
--enable-nls \
--disable-libssp \
--disable-bootstrap \
--disable-sjlj-exceptions \
--with-gnu-ld \
--enable-shared \
--enable-target-optspace \
--enable-languages=c,c++,fortran,java \
--enable-threads=posix \
--enable-multilib \
--enable-c99 \
--enable-long-long \
--enable-symvers=gnu \
--enable-libstdcxx-pch \
--program-prefix=arm-poky-linux-gnueabi- \
--with-local-prefix=/data/wa/svn/ohand-poky-trunk/build/tmp/staging/arm-poky-linux-gnueabi/usr
\
--with-gxx-include-dir=/data/wa/svn/ohand-poky-trunk/build/tmp/staging/arm-poky-linux-gnueabi//usr/include/c++
\
--with-sysroot=/usr/local/poky/eabi-glibc/arm/arm-poky-linux-gnueabi
\
--with-build-sysroot=/data/wa/svn/ohand-poky-trunk/build/tmp/staging/arm-poky-linux-gnueabi
\
--with-float=soft \
--disable-libunwind-exceptions \
--disable-libssp \
--disable-libgomp \
--disable-libmudflap \
--with-mpfr=/data/wa/svn/ohand-poky-trunk/build/tmp/staging/i686-linux/usr
\
--enable-__cxa_atexit
$ arm-poky-linux-gnueabi-gcj -v
Using built-in specs.
Reading specs from
/usr/local/poky.gcj/eabi-glibc/arm/bin/../lib/gcc/arm-poky-linux-gnueabi/4.2.3/../../../../arm-poky-linux-gnueabi/lib/libgcj.spec
rename spec startfile to startfileorig
rename spec lib to liborig
Target: arm-poky-linux-gnueabi
Configured with:
/data/wa/svn/ohand-poky-trunk/build/tmp/work/i686-armv6-sdk-poky-linux-gnueabi/gcc-cross-sdk-4.2.3-ubuntu-r4/gcc-4_2-branch/configure
--build=i686-linux --host=i686-poky-linux
--target=arm-poky-linux-gnueabi
--prefix=/usr/local/poky/eabi-glibc/arm
--exec_prefix=/usr/local/poky/eabi-glibc/arm
--bindir=/usr/local/poky/eabi-glibc/arm/bin
--sbindir=/usr/local/poky/eabi-glibc/arm/bin
--libexecdir=/usr/local/poky/eabi-glibc/arm/libexec
--datadir=/usr/local/poky/eabi-glibc/arm/share
--sysconfdir=/usr/local/poky/eabi-glibc/arm/etc
--sharedstatedir=/usr/local/poky/eabi-glibc/arm/share/com
--localstatedir=/usr/local/poky/eabi-glibc/arm/var
--libdir=/usr/local/poky/eabi-glibc/arm/lib
--includedir=/usr/local/poky/eabi-glibc/arm/include
--oldincludedir=/usr/local/poky/eabi-glibc/arm/include
--infodir=/usr/local/poky/eabi-glibc/arm/share/info
--mandir=/usr/local/poky/eabi-glibc/arm/share/man --enable-nls
--disable-libssp --disable-bootstrap --disable-sjlj-exceptions
--with-gnu-ld --enable-shared --enable-target-optspace
--enable-languages=c,c++,fortran,java --enable-threads=posix
--enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu
--enable-libstdcxx-pch --program-prefix=arm-poky-linux-gnueabi-
--with-local-prefix=/data/wa/svn/ohand-poky-trunk/build/tmp/staging/arm-poky-linux-gnueabi/usr
--with-gxx-include-dir=/data/wa/svn/ohand-poky-trunk/build/tmp/staging/arm-poky-linux-gnueabi//usr/include/c++
--with-sysroot=/usr/local/poky/eabi-glibc/arm/arm-poky-linux-gnueabi
--with-build-sysroot=/data/wa/svn/ohand-poky-trunk/build/tmp/staging/arm-poky-linux-gnueabi
--with-float=soft --disable-libunwind-exceptions --disable-libssp
--disable-libgomp --disable-libmudflap
--with-mpfr=/data/wa/svn/ohand-poky-trunk/build/tmp/staging/i686-linux/usr
--enable-__cxa_atexit
Thread model: posix
gcc version 4.2.3
More information about the Java
mailing list