delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/06/18/13:20:28

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Fri, 18 Jun 2004 19:20:13 +0200
From: "Gerrit P. Haase" <freeweb AT nyckelpiga DOT de>
Reply-To: "Gerrit P. Haase" <freeweb AT nyckelpiga DOT de>
Organization: Esse keine toten Tiere
Message-ID: <115-389295928.20040618192013@familiehaase.de>
To: =?koi8-r?B?4czFy9PFyiDswMLJzc/X?= <alexeipobox AT mtu-net DOT ru>
CC: cygwin AT cygwin DOT com
Subject: Re: gcj: error during genaration of object code (ld cannot find -liconv)
In-Reply-To: <000201c45549$02ced720$9d61bcd4@ael>
References: <000201c45549$02ced720$9d61bcd4 AT ael>
MIME-Version: 1.0

Hello Alexey,


> my question is: if I try to run `gcj' without `-C' option then I get the
> error from ld:

> $cat HelloWorldApp.java

> /**
>  * The HelloWorldApp class implements an application that
>  * simply displays "Hello World!" to the standard output.
>  */
> class HelloWorldApp {
>     public static void main(String[] args) {
>         System.out.println("Hello World!"); //Display the string.
>     }
> }

> $ gcj HelloWorldApp.java

> /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/../../../../i686-pc-cygwin/bin/ld:
> cannot find -liconv
> collect2: ld returned 1 exit status



> What does this mean? How to avoid the problem?
> Note: `$gcj -C HelloWoldApp.java' is Ok and generates HelloWorldApp.class.

You need to specify to gcj what it should do, obviously there is no
useful default setting.

If you specify `-C' the manpage says:

 -C  This option is used to tell gcj to generate bytecode (.class files)
           rather than object code.


I would expect that you get an error like this without specifying
anything:
$ gcj Foo.java
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/../../../libcygwin.a(libcmain.o)(.text+0x7a): undefined reference to `_WinMain AT 16'
collect2: ld returned 1 exit status



Anyway, if you want to build an executable, you say s.th. like this:
  $ gcj --main=Foo -o Foo Foo.java
and to get bytecode you say:
  $ gcj -C Foo.java



Gerrit
-- 
=^..^=                                     http://nyckelpiga.de/donate.html


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019