* [GCC 4.4.0 / 4.4.1] GCJ - ecj1: undefined symbol: JvRunMainName, In function `_Jv_platform_nanotime()': undefined reference to "clock_gettime"
@ 2009-07-23 21:39 Piotr D. Kaczorowski
2009-07-24 9:09 ` Andrew Haley
0 siblings, 1 reply; 2+ messages in thread
From: Piotr D. Kaczorowski @ 2009-07-23 21:39 UTC (permalink / raw)
To: java
Hello there!
I'd like to build GCC 4.4.1 with GCJ on Centos 5.3 and have some
problems with that.
Description:
I'm using vanilla gcc source with gmp-4.2.4 and mpfr-2.3.2.
This is my configuration line:
./configure --program-suffix=44 --enable-languages=c,c++,java
--with-ecj-jar=/usr/src/ecj/ecj.jar
ecj.jar is from FC11. GCC 4.4 with GCJ works on that system.
Problems:
1) undefined symbol: JvRunMainName
[piotr@localhost gcj-3]$ gcj44 Foo.java
/usr/local/libexec/gcc/i686-pc-linux-gnu/4.4.1/ecj1: symbol lookup
error: /usr/local/libexec/gcc/i686-pc-linux-gnu/4.4.1/ecj1: undefined
symbol: JvRunMainName
2) static linking (http://gcc.gnu.org/wiki/Statically_linking_libgcj)
Small program:
public class Foo
{
public static void main(String args[])
{
System.out.println("Hello.");
}
}
[piotr@localhost gcj-3]$ gcj -c Foo.java
[piotr@localhost gcj-3]$ gcj --main=Foo -save-temps Foo.java
[piotr@localhost gcj-3]$ gcc -o Foo Foo.o Foomain.i -shared-libgcc
-Wl,-non_shared -lgcj -Wl,-call_shared -lsupc++ -Wl,--as-needed -lz
-lgcc_s -lpthread -lc -lm -ldl -Wl,--no-as-needed
/usr/local/lib/libgcj.a(posix.o): In function `_Jv_platform_nanotime()':
posix.cc:(.text+0xa0): undefined reference to `clock_gettime'
collect2: ld returned 1 exit status
How can I overcome those problems?
Regards,
Piotr
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [GCC 4.4.0 / 4.4.1] GCJ - ecj1: undefined symbol: JvRunMainName, In function `_Jv_platform_nanotime()': undefined reference to "clock_gettime"
2009-07-23 21:39 [GCC 4.4.0 / 4.4.1] GCJ - ecj1: undefined symbol: JvRunMainName, In function `_Jv_platform_nanotime()': undefined reference to "clock_gettime" Piotr D. Kaczorowski
@ 2009-07-24 9:09 ` Andrew Haley
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Haley @ 2009-07-24 9:09 UTC (permalink / raw)
To: Piotr D. Kaczorowski; +Cc: java
On 07/23/2009 11:38 PM, Piotr D. Kaczorowski wrote:
>
> Hello there!
>
> I'd like to build GCC 4.4.1 with GCJ on Centos 5.3 and have some
> problems with that.
>
>
> Description:
>
> I'm using vanilla gcc source with gmp-4.2.4 and mpfr-2.3.2.
>
> This is my configuration line:
> ./configure --program-suffix=44 --enable-languages=c,c++,java
> --with-ecj-jar=/usr/src/ecj/ecj.jar
>
> ecj.jar is from FC11. GCC 4.4 with GCJ works on that system.
Hmm. The usual ecj.jar is the one in:
$ cksum /usr/share/java/ecj.jar
3248650573 1442090 /usr/share/java/ecj.jar
It's worth checking that.
> Problems:
>
> 1) undefined symbol: JvRunMainName
>
> [piotr@localhost gcj-3]$ gcj44 Foo.java
> /usr/local/libexec/gcc/i686-pc-linux-gnu/4.4.1/ecj1: symbol lookup
> error: /usr/local/libexec/gcc/i686-pc-linux-gnu/4.4.1/ecj1: undefined
> symbol: JvRunMainName
Hard to say. Maybe a LD_LIBRARY_PATH issue? Have you moved ecj
or its libraries from where it was installed? Try
ldd /usr/local/libexec/gcc/i686-pc-linux-gnu/4.4.1/ecj1
> 2) static linking (http://gcc.gnu.org/wiki/Statically_linking_libgcj)
>
> Small program:
> public class Foo
> {
> public static void main(String args[])
> {
> System.out.println("Hello.");
> }
> }
>
> [piotr@localhost gcj-3]$ gcj -c Foo.java
> [piotr@localhost gcj-3]$ gcj --main=Foo -save-temps Foo.java
> [piotr@localhost gcj-3]$ gcc -o Foo Foo.o Foomain.i -shared-libgcc
> -Wl,-non_shared -lgcj -Wl,-call_shared -lsupc++ -Wl,--as-needed -lz
> -lgcc_s -lpthread -lc -lm -ldl -Wl,--no-as-needed
> /usr/local/lib/libgcj.a(posix.o): In function `_Jv_platform_nanotime()':
> posix.cc:(.text+0xa0): undefined reference to `clock_gettime'
> collect2: ld returned 1 exit status
I don't really know. Maybe you just need to refer to libc before libgcj.
Statically linking libgcj is *not* something you can just do from a recipe.
You have to understand how linking works, and when finding problems like
this you have to be prepared to investigate yourself.
Andrew.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-07-24 9:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-23 21:39 [GCC 4.4.0 / 4.4.1] GCJ - ecj1: undefined symbol: JvRunMainName, In function `_Jv_platform_nanotime()': undefined reference to "clock_gettime" Piotr D. Kaczorowski
2009-07-24 9:09 ` Andrew Haley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).