smucclaw / baby-l4

A miniature version of the l4 language
BSD 3-Clause "New" or "Revised" License
9 stars 6 forks source link

Fix the installation instructions #93

Open anka-213 opened 3 years ago

anka-213 commented 3 years ago

The instructions doesn't quite work on a fresh installation. And the error messages you get are very cryptic.

./Setup.sh: line 66: --batch: command not found

The problem is that

mygf=`stack exec which gf`

silently failed because the dependencies (including gf) wasn't installed yet. We need to both check that the step worked and make sure that the dependencies are built first.

Also, the error you get if you don't follow the instructions and just try stack build is very cryptic as well:

...
Done running
GF_LIB_PATH=Nothing
["-make","-v=0","-f","haskell","--haskell=gadt","--haskell=lexical","--lexical=Atom","--output-dir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/l4-generated","grammars/Questions.gf"]
File Noun.gf does not exist.
searched in: grammars/
...

so we should try to make Setup.hs give more helpful errors.

mengwong commented 3 years ago

I know I have gf installed and I have GF_LIB_PATH set, yet

┌─[mengwong@solo] - [~/src/smucclaw/baby-l4] - [2021-06-24 02:22:38]
└─[1] <git:(smtgen 35af073) > echo $GF_LIB_PATH
/Users/mengwong/.cabal/share/x86_64-osx-ghc-8.4.3/gf-3.10.4/lib/
┌─[mengwong@solo] - [~/src/smucclaw/baby-l4] - [2021-06-24 02:23:14]
└─[0] <git:(smtgen 35af073) > ls $GF_LIB_PATH
alltenses prelude   present
┌─[mengwong@solo] - [~/src/smucclaw/baby-l4] - [2021-06-24 02:23:17]
└─[0] <git:(smtgen 35af073) > stack test
baby-l4> configure (lib + internal-lib + exe + test)
Configuring baby-l4-0.1.0.0...
baby-l4> build (lib + internal-lib + exe + test)
Preprocessing library 'l4-generated' for baby-l4-0.1.0.0..
GF_LIB_PATH=Nothing
["-make","-v=0","-f","haskell","--haskell=gadt","--haskell=lexical","--lexical=Atom","--output-dir=.stack-work/dist/x86_64-osx/Cabal-3.0.1.0/build/l4-generated","grammars/Questions.gf"]
File Noun.gf does not exist.
searched in: grammars/
Progress 1/2

--  While building package baby-l4-0.1.0.0 (scroll up to its section to see the error) using:
      /Users/mengwong/src/smucclaw/baby-l4/.stack-work/dist/x86_64-osx/Cabal-3.0.1.0/setup/setup --builddir=.stack-work/dist/x86_64-osx/Cabal-3.0.1.0 build lib:baby-l4 lib:l4-generated exe:l4 exe:lsp-server-bl4 test:lsp-server-tests test:unit-tests --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
mengwong commented 3 years ago

There is a gf built:

┌─[mengwong@solo] - [~/src/smucclaw/baby-l4] - [2021-06-24 02:24:40]
└─[0] <git:(smtgen 35af073) > stack exec which gf
/Users/mengwong/.stack/snapshots/x86_64-osx/3dcda4dedac8e47cf50c55ffde93922aa72bf216d597c8d7821285f0300239ec/8.8.4/bin/gf
┌─[mengwong@solo] - [~/src/smucclaw/baby-l4] - [2021-06-24 02:24:42]
└─[0] <git:(smtgen 35af073) > /Users/mengwong/.stack/snapshots/x86_64-osx/3dcda4dedac8e47cf50c55ffde93922aa72bf216d597c8d7821285f0300239ec/8.8.4/bin/gf

         *  *  *
      *           *
    *               *
   *
   *
   *        * * * * * *
   *        *         *
    *       * * * *  *
      *     *      *
         *  *  *

This is GF version 3.10.4.
mengwong commented 3 years ago

I'm following the install instructions, but maybe I need to rebuild the latest GF. BRB.

└─[1] <git:(smtgen 35af073) > cd $GF_LIB_PATH
direnv: unloading
┌─[mengwong@solo] - [~/.cabal/share/x86_64-osx-ghc-8.4.3/gf-3.10.4/lib] - [2021-06-24 02:27:05]
└─[0] <> ls
alltenses prelude   present
┌─[mengwong@solo] - [~/.cabal/share/x86_64-osx-ghc-8.4.3/gf-3.10.4/lib] - [2021-06-24 02:27:05]
└─[0] <> ls **/Noun.gf
zsh: no matches found: **/Noun.gf
mengwong commented 3 years ago

OK, I have rebuilt using the amended instructions with the runghc Setup.hs install but I'm still not finding Noun.gf.

┌─[mengwong@solo] - [~/src/GrammaticalFramework/gf-rgl] - [2021-06-24 02:52:49]
└─[0] <git:(master a3701d1a) > find . -name Noun.gf
./src/abstract/Noun.gf
┌─[mengwong@solo] - [~/src/GrammaticalFramework/gf-rgl] - [2021-06-24 02:52:54]
└─[0] <git:(master a3701d1a) > runghc Setup.hs install --gf=/Users/mengwong/.nix-profile/bin/gf
Building [Prelude]
Building [Present]
Building [AllTenses]
Copying [Prelude] /Users/mengwong/src/GrammaticalFramework/gf-core/.stack-work/install/x86_64-osx/0e7c80c0e2bdfca7995cad50c200da14153861976aedd8f01d6cad1257a3f7e6/8.2.2/share/x86_64-osx-ghc-8.2.2/gf-3.10.4/lib/prelude
Copying [Present] /Users/mengwong/src/GrammaticalFramework/gf-core/.stack-work/install/x86_64-osx/0e7c80c0e2bdfca7995cad50c200da14153861976aedd8f01d6cad1257a3f7e6/8.2.2/share/x86_64-osx-ghc-8.2.2/gf-3.10.4/lib/present
Copying [AllTenses] /Users/mengwong/src/GrammaticalFramework/gf-core/.stack-work/install/x86_64-osx/0e7c80c0e2bdfca7995cad50c200da14153861976aedd8f01d6cad1257a3f7e6/8.2.2/share/x86_64-osx-ghc-8.2.2/gf-3.10.4/lib/alltenses
┌─[mengwong@solo] - [~/src/GrammaticalFramework/gf-rgl] - [2021-06-24 02:53:30]
└─[0] <git:(master a3701d1a) > cd $GF_LIB_PATH
┌─[mengwong@solo] - [~/.cabal/share/x86_64-osx-ghc-8.4.3/gf-3.10.4/lib] - [2021-06-24 02:53:42]
└─[0] <> find . -name Noun.gf
┌─[mengwong@solo] - [~/.cabal/share/x86_64-osx-ghc-8.4.3/gf-3.10.4/lib] - [2021-06-24 02:53:48]
└─[0] <>
anka-213 commented 3 years ago

It should be Noun.gfo I think.

This is a mess and we need to make it a lot better!

anka-213 commented 3 years ago

Maybe we have too few build system and should add bazel.build as well and make that canonical? :P I was inspired by a presentation during ZuriHac. It is specialized for polyglot projects like ours.

There are rules for building Haskell (https://haskell.build/), but none yet for building gf-projects. Unlike nix, it has full windows-support and it also has nix-support (https://github.com/tweag/rules_nixpkgs) as a bonus.

We could also build docker images so there are even more installation methods available. :P

mengwong commented 3 years ago

Right. I do see Noun.gfo present:

┌─[mengwong@unifi] - [~] - [2021-06-27 03:16:24]
└─[0] <> cd $GF_LIB_PATH
┌─[mengwong@unifi] - [~/.cabal/share/x86_64-osx-ghc-8.4.3/gf-3.10.4/lib] - [2021-06-27 03:16:26]
└─[0] <> find . -name Noun.gfo
./present/Noun.gfo
./alltenses/Noun.gfo

Next action: figure out what in the build is trying to find Noun.gf, and see if it can be convinced to accept a Noun.gfo instead.