[Haskell-cafe] Calling Haskell from C

dominic at steinitz.org dominic at steinitz.org
Fri Jan 13 17:35:17 UTC 2017


Thanks very much - I am very ignorant in this area and all help is much appreciated. However, when I do as you suggest I get

> $ otool -L a.out
> a.out:
> 	@rpath/Foo.dylib (compatibility version 0.0.0, current version 0.0.0)
> 	@rpath/libHSrts-ghc8.0.1.dylib (compatibility version 0.0.0, current version 0.0.0)
> 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
> 	/usr/local/lib/gcc/6/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
> $ set | grep -i dyld
> DYLD_FALLBACK_LIBRARY_PATH=/Users/dom/Library/Haskell/ghc-8.0.1/lib/test-via-c-0.1.0.0/bin:/Library/Frameworks/GHC.framework/Versions/8.0.1-x86_64/usr/lib/ghc-8.0.1/rts
> ~/Dropbox/Private/TestU01-1.2.3/examples/src $ ./a.out
> dyld: Library not loaded: /usr/local/lib/gcc/5/libgcc_s.1.dylib
>   Referenced from: /Library/Frameworks/GHC.framework/Versions/8.0.1-x86_64/usr/lib/ghc-8.0.1/rts/libHSrts-ghc8.0.1.dylib
>   Reason: image not found
> Trace/BPT trap: 5

It’s not clear to me why it’s looking for `gcc/5` which is not installed when it looks as though it should be looking for `gcc/6`.

> On 13 Jan 2017, at 16:06, Brandon Allbery <allbery.b at gmail.com> wrote:
> 
> 
> On Fri, Jan 13, 2017 at 8:53 AM, <dominic at steinitz.org <mailto:dominic at steinitz.org>> wrote:
>> export DYLD_LIBRARY_PATH=/Users/dom/Library/Haskell/ghc-8.0.1/lib/test-via-c-0.1.0.0/bin:/Library/Frameworks/GHC.framework/Versions/8.0.1-x86_64/usr/lib/ghc-8.0.1/rts
> 
> That's a good way to break things. Consider DYLD_FALLBACK_LIBRARY_PATH instead.
> Also, use otool -l a.out to inspect the RPATH commands embedded in a.out; that will tell you where dyld searches when it sees @rpath/Foo.dylib.
> 
> -- 
> brandon s allbery kf8nh                               sine nomine associates
> allbery.b at gmail.com <mailto:allbery.b at gmail.com>                                  ballbery at sinenomine.net <mailto:ballbery at sinenomine.net>
> unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net <http://sinenomine.net/>
Dominic Steinitz
dominic at steinitz.org
http://idontgetoutmuch.wordpress.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170113/09bcd796/attachment.html>


More information about the Haskell-Cafe mailing list