This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

static linking


Hi all,

I have a problem with gcj. I have read couple threads here, but I still have no idea how to fix my problem. Usually people say that this is hard but doable, but they don't give much directions.

I'm trying to do it for a system where there's no shared libraries, so I must not even dynamically link libc.

I successfully build gcc 4.3.0 with --disable-shared option. I can successfully compile a java program, but the executable is still dynamically linked.

/scratch/daniel> ldd ./HelloWorld
        libz.so.1 => /lib64/libz.so.1 (0x00002adcd28dd000)
        libpthread.so.0 => /lib64/tls/libpthread.so.0 (0x00002adcd29f0000)
        libc.so.6 => /lib64/tls/libc.so.6 (0x00002adcd2b04000)
        libm.so.6 => /lib64/tls/libm.so.6 (0x00002adcd2d26000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00002adcd2e7d000)
        librt.so.1 => /lib64/tls/librt.so.1 (0x00002adcd2f80000)
        /lib64/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00002adcd27c6000)

When I use -static flag while compiling I get some warnings, but the executable gets compiled.

/scratch/daniel> gcj --main=HelloWorld -o HelloWorld -static HelloWorld.java

...
warnings
...
/scratch/daniel> file HelloWorld
HelloWorld: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.4.1, statically linked, not stripped



And the problem is at the runtime:


/scratch/daniel> ./HelloWorld
Aborted


Has anyone solved this issue yet?


Thank you for you response.

Daniel Andrzejewski

--
Daniel Andrzejewski
student IT Administrator
Elec Engr & Comp Science
University of Tennessee
(865) 974 - 4388 (work)

"Investment in knowledge always pays the best interest" Benjamin Franklin
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]