public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: NewBie: ld linker problem
  2000-04-01  0:00 NewBie: ld linker problem indio
@ 2000-04-01  0:00 ` Tom Tromey
  2000-04-01  0:00   ` Bryce McKinlay
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2000-04-01  0:00 UTC (permalink / raw)
  To: indio; +Cc: java-discuss

>>>>> ">" == indio  <indio@technologist.com> writes:

>>     The program (little) works fine. I am trying link it now with libgcj:
>> ld -o little.o -lgcj little
>>     But something is wrong. What?

Don't do that.  Use gcj to link.  gcj links in all the libraries you
need, behind your back.

For instance:

>> /usr/local/lib/libgcj.so: undefined reference to `deflate'

You need zlib.

>> /usr/local/lib/libgcj.so: undefined reference to `GC_obj_kinds'

You need the GC.

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

* NewBie: ld linker problem
@ 2000-04-01  0:00 indio
  2000-04-01  0:00 ` Tom Tromey
  0 siblings, 1 reply; 8+ messages in thread
From: indio @ 2000-04-01  0:00 UTC (permalink / raw)
  To: java-discuss

    Hello!

    I'm a NewBie with the "ld" linker.
    I compiled a little program with gcj:

    > gcj --main=LittleProgram -o little LittleProgram.java

    The program (little) works fine. I am trying link it now with libgcj:

    > ld -o little.o -lgcj little

    But something is wrong. What?

    little: In function `fde_split': 
/tmp/gcc-2.95.2/gcc/frame.c(*ABS*+0x8054984): multiple definition of
`_DYNAMIC'/usr/local/lib/libgcj.so(.dynamic+0x0): first defined here little:
In function `fde_split': /tmp/gcc-2.95.2/gcc/frame.c(*ABS*+0x8051244): multiple
definition of `_etext' /tmp/gcc-2.95.2/gcc/frame.c(*ABS*+0x8054a4c): multiple
definition of `__bss_star t' /tmp/gcc-2.95.2/gcc/frame.c(*ABS*+0x8054a4c):
multiple definition of `_edata' /tmp/gcc-2.95.2/gcc/frame.c(*ABS*+0x8054894): 
multiple definition of `_GLOBAL_OF FSET_TABLE_'
/usr/local/lib/libgcj.so(.got.plt+0x0): first defined here little: In function
`fde_split': /tmp/gcc-2.95.2/gcc/frame.c(*ABS*+0x8054e08): multiple definition of
`_end' /usr/local/lib/libgcj.so: undefined reference to `GC_find_start'
/usr/local/lib/libgcj.so: undefined reference to `deflate'
/usr/local/lib/libgcj.so: undefined reference to `GC_obj_kinds'
/usr/local/lib/libgcj.so: undefined reference to `GC_generic_malloc'
/usr/local/lib/libgcj.so: undefined reference to `inflate'
/usr/local/lib/libgcj.so: undefined reference to `GC_arrays'
/usr/local/lib/libgcj.so: undefined reference to `deflateSetDictionary'
/usr/local/lib/libgcj.so: undefined reference to `GC_gcollect'
/usr/local/lib/libgcj.so: undefined reference to `GC_signal_mark_stack_overflow'
/usr/local/lib/libgcj.so: undefined reference to `GC_add_to_black_list_normal'
/usr/local/lib/libgcj.so: undefined reference to `GC_n_mark_procs'
/usr/local/lib/libgcj.so: undefined reference to `GC_get_heap_size'
/usr/local/lib/libgcj.so: undefined reference to `GC_n_kinds'
...
etc


  Thanks for your help!!! (My system: Linux RedHat 6.1 on i586)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: NewBie: ld linker problem
  2000-04-01  0:00   ` Bryce McKinlay
@ 2000-04-01  0:00     ` Jeff Sturm
  2000-04-01  0:00       ` Bryce McKinlay
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff Sturm @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Bryce McKinlay; +Cc: Tom Tromey, indio, java-discuss

Bryce McKinlay wrote:
> Tom Tromey wrote:
> > Don't do that.  Use gcj to link.  gcj links in all the libraries you
> > need, behind your back.
> 
> I think the question indio was trying to ask here was really:
> 
> "How do I statically link libgcj (and the libgcjgc, etc) into my application?"
> 
> gcj will statically link if you actually delete the .so files from your library
> path. But there must be a better way than that. If someone wants to tell me the
> answer or add it to the FAQ I'd be very happy too.

what about "gcj -static"?

--
Jeff Sturm
jsturm@sigma6.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: NewBie: ld linker problem
  2000-04-01  0:00 ` Tom Tromey
@ 2000-04-01  0:00   ` Bryce McKinlay
  2000-04-01  0:00     ` Jeff Sturm
  0 siblings, 1 reply; 8+ messages in thread
From: Bryce McKinlay @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Tom Tromey; +Cc: indio, java-discuss

Tom Tromey wrote:

> >>>>> ">" == indio  <indio@technologist.com> writes:
>
> >>     The program (little) works fine. I am trying link it now with libgcj:
> >> ld -o little.o -lgcj little
> >>     But something is wrong. What?
>
> Don't do that.  Use gcj to link.  gcj links in all the libraries you
> need, behind your back.

I think the question indio was trying to ask here was really:

"How do I statically link libgcj (and the libgcjgc, etc) into my application?"

gcj will statically link if you actually delete the .so files from your library
path. But there must be a better way than that. If someone wants to tell me the
answer or add it to the FAQ I'd be very happy too.

regards

  [ bryce ]


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: NewBie: ld linker problem
  2000-04-01  0:00     ` Jeff Sturm
@ 2000-04-01  0:00       ` Bryce McKinlay
  0 siblings, 0 replies; 8+ messages in thread
From: Bryce McKinlay @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Jeff Sturm; +Cc: Tom Tromey, indio, java-discuss

Jeff Sturm wrote:

> > I think the question indio was trying to ask here was really:
> >
> > "How do I statically link libgcj (and the libgcjgc, etc) into my application?"
> >
> > gcj will statically link if you actually delete the .so files from your library
> > path. But there must be a better way than that. If someone wants to tell me the
> > answer or add it to the FAQ I'd be very happy too.
>
> what about "gcj -static"?

Unfortunatly, this causes gcj to statically link everything (even glibc), which
results in an unneccessarily large binary. What I'd like is to be able to selectivly
static link only libgcj's libraries, while keeping libc, libstdc++, and anything
else that is standard on Linux distributions dynamic in order to keep the file size
down.

regards

  [ bryce ]


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: NewBie: ld linker problem
  2000-04-01  0:00 indio
@ 2000-04-01  0:00 ` Tom Tromey
  2000-04-01  0:00   ` Anthony Green
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2000-04-01  0:00 UTC (permalink / raw)
  To: indio; +Cc: java-discuss

>>>>> "indio" == indio  <indio@technologist.com> writes:

indio>    Taking advantage of, where can I know regarding the options
indio> of the gcj? There is not a man page of the gcj, is there? Also,
indio> the command 'gcj --help' doesn't show the option -static.

gcj shares many options with gcc.  Read the gcc manual to see the wide
range of generic options, including optimizations, etc.

I agree our documentation is poor.  We'll have to do something about
that.

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: NewBie: ld linker problem
  2000-04-01  0:00 ` Tom Tromey
@ 2000-04-01  0:00   ` Anthony Green
  0 siblings, 0 replies; 8+ messages in thread
From: Anthony Green @ 2000-04-01  0:00 UTC (permalink / raw)
  To: tromey; +Cc: indio, java-discuss

Tom wrote:
> I agree our documentation is poor.  We'll have to do something about
> that.

I started putting together `Using and Porting the GNU Compiler for the
Java Programming Language' yesterday.

Here's the plan so far - input welcome...

       - I'm starting from the other `Using and Porting' texinfo docs
	 in GCC.

       - I've included a texinfo version of the CNI docs

       - I'm incorporating ideas from Bryce, Matt and others from a 
         few weeks ago
       
       - When we have javadoc docs for our libraries, we can simply
         generate texinfo source from them.

I'll start committing things in a week or so.  I'll need help with
content of course.

Here's an important programming project if someone would like to
help...

The Classpath project has a GPL'd javadoc tool.  Hack it to generate
texinfo suitable for inclusion in this book.  

If someone is interested in doing this, please let me know.  It would
be very useful.

AG

-- 
Anthony Green                                                        Red Hat
                                                       Sunnyvale, California

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: NewBie: ld linker problem
@ 2000-04-01  0:00 indio
  2000-04-01  0:00 ` Tom Tromey
  0 siblings, 1 reply; 8+ messages in thread
From: indio @ 2000-04-01  0:00 UTC (permalink / raw)
  To: java-discuss

   Thanks to all!


   The question was exactly that, Jeff: static linking.  
   About the size of the files, I had one .class of 10 K. After the  

   gcj -static etc  

   it was with 2.7 Mb...  



   Taking advantage of, where can I know regarding the options of the gcj? There is not a man page
of the gcj, is there? Also, the command 'gcj --help' doesn't show the option -static.



   Thanks again!

   indio, 
   from Brazil.
  

  

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2000-04-01  0:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-01  0:00 NewBie: ld linker problem indio
2000-04-01  0:00 ` Tom Tromey
2000-04-01  0:00   ` Bryce McKinlay
2000-04-01  0:00     ` Jeff Sturm
2000-04-01  0:00       ` Bryce McKinlay
  -- strict thread matches above, loose matches on Subject: below --
2000-04-01  0:00 indio
2000-04-01  0:00 ` Tom Tromey
2000-04-01  0:00   ` Anthony Green

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