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

Bob Ippolito bob at redivi.com
Mon Jun 9 19:33:18 UTC 2014


This seems like a bug, you shouldn't need to link to libpthread at all on
Mac. /usr/lib/libpthread.dylib is just a symlink to libSystem… Not sure how
to get around the issue without rebuilding GHC, it looks like iOS is
special cased in the compiler (OSiOS) but not Mac OS X (OSDarwin) [1].

[1]
https://github.com/ghc/ghc/blob/master/compiler/main/DriverPipeline.hs#L1869-L1873


On Mon, Jun 9, 2014 at 11:36 AM, Frode Nerbråten <frode at nerbraten.no> wrote:

> Hi,
>
> I'm having trouble building my Haskell library with GHC 7.8.2 and
> Cabal 1.20.0.2 on OSX 10.9.3 with both -staticlib and -threaded
> enabled.
>
> 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:
> https://github.com/froden/digipostarkiv
> (I asked the same question on stackoverflow:
> http://stackoverflow.com/q/24096257/777411)
>
> Best regards,
> Frode Nerbråten
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140609/9788ba61/attachment.html>


More information about the Haskell-Cafe mailing list