[GHC] #9348: "Symbol not found" when using a shared library
GHC
ghc-devs at haskell.org
Tue Jul 22 20:32:03 UTC 2014
#9348: "Symbol not found" when using a shared library
-----------------------------------------+---------------------------------
Reporter: alex.davis | Owner: simonmar
Type: bug | Status: new
Priority: normal | Milestone:
Component: Runtime System | Version: 7.8.3
Resolution: | Keywords:
Differential Revisions: | Operating System: MacOS X
Architecture: x86 | Type of failure: None/Unknown
Difficulty: Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: |
-----------------------------------------+---------------------------------
Description changed by alex.davis:
Old description:
> 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
> in /usr/local/lib/ghc-7.8.3/ghc-prim-0.3.1.0/libHSghc-
> prim-0.3.1.0-ghc7.8.3.dylib
>
> 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
> in /usr/local/lib/ghc-7.8.3/ghc-prim-0.3.1.0/libHSghc-
> prim-0.3.1.0-ghc7.8.3.dylib
> ---
>
> 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.
>
> 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
New description:
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
in /usr/local/lib/ghc-7.8.3/ghc-prim-0.3.1.0/libHSghc-
prim-0.3.1.0-ghc7.8.3.dylib
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
in /usr/local/lib/ghc-7.8.3/ghc-prim-0.3.1.0/libHSghc-
prim-0.3.1.0-ghc7.8.3.dylib
---
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 iwth 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
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9348#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list