[Haskell-cafe] Undefined symbol error coming from shared, dynamic library.

Sergiy Nazarenko nazarenko.sergiy at gmail.com
Sun Sep 11 17:55:24 CEST 2011


Hi, Captain,

As far as I see you try to build static library.
If this correct, what did not work in static library?
Why do you decide compile with -dynamic option?

I was trying to build shared library. Other python library has used
some functions from library which I had written using Haskell. But
some software which we use in my company had crached after attempts to
import python module. Under pure python it works OK, but software has
crached. I thought having static library to solve my problem. And I'm
looking for how to build static library, but no luck.

Cheers,
Sergiy

On 11 September 2011 17:56, Captain Freako <capn.freako at gmail.com> wrote:
> Sergiy, Tom,
>
> Thanks for your replies.
>
> Sergiy, I was able to get this working without having to recompile my
> installed Haskell libraries.
>
> Tom, you were correct; I needed to explicitly link against the Haskell
> run-time system, as well as a few other things:
>
> I changed my ghc link options from this:
>
> HC_LOPTS = -no-hs-main -shared -package parsec -package dsp -static
>
> to this:
>
> HC_LOPTS = -shared -dynamic -package parsec-3.1.1 -package dsp -lHSrts
> -L/usr/lib/ghc-6.12.3/ -lm -lffi -lrt
>
> and things are working.
>
> (The command that builds my mixed language, shared object library,
> `libami.so', is:
>
> ghc -o libami.so $(HC_LOPTS) {object files, compiled from both C and Haskell}
> )
>
> I can understand why I'd have to explicitly link against `libHSrts',
> since I'm asking ghc for a shared object library and not an
> executable. However, I'm not sure about the following:
> - Why do I need to give the `-L/usr/lib/ghc-6.12.3/' option? (It seems
> like ghc ought to know about that, implicitly.)
> - Why do I need to explicitly link against the 3 standard C libraries:
> `m', `ffi', and `rt'? (I've never needed to do this, previously, when
> I was building/testing this project statically.)
>
> Thanks, in advance, for any insights!
>
> -db
>
>
> On 9/10/11, Sergiy Nazarenko <nazarenko.sergiy at gmail.com> wrote:
>> I've recompiled my library again and now it works without any problem.
>> Probably I made mistake somewhere.
>>
>> Cheers,
>> Sergiy
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



More information about the Haskell-Cafe mailing list