[Haskell-cafe] Problems using ghc 7.8.2 with options -staticlib and -threaded on osx

Frode Nerbråten frode at nerbraten.no
Mon Jun 9 18:36:38 UTC 2014


I'm having trouble building my Haskell library with GHC 7.8.2 and
Cabal on OSX 10.9.3 with both -staticlib and -threaded

The library I'm building exports several functions using FFI to be
called from ObjectiveC in an Xcode project. This works fine with just
-staticlib enabled, but now I realize I need to call into my Haskell
library from multiple OS-threads simultaneously. But when I add
-threaded to ghc-options I get an error when linking:

    error: libtool: can't locate file for: -lpthread
    error: libtool: file: -lpthread is not an object file (not allowed
in a library)

The linker command that fails looks like this (... replaces a bunch of
-l and -L options):

    libtool -static -o liba.a dist/build/HsCocoa.o ... -lCffi -lpthread

In /usr/lib I have a libpthread.dylib that links to libSystem.dylib,
but no libpthread.a. I was under the impression that libpthread was
included with the system install.

Is this supposed to work or am I misunderstanding something basic? :)
Any help would be greatly appreciated!

The project source is available on github:
(I asked the same question on stackoverflow:

Best regards,
Frode Nerbråten

More information about the Haskell-Cafe mailing list