Failed to link additional libraries / objects

I made FFI bindings to the C ++ unordered_map container (aka hash_map) and its wrapper library called libstl.a. For the first time he worked well. But after some point, he was unable to associate the library with the following error messages, and I cannot understand why.

$ ghci -L. -lstl -lstdc++ 
GHCi, version 7.6.2: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading object (static archive) ./libstl.a ... done
Loading object (dynamic) /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.so ... done
final link ... ghc: ./libstl.a: unknown symbol `_ZZNKSt8__detail20_Prime_rehash_policy11_M_next_bktEmE10__fast_bkt'
linking extra libraries/objects failed

Sources for the library are at https://github.com/comatose/stl-container . Any help would be appreciated.

+5
source share
1 answer

I had problems loading .o files in ghci. From what I understand, the problem is that g ++ leaves “weak characters” in the .o files, and ghci does not handle them very well.

I found a thread about this with a helpful observation:

http://www.haskell.org/pipermail/haskell-cafe/2012-March/099926.html

, , g++ (.so .a), , , . . libtool. , :

http://www.gnu.org/software/libtool/

+1

All Articles