[Haskell-cafe] Packaging a library with a separate shared object
Albert Y. C. Lai
trebla at vex.net
Tue Jul 5 01:39:14 UTC 2016
On 2016-06-30 07:03 PM, Bryan Gardiner wrote:
> I'm working on packaging Qtah (my Qt bindings) for upload to Hackage.
> This is somewhat complicated, as I have some C++ glue code that I
> build into a shared library that the Haskell library needs.
> Currently, my build hooks are as follows, in:
> - postConf: Generate Haskell code in src/ and C++ code in cpp/.
> - preBuild: Add cpp/ to HookedBuildInfo.extraLibDirs because the build
> phase needs this needs this.
> - buildHook: Run make to build the C++ code into libqtah.so before
> the Haskell code builds.
> - copyHook and instHook: Copy libqtah.so into InstallDirs.libdir
> This installs successfully, but ultimately doesn't work because the
> Haskell libHSqtah*.so that gets built can't find libqtah.so. The
> installation directory ~/cabal/lib/.../qtah-*/ isn't on
> libHSqtah*.so's RUNPATH (which makes sense, it's not known at link
I don't know how to write custom Setup.hs, so I don't know how to do the
following, but the theory is:
When creating libHSqtah*.so, the linker needs to be told:
Replace xxx by InstallDirs.libdir. This is how to set RUNPATH (or is it
More information about the Haskell-Cafe