Unix Programming - Linking Shared Library w/ Ld

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > March 2005 > Linking Shared Library w/ Ld





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Linking Shared Library w/ Ld
Michael B Allen

2005-03-21, 6:03 pm

I want to link my shared library in a separate step using GNU ld. I've
tried the following without success. What am I doing wrong?

ld -shared -soname libfoo.so.0.8 -o libfoo.so.0.8.18 -lc -lutil
src/hashmap.o src/pool.o src/csv.o src/allocator.o src/suba.o src/diff.o
ld: libfoo.so.0.8.18: undefined versioned symbol name wcscasecmp@@GLIBC_2.1
ld: failed to set dynamic section sizes: Bad value
make[1]: *** [so0] Error 1

Thanks,
Mike
Henry Townsend

2005-03-21, 8:47 pm

Michael B Allen wrote:
> I want to link my shared library in a separate step using GNU ld. I've
> tried the following without success. What am I doing wrong?
>
> ld -shared -soname libfoo.so.0.8 -o libfoo.so.0.8.18 -lc -lutil
> src/hashmap.o src/pool.o src/csv.o src/allocator.o src/suba.o src/diff.o
> ld: libfoo.so.0.8.18: undefined versioned symbol name wcscasecmp@@GLIBC_2.1
> ld: failed to set dynamic section sizes: Bad value
> make[1]: *** [so0] Error 1


First, as you may be aware, the standard advice here is "don't use the
linker directly - use the compiler (presumably gcc in this case) driver
to make shared libs". For which the incantation is "gcc -shared -fpic -o
libfoo.so ...".

But if you have some reason to use the linker directly, use the compiler
as above till you have it working. Then add a -v flag to see how the
compiler driver invokes ld.

--
Henry Townsend
Michael B Allen

2005-03-22, 2:51 am

On Mon, 21 Mar 2005 20:01:56 -0500, Henry Townsend wrote:
> First, as you may be aware, the standard advice here is "don't use the
> linker directly - use the compiler (presumably gcc in this case) driver
> to make shared libs".


No, I can't say I did. Yikes I feel like a newbie :->

Thanks,
Mike
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com