Re: trouble converting libgsl.a -> libgsl.so on cygwin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mirko Vukovic wrote:

> But on cygwin, ld does not have the -h option, and following the
> suggested command thus:
> ld -shared -s -o libgsl.so -whole-archive libgsl.a
> gives a long listing of undefined references.  And of course, no .so
> library at the end of the exercise.

I would take that entire page with a huge grain of salt.  Anyone that
advocates the practice of putting non-PIC objects into a shared library
needs their head examined.  Also, directly invoking ld to link is almost
always a bad idea.

The proper way is to rebuild the library.  Forget this conversion
nonsense.  With most things that use standard tools it's simply a matter
of using --enable-shared when configuring.  Cygwin is similar to linux
here, each .c file gets compiled to an .o and then linked to a .dll with
"gcc -shared".  There is no 'ld' invocation anywhere.  Note that calling
a DLL a .so is possible but it doesn't make much sense, it's not
anything close to the same as a ELF .so.  Also note that Cygwin (really,
PE) does not have a notion of PIC, however it does have a notion of
dllimport/dllexport and often times this means that code that will be
made into a DLL must be compiled with different options than code in a
static library, just as on ELF you must recompile with -fPIC.

Brian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux