mithran
mithran

Reputation: 11

Haskell static compiled so file where haskell runtime shared library that can be accessed through ffi

I want to write a haskell program that get exposed through FFI, uses fpic and system-ffi and create a single so file so that the haskell runtime and deps are all packaged into a single object, when using ldd it should just give system deps and no haskell deps like /home/mithran/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5/lib/ghc-8.6.5/* , i am not an expert in haskell so any help would be highly appreciated i tried nix but got stuck not sure what i am missing a complete newbie to haskell.

i tried nix and ghc compile flags but during cabal build it gave ldd.gold link error since runtime not fpic compiled when i specified it to compile with fpic

  haskellPackages = pkgs.haskellPackages.overrides {
    overrides = self: super: {
      ghc = super.ghc.overrideAttrs (old: rec {
        configureFlags = old.configureFlags or [] ++ [
          "--with-system-libffi"
          "--enable-shared"
          "--enable-pic"
          "--enable-threaded-rts"
          "--ghc-option=-fPIC"
        ];

Upvotes: 1

Views: 32

Answers (0)

Related Questions