I am trying to run this example from github: https://github.com/nh2/haskell-from-python/blob/master/Makefile I wanted to get an introduction to running one language from another language. I'm not sure if FFI is playing a role here somehow, I just don't know enough to tell.
I am running the code on WSL - debian. I also tried running it on windows, but I get the same issue. My error is after running 'make' and then 'python program.py' I get:
Traceback (most recent call last):
File "program.py", line 5, in <module>
lib = cdll.LoadLibrary("./libffi-example.so")
File "/usr/lib/python2.7/ctypes/__init__.py", line 444, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python2.7/ctypes/__init__.py", line 366, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/ghc/ghc-prim-0.5.2.0/libHSghc-prim-0.5.2.0-ghc8.4.4.so: undefined symbol: stg_gc_unpt_r1
I don't know what stg_gc_unput_r1 is, and it's not a variable in any of the code. I also looked through some of the GHC documentation, and couldn't find anything on it. My issue on the repository hasn't gotten any attention, and although it's only been a day since I posted it, the code is several years old.
I have no experience with Haskell and ghc, and very little with Python, so any help and patience would be appreciated.
After checking that the file /usr/lib/ghc/rts/libHSrts-ghc8.4.4.so does in fact exist, here is the output from running ldd libffi-example.so:
linux-vdso.so.1 (0x00007ffd5f5ee000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fcc439c7000)
libHSbase-4.11.1.0-ghc8.4.4.so => /usr/lib/ghc/base-4.11.1.0/libHSbase-4.11.1.0-ghc8.4.4.so (0x00007fcc4304c000)
libHSinteger-gmp-1.0.2.0-ghc8.4.4.so => /usr/lib/ghc/integer-gmp-1.0.2.0/libHSinteger-gmp-1.0.2.0-ghc8.4.4.so (0x00007fcc43009000)
libHSghc-prim-0.5.2.0-ghc8.4.4.so => /usr/lib/ghc/ghc-prim-0.5.2.0/libHSghc-prim-0.5.2.0-ghc8.4.4.so (0x00007fcc42b7b000)
libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007fcc42af8000)
libatomic.so.1 => /usr/lib/x86_64-linux-gnu/libatomic.so.1 (0x00007fcc42aec000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcc4292b000)
/lib64/ld-linux-x86-64.so.2 (0x00007fcc43b58000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007fcc42921000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fcc42900000)
Things I have tried:
- running with -no-hs-main option
- reading through ghc docs
- posting github issue
- changing version of ghc in the GHC_RUNTIME_LINKER_FLAG to 8.4.4, my current version