BurntSushi / erd

Translates a plain text description of a relational database schema to a graphical entity-relationship diagram.
The Unlicense
1.79k stars 154 forks source link

Build Error on WSL1 + Ubuntu 18.04 #85

Closed muraii closed 3 years ago

muraii commented 3 years ago

Hello!

I'm trying to build this on Ubuntu 18.04 on WSL1. Everything goes fine until attempting to build erd-0.2.1.0 itself. This is from the erd-0.2.1.0.log:

Building erd-0.2.1.0...
Preprocessing executable 'erd' for erd-0.2.1.0...
[1 of 7] Compiling Paths_erd        ( dist/build/autogen/Paths_erd.hs, dist/build/erd/erd-tmp/Paths_erd.o )
[2 of 7] Compiling Erd.ER           ( src/Erd/ER.hs, dist/build/erd/erd-tmp/Erd/ER.o )
[3 of 7] Compiling Erd.Render       ( src/Erd/Render.hs, dist/build/erd/erd-tmp/Erd/Render.o )
[4 of 7] Compiling Text.Parsec.Erd.Parser ( src/Text/Parsec/Erd/Parser.hs, dist/build/erd/erd-tmp/Text/Parsec/Erd/Parser.o )

src/Text/Parsec/Erd/Parser.hs:70:69: error:
   • Variable not in scope:
      (<>) :: M.Map String Option -> Options -> Options
   • Perhaps you meant one of these:
      ‘<|>’ (imported from Text.Parsec), ‘<*>’ (imported from Prelude),
      ‘*>’ (imported from Prelude)
cabal: Leaving directory '/tmp/cabal-tmp-10632/erd-0.2.1.0'

I let cabal install all the dependencies, fwiw.

I'm guessing, given this is insrc/Text/Parsec/Erd/Parser.hs, that I'd clone the repo and change the line

$ A Attribute {field = n, pk = ispk, fk = isfk, aoptions = opts <> defaultAttrOpts}

to

$ A Attribute {field = n, pk = ispk, fk = isfk, aoptions = opts <|> defaultAttrOpts}

but I don't know from Haskell.

Thank you for your time. I know the maintenance of this tool is up-in-the-air. If there is more information I can provide to be of help, let me know.

mmzx commented 3 years ago

About maintenance, fortunately on the contrary. :+1:

Could you please post here your ghc version that you've used to build? ghc -v

Also, there are build instructions in the readme, including running the tool via docker. First of all I highly recommend you to look at it. In case you get stuck, please ask ahead!

mmzx commented 3 years ago

Also, what is the command you use for building it?

muraii commented 3 years ago

I'm installing with a simple cabal install erd. I also tried cabal install --allow-newer erd, not so much because I thought it would do the job, but just to try what had worked on slightly similar issues with other folks on other issues.

I'm running ghc v8.0.2.

I read through the build instructions and considered the Docker route but thought I'd get this going natively if I could.

mmzx commented 3 years ago

You do not need to know Haskell, but if you want to build it yourself a compatible environment is needed.

ghc-8.0.2 is "ancient" [3] and would not be supported, please find [1] the by default supported ones. - I wonder about your installation, but that's off-topic.

If you want to stick with cabal it is the v2 commands the way to go, as the readme says in the related cabal section.

If you want to stick with stack, please install stack itself [2] and do the following, which will give you a known working compiler and sandbox like environment to build a native package. My stack version right now is _2.1.3.1 x86_64 hpack-0.32.0 stack build --resolver=lts-14.27 this builds it nicely.

[1] https://travis-ci.org/github/BurntSushi/erd/builds/700673871 [2] https://docs.haskellstack.org/en/stable/README/ [3] https://downloads.haskell.org/ghc/8.0.2/

muraii commented 3 years ago

This is probably down to my installing Haskell.Platform from the Ubuntu 18.04 repository and it being an older version, with older cabal, etc. I first tried cabal new-install erd as in the README and cabal belched at it.

I'll get back with results.

mmzx commented 3 years ago

I am sorry, but no personal experience with haskell-platform! Your cabal version shall be >= 3.x.

muraii commented 3 years ago

Installed appropriate versions and erd works as advertised. Thank you for your help.