On Wed, 2009-05-13 at 20:35 +0100, Neil Mitchell wrote:
> Hi
> 
> > With gcc, on ELF platforms you would use:
> >
> > $ gcc -shared Blah.o -o libblah.so -Wl,-soname,libblah.so
> >
> > We could require (or at least suggest) -package-name be given when
> > linking a shared lib. However that would involve baking in the "HS"
> > library prefix name convention into ghc.
> >
> > Or we can make the caller specify the soname specifically.
> 
> Some people will want the ability to specify the soname directly, so
> you'll need to provide that functionality.

It can be specified currently via -optl-Wl,-soname,libblah.so
which isn't nice, but then people shouldn't often have to specify it.

If we add another way to do it then people will have to use that because
ghc will not know when you're trying to override it via -optl-Wl flags.

> Given a way of specifying the soname directly, everything else is just
> a guess for when the flag is missing - so I'd be inclined to use the
> -o flag, or just always require a -soname flag. Doing the package name
> -> .so mapping in GHC itself seems quite ugly,

I agree, though it does have the advantage that when you don't specify a
package name then you're on your own and can specify a custom soname, eg
if you're not making a Haskell package but a shared lib to integrate
into some bigger multi-language project.

When making a Haskell package, we do need the soname to be there so the
dynamic linker can track library deps properly.

> and lots of people might want to compile .so's outside of cabal or any
> notion of packages.

Of course.

I was hoping to avoid adding a -soname flag to ghc but it looks like it
may be inevitable. It's annoying since it's platform specific and yet
must be used when making (sensible) shared libs on ELF systems. Perhaps
we just make a generic name for it (perhaps can share with a similar
thing on OSX) and have it be ignored on other platforms.

Duncan

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to