From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29834 invoked by alias); 24 Jul 2009 09:09:31 -0000 Received: (qmail 29823 invoked by uid 22791); 24 Jul 2009 09:09:30 -0000 X-SWARE-Spam-Status: No, hits=0.1 required=5.0 tests=AWL,BAYES_50,J_CHICKENPOX_33,J_CHICKENPOX_34,J_CHICKENPOX_46,J_CHICKENPOX_71,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 24 Jul 2009 09:09:21 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6O99GGw016743; Fri, 24 Jul 2009 05:09:17 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6O99F9C020767; Fri, 24 Jul 2009 05:09:15 -0400 Received: from pearl.pink (vpn-12-128.rdu.redhat.com [10.11.12.128]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6O99DVD021623; Fri, 24 Jul 2009 05:09:14 -0400 Message-ID: <4A697A3A.5090906@redhat.com> Date: Fri, 24 Jul 2009 09:09:00 -0000 From: Andrew Haley User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: "Piotr D. Kaczorowski" CC: java@gcc.gnu.org Subject: Re: [GCC 4.4.0 / 4.4.1] GCJ - ecj1: undefined symbol: JvRunMainName, In function `_Jv_platform_nanotime()': undefined reference to "clock_gettime" References: <4A68D868.3030903@directdreams.com> In-Reply-To: <4A68D868.3030903@directdreams.com> Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2009-07/txt/msg00060.txt.bz2 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.