Re: Crosscompile of ecjx fails

David Daney <[email protected]>
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
Eduardo Costa wrote:
> I'm doing a canadian cross with build=x86_64-linux, host=mingw32,
> target=arm-eabi. Everything is fine, except gcj. For some reason, when I
> compile ecjx, it uses "target" to compile ecjx.o and "host" to compile ecjx:
> 

It is indeed somewhat broken for building cross compilers.  Your 
workaround may be the best solution, unless you feel like doing some 
hacking on the libgcj Makefiles.

David Daney


> $ make ecjx
> depbase=`echo ecjx.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; \
>         if arm-eabi-c++  -DHAVE_CONFIG_H -I. -I../../../../gcc-4.4.0/libjava
> -I./include -I./gcj  -I../../../../gcc-4.4.0/libjava -Iinclude
> -I../../../../gcc-4.4.0/libjava/include
> -I../../../../gcc-4.4.0/libjava/classpath/include -Iclasspath/include
> -I../../../../gcc-4.4.0/libjava/classpath/native/fdlibm
> -I../../../../gcc-4.4.0/libjava/../boehm-gc/include -I../boehm-gc/include  
> -I../../../../gcc-4.4.0/libjava/.././libjava/../gcc
> -I../../../../gcc-4.4.0/libjava/../zlib   -fno-rtti -fnon-call-exceptions 
> -fdollars-in-identifiers -Wswitch-enum -D_FILE_OFFSET_BITS=64 -Wextra -Wall
> -D_GNU_SOURCE -DPREFIX="\"/home/ecosta/devkitpro/devkitARM\""
> -DTOOLEXECLIBDIR="\"/home/ecosta/devkitpro/devkitARM/arm-eabi/lib\""
> -DJAVA_HOME="\"/home/ecosta/devkitpro/devkitARM\""
> -DBOOT_CLASS_PATH="\"/home/ecosta/devkitpro/devkitARM/share/java/libgcj-4.4.0.jar\""
> -DJAVA_EXT_DIRS="\"/home/ecosta/devkitpro/devkitARM/share/java/ext\""
> -DGCJ_ENDORSED_DIRS="\"/home/ecosta/devkitpro/devkitARM/share/java/gcj-endorsed\""
> -DGCJ_VERSIONED_LIBDIR="\"/home/ecosta/devkitpro/devkitARM/lib/gcj-4.4.0-10\""
> -DPATH_SEPARATOR="\":\""
> -DECJ_JAR_FILE="\"/home/ecosta/devkitpro/devkitARM/libexec/ecj-4.3.jar\""
> -DLIBGCJ_DEFAULT_DATABASE="\"/home/ecosta/devkitpro/devkitARM/lib/gcj-4.4.0-10/classmap.db\""
> -DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL="\"gcj-4.4.0-10/classmap.db\"" -g -O2  
> -MT ecjx.o -MD -MP -MF "$depbase.Tpo" -c -o ecjx.o
> ../../../../gcc-4.4.0/libjava/ecjx.cc; \
>         then mv -f "$depbase.Tpo" "$depbase.Po"; else rm -f "$depbase.Tpo";
> exit 1; fi
> mingw32-gcj -o ecjx -findirect-dispatch
> --main=org.eclipse.jdt.internal.compiler.batch.GCCMain  ecjx.o
> /home/ecosta/cross/lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld: unknown
> architecture of input file `ecjx.o' is incompatible with i386 output
> collect2: ld returned 1 exit status
> make: *** [ecjx] Error 1
> 
> Shouldn't it use "mingw32-c++" and "mingw32-gcj"? Why it uses "arm-eabi-c++"
> instead?
> 
> BTW, when I crosscompiled the mingw32 toolchain, I got the same problem (it
> uses "native-g++" to compile ecjx.o and "mingw32-gcj" to compile ecjx). This
> I solved by not compiling java... :)
> 
> An ugly workaround is compile it with:
> 
> make CXX=mingw-c++ ecjx
> 
> It generates a windows executable (without the .exe extension) - nasty, but
> works...
> 
> Configured with:
> 
> CFLAGS_FOR_TARGET="-O2" ../gcc-*/configure \
>   --build=x86_64-redhat-linux --host=mingw32 --target=arm-eabi \
>   --prefix=/home/ecosta/cross --disable-nls \
>   --enable-languages=c,c++,objc,java \
>   --with-cpu=arm7tdmi\
>   --enable-interwork --disable-multilib \
>   --with-gcc --with-gnu-ld --with-gnu-as \
>   --disable-shared --disable-threads --disable-win32-registry --disable-nls
> --disable-debug \
>   --disable-libmudflap --disable-libssp --disable-libgomp \
>   --disable-libstdcxx-pch \
>   --enable-libgcj
>   --disable-getenv-properties --disable-hash-synchronization
> --disable-interpreter
>   --disable-java-net --disable-jvmpi --enable-reduced-reflection
> --without-libffi --without-x \
>   --with-ecj-jar=/home/ecosta/cross/libexec/ecj-4.3.jar  \
>   --with-newlib \
>   --without-headers \
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.