luavreis / org-mode-hs

Libraries and tool for parsing Org Mode documents with customizable exporters. 🦄
GNU General Public License v3.0
22 stars 5 forks source link

Cannot build from source #15

Closed hydrobeam closed 1 year ago

hydrobeam commented 1 year ago

Hi! I'm trying to build the library by following the instructions in the README.

Version information:

➤ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.2.7

➤ cabal --version
cabal-install version 3.6.2.0
compiled using version 3.6.2.0 of the Cabal library

Installed via ghcup on Arch Linux. These are the errors I get:

Errors

When first compiling, an error appears in org-exporter/src/Org/Exporters/Pandoc.hs. To try to resolve this I just commented out the line.

src/Org/Exporters/Pandoc.hs:30:16: error:
    Not in scope: data constructor ‘P.Null’
    Perhaps you meant ‘P.Cell’ (imported from Text.Pandoc.Definition)
    Module ‘Text.Pandoc.Definition’ does not export ‘Null’.
   |
30 |       nullEl = P.Null
   |                ^^^^^^
Error: cabal: Failed to build org-exporters-0.1 (which is required by exe:horg

then after commenting out the offending line, the issue seems to be taken care of, but another error appears in org-cli:

app/org-cli.hs:81:40: error:
    • Couldn't match expected type ‘Text.Pandoc.Format.FlavoredFormat’
                  with actual type ‘Text’
    • In the first argument of ‘TP.getWriter’, namely ‘fmt’
      In a stmt of a 'do' block: (w, ext) <- TP.getWriter fmt
      In the first argument of ‘TP.runIOorExplode’, namely
        ‘do (w, ext) <- TP.getWriter fmt
            tpl <- TP.compileDefaultTemplate fmt
            utpl <- case tplo of
                      Nothing -> pure Nothing
                      Just tfp -> do ...
            let tpl' = fromMaybe tpl utpl
                wopt = ...
            ....’
   |
81 |               (w, ext) <- TP.getWriter fmt
   |                                        ^^^

The problem seems to be related to pandoc in both cases. If there's any other information you need then please let me know!

luavreis commented 1 year ago

Yes, sorry, the main branch is quite outdated and I was not declaring some bounds on its dependencies. Please try with the update branch, I have fixed the cabal bounds there. There is a CI running and if all goes well I will merge it later.

luavreis commented 1 year ago

I merged the updates with the main branch and fixed the CI, it should compile from source now.

In fact the CI now saves the compiled binaries as artifacts, but you still should build from source because I don't have a good way to distribute the default template files yet :(

Also, keep in mind the template files are outdated, I need to update them too. But it should work as a library or if you only want to view the generated AST.

hydrobeam commented 1 year ago

Tried compiling it and it seems to work! Thanks for resolving the issues