Re: ecj1 in cross-compile

Andrew Haley <[email protected]>
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
Daniel Andrzejewski wrote:

> 
> Hi Andrew,
> 
> Thank you for your reply. 
> 
> I'm going to try 'make check-target-libjava', but for now it looks like I
> found the solution to my compilation problem:
> 
> export CLASSPATH=.:/home/scratch/daniel/:/sw/java-jdk/ecj.jar
> 
> ~> /scratch/daniel> gcj --main=HelloWorld -o HelloWorld HelloWorld.java
> ~> /scratch/daniel> ./HelloWorld
> Hello World!

I have not the slightest idea why that should make any difference.  After
all, your ecj1 script set the classpath.  But I never understood what was
causing your problem anyway.

> Success! But ...
> 
> ~> /scratch/daniel> file HelloWorld
> 
> HelloWorld: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for
> GNU/Linux 2.4.1, dynamically linked (uses shared libs), not stripped
> 
> ~> /scratch/daniel> ldd HelloWorld
>         libm.so.6 => /lib64/tls/libm.so.6 (0x00002b1b953be000)
>         libpthread.so.0 => /lib64/tls/libpthread.so.0 (0x00002b1b95515000)
>         librt.so.1 => /lib64/tls/librt.so.1 (0x00002b1b95629000)
>         libz.so.1 => /lib64/libz.so.1 (0x00002b1b95732000)
>         libdl.so.2 => /lib64/libdl.so.2 (0x00002b1b95845000)
>         libc.so.6 => /lib64/tls/libc.so.6 (0x00002b1b95948000)
>         /lib64/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2
> (0x00002b1b952a7000)
> 
> 
> I really need to build gcc with static libraries, so my final result would
> look like this:
> 
> daniel@acai ~/mpi> ldd hello
>         not a dynamic executable

That path is fraught with pain and disaster.  Java is inherently a dynamic
language and many components use runtime class lookup, so statically
linking fails.  However, after a lot of difficulties some people on this
list have successfully statically linked with gcj; perhaps they can help you.

Andrew.
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.