I am trying to create a shared library from Haskell source code.
I tried following the instructions here: http://weblog.haskell.cz/pivnik/building-a-shared-library-in-haskell/ , but I was just out of luck.
When I compile with 64-bit Haskell (ghc 7.0.4 from 2011.4.0.0), I get the following error:
ld: pointer in read-only segment not allowed in slidable image, used in ___gmpn_modexact_1c_odd
As an alternative, I also tried the 32-bit version and depending on the exact flags that I use for links, I get errors such as:
Library not loaded: /usr/local/lib/ghc-7.0.4/base-4.3.1.0/libHSbase-4.3.1.0-ghc7.0.4.dylib
I managed to get a little more by adding -lHSrts to the linker line. This allowed me to successfully link and load the library, but I could not find the function name using dlsym (or manually using nm | grep)
Any hints are welcome, evaluating the make or build file that has successfully built (and used) the shared library in OS X. I am completely new to Haskell and do not know if I should continue to bang my head, believing that the problem is at my end, or different For reasons I should not expect this to work on OS X.
A git repo with all the combinations I tried is available here: https://github.com/bennoleslie/haskell-shared-example I managed to get something working for 32-bit ghc but not yet 64-bit.
haskell ghc shared-libraries macos
benno Mar 24 2018-12-12T00: 00Z
source share