Skip to content

Conversation

benz0li
Copy link
Contributor

@benz0li benz0li commented Mar 15, 2023

Some issues need to be resolved first.

@benz0li
Copy link
Contributor Author

benz0li commented Mar 15, 2023

Resolved: jacobstanley/unix-compat#61

@benz0li
Copy link
Contributor Author

benz0li commented Mar 15, 2023

Next Resolved: yesodweb/wai#925

@benz0li
Copy link
Contributor Author

benz0li commented Mar 16, 2023

Next Resolved: haskell-servant/servant#1659

ℹ️ Waiting for a new version (0.19.2?) to be released: https://hackage.haskell.org/package/servant

@benz0li
Copy link
Contributor Author

benz0li commented Mar 30, 2023

Build is failing at Checking that the binary is statically linked..., because it is not:

file "linux-arm64/pandoc"
linux-arm64/pandoc: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-aarch64.so.1, stripped

haskell-servant/servant#1659 (comment)

@jgm Did I miss a specific flag? I took the ones according to the Makefile and added --allow-newer to CABALOPTS.

@jgm
Copy link
Owner

jgm commented Mar 30, 2023

See .cirrus.yml. I'm building the linux releases on cirrus-ci.com, now.
That config file contains the settings you need for GHCOPTS and CABALOPTS.

@benz0li
Copy link
Contributor Author

benz0li commented Mar 30, 2023

@jgm Then, pandoc can currently be built from branch main with GHC 9.6.1 as follows:

git clone https://github.com/jgm/pandoc.git
cd pandoc
nano cabal.project
diff --git a/cabal.project b/cabal.project
index d5afefaa6..cd1e26e95 100644
--- a/cabal.project
+++ b/cabal.project
@@ -1,3 +1,8 @@
+source-repository-package
+    type: git
+    location: https://github.com/haskell-servant/servant.git
+    subdir: servant-server
+            servant
 packages: .
           pandoc-lua-engine
           pandoc-server
nano linux/make_artifacts.sh
diff --git a/linux/make_artifacts.sh b/linux/make_artifacts.sh
index 6d3c48954..6b025d9dc 100644
--- a/linux/make_artifacts.sh
+++ b/linux/make_artifacts.sh
@@ -1,6 +1,7 @@
 #!/bin/bash
 set -e
 
+cabal update
 cabal build $CABALOPTS --ghc-options="$GHCOPTS" pandoc-cli
 BINPATH=$(cabal list-bin $CABALOPTS --ghc-options="$GHCOPTS" pandoc-cli)
 echo "Built executable: $BINPATH"
nano pandoc-server/pandoc-server.cabal
diff --git a/pandoc-server/pandoc-server.cabal b/pandoc-server/pandoc-server.cabal
index 66ecf0624..6472825ba 100644
--- a/pandoc-server/pandoc-server.cabal
+++ b/pandoc-server/pandoc-server.cabal
@@ -59,7 +59,7 @@ library
                  data-default          >= 0.4      && < 0.8,
                  text                  >= 1.1.1.0  && < 2.1,
                  unicode-collation     >= 0.1.1    && < 0.2,
-                 servant-server        >= 0.19     && < 0.20,
+                 servant-server,
                  skylighting           >= 0.13     && < 0.14,
                  wai                   >= 3.2      && < 3.3,
                  wai-cors              >= 0.2.7    && < 0.3
export DOCKERIMAGE=glcr.b-data.ch/ghc/ghc-musl:9.6.1
export GHCOPTS="-j4 +RTS -A256m -RTS -split-sections -optc-Os -optl=-pthread"
export CABALOPTS="--allow-newer -f-export-dynamic -fembed_data_files -fserver -flua --enable-executable-static -j4"
export REVISION=1
docker run --rm -v $PWD:/mnt -v $PWD/linux/artifacts:/artifacts -e REVISION -e CABALOPTS -e GHCOPTS -w /mnt --userns host --memory=0 $DOCKERIMAGE bash /mnt/linux/make_artifacts.sh 2>&1 > docker.log

Build log: docker.log

@jgm
Copy link
Owner

jgm commented Mar 30, 2023

Great! Let's wait for it to work with released packages before merging.

@benz0li
Copy link
Contributor Author

benz0li commented Mar 30, 2023

Some more output from the docker run command that might be of interest:

src/Text/Pandoc/Writers/EPUB.hs:254:5: warning: [GHC-53633] [-Woverlapping-patterns]
    Pattern match is redundant
    In an equation for ‘addMetadataFromXML’:
        addMetadataFromXML e@(Element (QName name _ (Just "dc")) attrs _ _)
                           md | name == "type" = ...
    |
254 |   | name == "type" = md { epubType = Just $ strContent e }
    |     ^^^^^^^^^^^^^^

Cross references:

@jgm
Copy link
Owner

jgm commented Mar 30, 2023

The compiler has probably gotten smarter about detecting redundancies...
But if we remove this we may get a warning about incomplete pattern match from earlier compilers...would have to check.

Copy link
Owner

@jgm jgm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want to change l. 55 of .cirrus.yml as well.

@benz0li
Copy link
Contributor Author

benz0li commented May 5, 2023

Waiting for Resolved: haskell-servant/servant#1680

@benz0li
Copy link
Contributor Author

benz0li commented Jun 7, 2023

Waiting for Resolved: haskell-servant/servant#1679

@benz0li benz0li changed the title Use ghc-musl 9.6.1 docker image Use ghc-musl 9.6.2 docker image Jun 26, 2023
@benz0li benz0li marked this pull request as ready for review June 26, 2023 06:38
@benz0li
Copy link
Contributor Author

benz0li commented Jun 26, 2023

@jgm Pandoc builds with GHC v9.6.2, too.

ℹ️ Tested for both linux/amd64 and linux/arm64/v8.

@jgm jgm merged commit 7cca27b into jgm:main Jun 26, 2023
@jgm
Copy link
Owner

jgm commented Jun 26, 2023

excellent!

samahri pushed a commit to samahri/pandoc that referenced this pull request Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants