"Symbol not found" when using a shared library
|Reported by:||alex.davis||Owned by:||simonmar|
|Type of failure:||Documentation bug||Test Case:|
|Related Tickets:||Differential Rev(s):|
Description (last modified by alex.davis)
I'm trying to make a shared library from a simple program. It works fine on my Windows box, but gives an error on Mac OS X. Furthermore, the error seems to be generated from one of GHC's shared libraries.
What happens is this. I compile my shared library with GHC, which works fine. But when I try to use it from another program (specifically, R), I get an error message containing the following: Symbol not found: _stg_IND_STATIC_info
Referenced from: /usr/local/lib/ghc-7.8.3/ghc-prim-0.3.1.0/libHSghc-prim-0.3.1.0-ghc7.8.3.dylib Expected in: flat namespace
More details: The program I'm trying to use is R. In R, you load a shared library with the command "dyn.load". When I try this, the command I use is "dyn.load('final.dylib')", and the full error message is what follows: --- Error in dyn.load("final.dylib") :
unable to load shared object '/Users/alexanderdavis/Desktop/illustrate bug copy/final.dylib': dlopen(/Users/alexanderdavis/Desktop/illustrate bug copy/final.dylib, 6): Symbol not found: _stg_IND_STATIC_info Referenced from: /usr/local/lib/ghc-7.8.3/ghc-prim-0.3.1.0/libHSghc-prim-0.3.1.0-ghc7.8.3.dylib Expected in: flat namespace
As I said, I have done all of this with no trouble on Windows. I compiled into a DLL, loaded the program into R, and was able to use the functions in it. However, on Windows I was also using an older version of GHC, and may have used the Haskell Platform and thus had more libraries installed - I don't have the computer with me, so I'm not sure.
My Mac OS version is 10.9.4.
My R version is 3.0.2. When loaded, it displays "Platform: x86_64-apple-darwin10.8.0 (64-bit)", but Sys.getev("R_ARCH") returns the empty string.
Command used for compiler: ghc --make -dynamic -fPIC -shared SumRoots.hs StartEnd.c -o final.dylib
The code is attached. It is from a blog post by Neil Mitchelll (author of HLint) about calling Haskell from R: http://neilmitchell.blogspot.com/2011/10/calling-haskell-from-r.html
Change History (9)
comment:4 in reply to: ↑ 3 Changed 14 months ago by thomie
- Cc simonmar removed
- Component changed from Runtime System to Documentation
- Operating System changed from MacOS X to Unknown/Multiple
comment:5 Changed 11 months ago by thomie
- Type of failure changed from None/Unknown to Documentation bug