ShabbyX / libpandoc

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

Building fails on macOS #14

Open bronzehedwick opened 7 years ago

bronzehedwick commented 7 years ago

Hello,

I tried building on macOS Sierra and got the following error:

02:19:14 libpandoc $ make
GHC is version 8.2.1
sed: 1: "libpandoc.cabal": extra characters at the end of l command
cabal configure
Resolving dependencies...
Warning: solver failed to find a solution:
Could not resolve dependencies:
trying: libpandoc-0.8 (user goal)
unknown package: json (dependency of libpandoc-0.8)
fail (backjumping, conflict set: json, libpandoc)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: libpandoc, jsonTrying configure
anyway.
Configuring libpandoc-0.8...
cabal: Encountered missing dependencies:
data-default >=0.5,
digest >=0.0,
highlighting-kate >=0.6,
json >=0.9,
mtl >=2.1,
pandoc >=1.16,
pandoc-types >=1.16,
utf8-string >=0.3
make: *** [main] Error 1

I installed Haskell Core via the standard package.

Thanks!

ShabbyX commented 7 years ago

Hey,

First of all, there is a sed error there that's weird. The Makefile tries to do:

$(shell sed -i 's/$$compiler/$(GHC_VERSION)/g' libpandoc.cabal)

Where $(GHC_VERSION) as printed out is 8.2.1. Change that to:

$(shell echo sed -i 's/$$compiler/$(GHC_VERSION)/g' libpandoc.cabal)

and tell me what gets echoed (for debugging). In the meantime, open libpandoc.cabal and change $compiler inside it to 8.2.1.

Nevertheless, your problem is even before that change matters. It looks like there is no such package as json anymore. I looked it up and it seems to be replaced with json2. I tried changing it, but I get a build error from json2 when cabal tries to install it. I'm on ghc 8.0.2 though, so perhaps your compiler can compile it? If there is an API mismatch between json and json2, I don't know yet (as I can't yet build). However, give it a shot; open libpandoc.cabal and apply this:

diff --git a/libpandoc.cabal b/libpandoc.cabal
index 2cc75dd..1fc9a5f 100644
--- a/libpandoc.cabal
+++ b/libpandoc.cabal
@@ -21,7 +21,7 @@ Executable libpandoc.so
                         highlighting-kate >= 0.6,
                         data-default      >= 0.5,
                         bytestring        >= 0.10,
-                        json              >= 0.9
+                        json2             >= 0.8
   Hs-Source-Dirs:       src
   Include-Dirs:         src
   C-Sources:            src/pandoc.c

P.S. cabal is really a hack. They claim it's not a package manager, even though it should have been. That said, the make command may not be perfect (and there seems to be no good way of ordering cabal commands). You can run make, watch it fail, then run cabal install --only-dependencies and then run make again.

ShabbyX commented 7 years ago

If you also fail to build json2, we may have to wait a bit until that package is fixed.

bronzehedwick commented 7 years ago

Hi ShabbyX, thanks for getting back to me.

When echoing the sed command, I get this output:

GHC is version 8.2.1

I tried patching the libpandoc.cabal file as you mentioned, then running make, cabal install --only-dependencies, then make again, but once again got the error :(.

Does this mean we wait until json2 is fixed?

Here's the output.

09:12:34 libpandoc $ cabal install --only-dependencies
Warning: --root-cmd is no longer supported, see
https://github.com/haskell/cabal/issues/3353 (if you didn't type --root-cmd,
comment out root-cmd in your ~/.cabal/config file)
Resolving dependencies...
In order, the following would be installed:
SHA-1.6.4.2 (via: pandoc-1.19.2.1) (new package)
base64-bytestring-1.0.0.1 (via: pandoc-1.19.2.1 http-client-0.5.7.0 pem-0.2.2)
(new package)
byteable-0.1.1 (via: connection-0.2.8 x509-validation-1.6.9) (new package)
cereal-0.5.4.0 (via: tls-1.4.0 socks-0.5.5) (new package)
data-default-class-0.1.2.0 (via: http-client-tls-0.3.5.1 connection-0.2.8
tls-1.4.0 x509-validation-1.6.9 cookie-0.4.2.1 data-default-0.7.1.1
data-default-instances-old-locale-0.0.1 data-default-instances-dlist-0.0.1
data-default-instances-containers-0.0.1) (new package)
digest-0.0.1.2 (via: zip-archive-0.3.1.1) (new package)
dlist-0.8.0.3 (via: aeson-1.2.1.0 data-default-instances-dlist-0.0.1) (new
package)
extensible-exceptions-0.1.1.4 (via: pandoc-1.19.2.1 pandoc-1.19.2.1) (new
package)
foundation-0.0.13 (via: cryptonite-0.24 memory-0.14.7) (new package)
haddock-library-1.4.5 (via: pandoc-1.19.2.1) (new package)
hourglass-0.2.10 (via: x509-validation-1.6.9 x509-1.7.2 asn1-encoding-0.9.5
asn1-types-0.3.2) (new package)
hslua-0.4.1 (latest: 0.8.0) (via: pandoc-1.19.2.1) (new package)
hxt-charproperties-9.2.0.1 (via: hxt-9.3.1.16 hxt-regex-xmlschema-9.2.0.3
hxt-unicode-9.0.2.4) (new package)
integer-logarithms-1.0.2 (via: scientific-0.3.5.2) (new package)
json2-types-0.1 (via: json2-0.8.3) (new package)
mtl-2.2.1 (via: pandoc-1.19.2.1 tls-1.4.0 x509-system-1.6.6
x509-validation-1.6.9 texmath-0.9.4.1 x509-store-1.6.5 conduit-1.2.12
skylighting-0.1.1.5 x509-1.7.2 resourcet-1.1.9 highlighting-kate-0.6.4
filemanip-0.3.6.3 hxt-9.3.1.16 zip-archive-0.3.1.1 HTTP-4000.3.7 json2-0.8.3
JuicyPixels-3.2.8.3 exceptions-0.8.3 mmorph-1.1.0 parsec-3.1.11 pem-0.2.2
regex-base-0.93.2) (new package)
old-locale-1.0.0.7 (via: cookie-0.4.2.1 json2-0.8.3
data-default-instances-old-locale-0.0.1 old-time-1.1.0.3) (new package)
primitive-0.6.2.0 (via: conduit-1.2.12 tf-random-0.5 scientific-0.3.5.2
JuicyPixels-3.2.8.3 vector-0.12.0.1) (new package)
safe-0.3.15 (via: skylighting-0.1.1.5) (new package)
semigroups-0.18.3 (via: yaml-0.8.23.3) (new package)
stm-2.4.4.1 (via: streaming-commons-0.1.18 monad-control-1.0.2.2
exceptions-0.8.3 transformers-base-0.4.4 async-2.1.1.1) (new package)
syb-0.7 (via: pandoc-1.19.2.1 texmath-0.9.4.1 pandoc-types-1.17.1) (new
package)
text-1.2.2.2 (via: pandoc-1.19.2.1 pandoc-1.19.2.1 http-client-tls-0.3.5.1
yaml-0.8.23.3 http-client-0.5.7.0 doctemplates-0.1.0.2 skylighting-0.1.1.5
streaming-commons-0.1.18 aeson-1.2.1.0 zip-archive-0.3.1.1 blaze-html-0.9.0.1
http-types-0.9.1 attoparsec-0.13.2.0 uuid-types-1.0.3 blaze-markup-0.8.0.0
cookie-0.4.2.1 case-insensitive-1.2.0.10 scientific-0.3.5.2
hxt-regex-xmlschema-9.2.0.3 blaze-builder-0.4.0.2 cmark-0.5.6 hashable-1.2.6.1
mime-types-0.1.0.7 parsec-3.1.11 tagsoup-0.14.1 xml-1.3.14) (new package)
time-1.6.0.1 (latest: 1.8.0.3) (via: pandoc-1.19.2.1 http-client-0.5.7.0
aeson-1.2.1.0 zip-archive-0.3.1.1 HTTP-4000.3.7 tf-random-0.5
directory-1.3.1.1 cookie-0.4.2.1 json2-0.8.3 random-1.1
time-locale-compat-0.1.1.3 unix-2.7.2.2) (new version)
transformers-compat-0.5.1.4 (via: conduit-1.2.12 resourcet-1.1.9
monad-control-1.0.2.2 exceptions-0.8.3 mmorph-1.1.0 tagged-0.8.5
transformers-base-0.4.4) (new package)
utf8-string-1.0.1.1 (via: skylighting-0.1.1.5 highlighting-kate-0.6.4
json2-0.8.3) (new package)
zlib-0.6.1.2 (via: pandoc-1.19.2.1 streaming-commons-0.1.18
zip-archive-0.3.1.1 JuicyPixels-3.2.8.3) (new package)
data-default-instances-containers-0.0.1 (via: data-default-0.7.1.1) (new
package)
data-default-instances-dlist-0.0.1 (via: data-default-0.7.1.1) (new package)
memory-0.14.7 (via: http-client-tls-0.3.5.1 tls-1.4.0 x509-validation-1.6.9
x509-1.7.2 asn1-types-0.3.2 cryptonite-0.24) (new package)
hxt-unicode-9.0.2.4 (via: hxt-9.3.1.16) (new package)
regex-base-0.93.2 (via: regex-pcre-builtin-0.94.4.8.8.35) (new package)
pem-0.2.2 (via: x509-system-1.6.6 x509-validation-1.6.9 x509-store-1.6.5
x509-1.7.2) (new package)
old-time-1.1.0.3 (via: pandoc-1.19.2.1 zip-archive-0.3.1.1) (new package)
data-default-instances-old-locale-0.0.1 (via: data-default-0.7.1.1) (new
package)
vector-0.12.0.1 (via: pandoc-1.19.2.1 yaml-0.8.23.3 doctemplates-0.1.0.2
aeson-1.2.1.0 JuicyPixels-3.2.8.3) (new package)
async-2.1.1.1 (via: tls-1.4.0 streaming-commons-0.1.18) (new package)
xml-1.3.14 (via: pandoc-1.19.2.1 texmath-0.9.4.1) (new package)
tagsoup-0.14.1 (via: pandoc-1.19.2.1) (new package)
parsec-3.1.11 (via: pandoc-1.19.2.1 texmath-0.9.4.1 doctemplates-0.1.0.2
highlighting-kate-0.6.4 hxt-9.3.1.16 HTTP-4000.3.7 json2-0.8.3
hxt-regex-xmlschema-9.2.0.3 network-uri-2.6.1.0) (new package)
mime-types-0.1.0.7 (via: http-client-0.5.7.0) (new package)
hashable-1.2.6.1 (via: aeson-1.2.1.0 uuid-types-1.0.3
case-insensitive-1.2.0.10 scientific-0.3.5.2 unordered-containers-0.2.8.0)
(new package)
cmark-0.5.6 (via: pandoc-1.19.2.1) (new package)
blaze-builder-0.4.0.2 (via: http-client-0.5.7.0 streaming-commons-0.1.18
blaze-html-0.9.0.1 http-types-0.9.1 blaze-markup-0.8.0.0 cookie-0.4.2.1
json2-0.8.3) (new package)
unix-2.7.2.2 (via: pandoc-1.19.2.1 streaming-commons-0.1.18 process-1.4.3.0
temporary-1.2.1.1 zip-archive-0.3.1.1 base-compat-0.9.3 directory-1.3.1.1
network-2.6.3.2 unix-compat-0.4.3.1) (reinstall) (changes: time-1.8.0.2
removed)
time-locale-compat-0.1.1.3 -old-locale (via: aeson-1.2.1.0) (new package)
random-1.1 (via: pandoc-1.19.2.1 http-client-0.5.7.0 streaming-commons-0.1.18
QuickCheck-2.10.0.1 tf-random-0.5 uuid-types-1.0.3) (new package)
transformers-base-0.4.4 (via: conduit-1.2.12 resourcet-1.1.9
lifted-base-0.2.3.11 monad-control-1.0.2.2) (new package)
tagged-0.8.5 (via: aeson-1.2.1.0) (new package)
mmorph-1.1.0 (via: conduit-1.2.12 resourcet-1.1.9) (new package)
exceptions-0.8.3 (via: http-client-tls-0.3.5.1 conduit-1.2.12
http-client-0.5.7.0 resourcet-1.1.9 temporary-1.2.1.1) (new package)
cryptonite-0.24 (via: http-client-tls-0.3.5.1 tls-1.4.0 x509-validation-1.6.9
x509-store-1.6.5 x509-1.7.2) (new package)
asn1-types-0.3.2 (via: tls-1.4.0 x509-validation-1.6.9 x509-store-1.6.5
x509-1.7.2 asn1-parse-0.9.4 asn1-encoding-0.9.5) (new package)
regex-pcre-builtin-0.94.4.8.8.35 (via: skylighting-0.1.1.5
highlighting-kate-0.6.4) (new package)
data-default-0.7.1.1 (via: pandoc-1.19.2.1) (new package)
JuicyPixels-3.2.8.3 (via: pandoc-1.19.2.1) (new package)
network-uri-2.6.1.0 (via: pandoc-1.19.2.1 pandoc-1.19.2.1
http-client-tls-0.3.5.1 http-client-0.5.7.0 hxt-9.3.1.16 HTTP-4000.3.7) (new
package)
hxt-regex-xmlschema-9.2.0.3 (via: hxt-9.3.1.16) (new package)
unordered-containers-0.2.8.0 (via: pandoc-1.19.2.1 yaml-0.8.23.3
doctemplates-0.1.0.2 aeson-1.2.1.0) (new package)
scientific-0.3.5.2 (via: pandoc-1.19.2.1 yaml-0.8.23.3 doctemplates-0.1.0.2
aeson-1.2.1.0 attoparsec-0.13.2.0) (new package)
case-insensitive-1.2.0.10 (via: http-client-tls-0.3.5.1 http-client-0.5.7.0
skylighting-0.1.1.5 http-types-0.9.1) (new package)
json2-0.8.3 (new package)
cookie-0.4.2.1 (via: http-client-0.5.7.0) (new package)
blaze-markup-0.8.0.0 (via: pandoc-1.19.2.1 doctemplates-0.1.0.2
blaze-html-0.9.0.1) (new package)
unix-compat-0.4.3.1 (via: filemanip-0.3.6.3) (new package)
network-2.6.3.2 (via: pandoc-1.19.2.1 pandoc-1.19.2.1 http-client-tls-0.3.5.1
connection-0.2.8 tls-1.4.0 http-client-0.5.7.0 streaming-commons-0.1.18
HTTP-4000.3.7 socks-0.5.5) (new package)
directory-1.3.1.1 (via: pandoc-1.19.2.1 pandoc-1.19.2.1 x509-system-1.6.6
yaml-0.8.23.3 x509-store-1.6.5 skylighting-0.1.1.5 streaming-commons-0.1.18
filemanip-0.3.6.3 hxt-9.3.1.16 process-1.4.3.0 temporary-1.2.1.1
zip-archive-0.3.1.1) (new version)
base-compat-0.9.3 (via: aeson-1.2.1.0) (new package)
uuid-types-1.0.3 (via: aeson-1.2.1.0) (new package)
tf-random-0.5 (via: QuickCheck-2.10.0.1) (new package)
monad-control-1.0.2.2 (via: conduit-1.2.12 resourcet-1.1.9
lifted-base-0.2.3.11) (new package)
asn1-encoding-0.9.5 (via: tls-1.4.0 x509-validation-1.6.9 x509-store-1.6.5
x509-1.7.2 asn1-parse-0.9.4) (new package)
attoparsec-0.13.2.0 (via: yaml-0.8.23.3 aeson-1.2.1.0) (new package)
http-types-0.9.1 (via: pandoc-1.19.2.1 http-client-tls-0.3.5.1
http-client-0.5.7.0) (new package)
blaze-html-0.9.0.1 (via: pandoc-1.19.2.1 doctemplates-0.1.0.2
skylighting-0.1.1.5 highlighting-kate-0.6.4) (new package)
socks-0.5.5 (via: connection-0.2.8) (new package)
HTTP-4000.3.7 (via: pandoc-1.19.2.1 pandoc-1.19.2.1) (new package)
zip-archive-0.3.1.1 (via: pandoc-1.19.2.1) (new package)
temporary-1.2.1.1 (via: pandoc-1.19.2.1) (new package)
process-1.4.3.0 (latest: 1.6.1.0) (via: pandoc-1.19.2.1 x509-system-1.6.6
streaming-commons-0.1.18) (new version)
hxt-9.3.1.16 (via: skylighting-0.1.1.5) (new package)
filemanip-0.3.6.3 (via: pandoc-1.19.2.1) (new package)
QuickCheck-2.10.0.1 (via: pandoc-types-1.17.1) (new package)
lifted-base-0.2.3.11 (via: conduit-1.2.12 resourcet-1.1.9) (new package)
asn1-parse-0.9.4 (via: x509-1.7.2) (new package)
aeson-1.2.1.0 (via: pandoc-1.19.2.1 pandoc-1.19.2.1 yaml-0.8.23.3
yaml-0.8.23.3 yaml-0.8.23.3 doctemplates-0.1.0.2 pandoc-types-1.17.1
skylighting-0.1.1.5) (new package)
highlighting-kate-0.6.4 (new package)
streaming-commons-0.1.18 (via: http-client-0.5.7.0) (new package)
resourcet-1.1.9 (via: yaml-0.8.23.3 conduit-1.2.12) (new package)
x509-1.7.2 (via: connection-0.2.8 tls-1.4.0 x509-system-1.6.6
x509-validation-1.6.9 x509-store-1.6.5) (new package)
skylighting-0.1.1.5 (latest: 0.3.3.1) (via: pandoc-1.19.2.1 pandoc-1.19.2.1)
(new package)
pandoc-types-1.17.1 (latest: 1.19) (via: pandoc-1.19.2.1 pandoc-1.19.2.1
texmath-0.9.4.1) (new package)
doctemplates-0.1.0.2 (via: pandoc-1.19.2.1) (new package)
http-client-0.5.7.0 (via: pandoc-1.19.2.1 http-client-tls-0.3.5.1) (new
package)
conduit-1.2.12 (via: yaml-0.8.23.3) (new package)
x509-store-1.6.5 (via: connection-0.2.8 tls-1.4.0 x509-system-1.6.6
x509-validation-1.6.9) (new package)
texmath-0.9.4.1 (via: pandoc-1.19.2.1) (new package)
yaml-0.8.23.3 (via: pandoc-1.19.2.1 pandoc-1.19.2.1) (new package)
x509-validation-1.6.9 (via: connection-0.2.8 tls-1.4.0) (new package)
x509-system-1.6.6 (via: connection-0.2.8) (new package)
tls-1.4.0 (via: http-client-tls-0.3.5.1 connection-0.2.8) (new package)
connection-0.2.8 (via: http-client-tls-0.3.5.1) (new package)
http-client-tls-0.3.5.1 (via: pandoc-1.19.2.1) (new package)
pandoc-1.19.2.1 (new package)
cabal: The following packages are likely to be broken by the reinstalls:
process-1.6.1.0
haskeline-0.7.4.0
ghc-8.2.1
Cabal-2.0.0.2
ghci-8.2.1
directory-1.3.0.2
hpc-0.6.0.3
ghc-boot-8.2.1
Use --force-reinstalls if you want to install anyway.
09:13:23 libpandoc $ make
GHC is version 8.2.1
sed: 1: "libpandoc.cabal": extra characters at the end of l command
cabal configure
Resolving dependencies...
Warning: solver failed to find a solution:
Could not resolve dependencies:
trying: libpandoc-0.8 (user goal)
unknown package: json2 (dependency of libpandoc-0.8)
fail (backjumping, conflict set: json2, libpandoc)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: libpandoc, json2Trying configure
anyway.
Configuring libpandoc-0.8...
cabal: Encountered missing dependencies:
data-default >=0.5,
digest >=0.0,
highlighting-kate >=0.6,
json2 >=0.8,
mtl >=2.1,
pandoc >=1.16,
pandoc-types >=1.16,
utf8-string >=0.3
make: *** [main] Error 1
09:13:31 libpandoc $
ShabbyX commented 7 years ago

I think you copied the wrong output from the echo. You got the first line, but you should have copied the second line (it should start with sed since you are echoing that command!)

It seems like, for you, cabal doesn't even find the json2 package. You know what, try to do:

cabal update

And then try to install dependencies again:

cabal install --only-dependencies

The update invocation makes sure the "catalog" of packages is up to date.

bronzehedwick commented 7 years ago

My fault on the echo. Here's the full output:

GHC is version 8.2.1
sed: 1: "libpandoc.cabal": extra characters at the end of l command
sed -i s/$compiler/8.2.1/g libpandoc.cabal
sed: 1: "libpandoc.cabal": extra characters at the end of l command
make: *** [main] Error 1

Running cabal update was successful, but then running cabal install --only-dependencies after failed with the following:

Building library for json2-0.8.3..
[1 of 7] Compiling Data.JSON2.Blaze ( src/Data/JSON2/Blaze.hs, dist/build/Data/JSON2/Blaze.o )

src/Data/JSON2/Blaze.hs:23:1: error:
    Could not find module ‘Blaze.ByteString.Builder.Internal’
    Perhaps you meant
      Data.ByteString.Builder.Internal (from bytestring-0.10.8.2)
      Blaze.ByteString.Builder.Int (from blaze-builder-0.4.0.2)
      Blaze.ByteString.Builder.Internal.Write (from blaze-builder-0.4.0.2)
    Use -v to see a list of the files searched for.
   |
23 | import Blaze.ByteString.Builder.Internal (getPoke, boundedWrite)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cabal: Leaving directory '/var/folders/6f/bvrhxwl52y36t5q1h10pzkx80000gn/T/cabal-tmp-29280/json2-0.8.3'
Downloading cookie-0.4.2.1...
Configuring cookie-0.4.2.1...
Building cookie-0.4.2.1...
Installed cookie-0.4.2.1
Installed streaming-commons-0.1.18
Installed unordered-containers-0.2.8.0
Installed cryptonite-0.24
Updating documentation index
/Users/delucac/Library/Haskell/share/doc/x86_64-osx-ghc-8.2.1/index.html
cabal: Error: some packages failed to install:
json2-0.8.3-LtHJpG99wKYHLtioG2yMAu failed during the building phase. The
exception was:
ExitFailure 1
ShabbyX commented 7 years ago

Alright, the sed problem may have something to do with quotations (or maybe shell difference? I don't have a mac to test). Give another try for me, will you? Replace this line:

$(shell sed -i 's/$$compiler/$(GHC_VERSION)/g' libpandoc.cabal)

with this:

sed -i 's/$$compiler/$(GHC_VERSION)/g' libpandoc.cabal

And see if that helps.

Regarding the build, you also have a problem building json2, so I'm afraid there is little we can do until that is fixed (I tried using an older version of json2, but that requires a whole other set of older (therefore conflicting) library versions).

bronzehedwick commented 7 years ago

Got it regarding the json2 issue.

Regarding sed, the update gave the same error, but I did get it to work with this:

$(shell cat libpandoc.cabal | sed -i 's/$$compiler/$(GHC_VERSION)/g')
ShabbyX commented 7 years ago

Well, that sed command doesn't actually modify the file, which was the intention.

bronzehedwick commented 7 years ago

Duh of course. My bad.