
After patching your Xcode project file to use $(PROJECT_DIR) instead
of /Users/frode/dev/haskell/digipostarkiv I was able to build this. I
changed the "libtool command" in my lib/ghc-7.8.2/settings to a shim that
removes -lpthread and then calls /usr/bin/libtool. Not pretty but it
worked, I'm sure there's a better workaround, but I think the real solution
should be to simply special-case OSDarwin in the same way as OSiOS in GHC.
On Mon, Jun 9, 2014 at 12:33 PM, Bob Ippolito
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...
On Mon, Jun 9, 2014 at 11:36 AM, Frode Nerbråten
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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe