ShabbyX / libpandoc

C bindings to Pandoc, a markup converter library written in Haskell.
88 stars 16 forks source link

Missing C library #12

Closed Phyks closed 7 years ago

Phyks commented 7 years ago

Hi,

I don't know much about Haskell, so I am not sure about the correct way to fix it.

When trying to build libpandoc on Arch, I got * Missing C library: HSrts-ghc7.10.2, very similar to https://stackoverflow.com/questions/34267376/haskell-missing-c-library-on-arch-linux-works-on-ubuntu.

I fixed it by moving the extra-libraries option to Ghc-Options. Also, I have GHC 8.0.2 and not GHC 7.10.2, so here is my diff:

diff --git a/libpandoc.cabal b/libpandoc.cabal
index 560a596..4c11ef2 100644
--- a/libpandoc.cabal
+++ b/libpandoc.cabal
@@ -29,9 +29,8 @@ Executable libpandoc.so
   Main-Is:              LibPandoc.hs
   if !os(windows)
     CC-Options:         -fPIC
-  Ghc-Options:          -no-hs-main -shared
+  Ghc-Options:          -no-hs-main -shared -lHSrts-ghc8.0.2
   if !os(windows)
     Ghc-Options:        -dynamic
-    extra-libraries:    HSrts-ghc7.10.2
   else
     extra-libraries:    HSrts

Not sure about the clean way to handle it :/ Should we really edit the libpandoc.cabal file at each GHC update?

ShabbyX commented 7 years ago

The Makefile does a sed to automatically change $compiler to the version that is installed, which sucks as it leaves the libpandoc.cabal file dirty. That's how it seems to have mistakenly gotten committed. About moving it from extra-libraries to Ghc-Options, I don't know. I remember windows was a bitch about everything, so it should at least be only added in the !os(windows) part (after -dynamic for example). Also, the answer to that question talks about issues with what you did if there is an executable (which a .so file is, but there is ambiguity here).

As long as it builds and works for you, feel free to use this method locally. I'm afraid I might break the build elsewhere by taking this.

Phyks commented 7 years ago

Ok, no problem for this. At least the solution is listed somewhere in the issues if some encounters it again.

Maybe the Makefile should generate the libpandoc.cabal file from a template as well, but apparently being compatible with all OSes is a pity :/

ShabbyX commented 7 years ago

As always, windows is the reason we can't have nice things.