idris-lang / Idris2

A purely functional programming language with first class types
https://idris-lang.org/
Other
2.52k stars 375 forks source link

scheme binary not found despite specifying `SCHEME` #666

Closed CodingCellist closed 3 years ago

CodingCellist commented 4 years ago

On my system, Chez Scheme gets installed as the binary chez-scheme. When trying to run make bootstrap SCHEME=chez-scheme the build initially seems to proceed without issues, but then errors with the following messages:

[...]
158/158: Building Idris.Main (src/Idris/Main.idr)
/usr/bin/env: ‘scheme’: No such file or directory
make[2]: Entering directory '$HOME/Projects/Idris2-git/tests'
$HOME/Projects/Idris2-git/bootstrap/bin/idris2 --build tests.ipkg
1/1: Building Main (Main.idr)
/usr/bin/env: ‘scheme’: No such file or directory
make[2]: Leaving directory '$HOME/Projects/Idris2-git/tests'
make -C libs/prelude IDRIS2=../../build/exec/idris2 IDRIS2_PATH="$HOME/Projects/Idris2-git/libs/prelude/build/ttc:$HOME/Projects/Idris2-git/libs/base/build/ttc:$HOME/Projects/Idris2-git/libs/contrib/build/ttc:$HOME/Projects/Idris2-git/libs/network/build/ttc"
make[2]: Entering directory '$HOME/Projects/Idris2-git/libs/prelude'
../../build/exec/idris2 --build prelude.ipkg
../../build/exec/idris2: line 14: $HOME/Projects/Idris2-git/build/exec/idris2_app/idris2.so: No such file or directory
make[2]: *** [Makefile:2: all] Error 127
make[2]: Leaving directory '$HOME/Projects/Idris2-git/libs/prelude'
make[1]: *** [Makefile:69: prelude] Error 2
make[1]: Leaving directory '$HOME/Projects/Idris2-git'
make: *** [Makefile:149: bootstrap-build] Error 2

It seems that despite specifying SCHEME=chez-scheme, some internals in the bootstrap tests have Chez Scheme hardcoded to scheme?

Setup:

melted commented 4 years ago

I think I see the problem, pathLookup in Chez.idr has a list of possible Chez Scheme names and chez-scheme isn't on it. the SCHEME env variable is only used during the bootstrap. Not taking that into account for the resulting compiler doesn't make a whole lot of sense. But we would have to add that in a generated file in the build process, though. Luckily we already generate IdrisPaths.idr, and it would be a good fit there.

melted commented 4 years ago

There is a way to override the path lookup in the meantime. Set the environment variable CHEZ to the path to the Chez Scheme executable. A bit ugly, but maybe it will do until we can get a patch in.

MakitaToki commented 3 years ago

@melted I encounter the same error. I install chez scheme on /akariDown/ChezScheme from source and the executable name is scheme, but according to pathLookup in Chez.idr, it should be found. Setting CHEZ also fails. It seems this cause isn't same. On step 'Installing without an existing Idris 2', I type sudo make bootstrap SCHEME=/akariDown/ChezScheme/bin/scheme. The command /usr/bin/env scheme works well. Which step I miss?

Environment:

  1. Ubuntu 20.04
  2. Chez Scheme 9.5.4
  3. /akariDown/Idris2/.idris2/bin on PATH and /akariDown/Idris2/.idris2/lib on LD_LIBRARY_PATH
  4. scheme path /akariDown/ChezScheme/bin on PATH and CHEZ
melted commented 3 years ago

@Mizobrook-kan Just a check, isn't there a subdirectory for machinetype in the path to your scheme? Like akariDown/ChezScheme/bin/ta6le/scheme

MakitaToki commented 3 years ago

@melted Machinetype folder is on source code folder /akariDown/ChezScheme-9.5.4/ta6le/bin/ta6le/scheme, not on installed path. This path is built by ./configure. Change environment variable to this?

MakitaToki commented 3 years ago

@melted I find file /akariDown/ChezScheme-9.5.4/ta6le/bin/scheme is that file you mention, it links to ta6le/scheme which type is shared library as same as akariDown/ChezScheme/bin/scheme, but make also fails when I change environment to /akariDown/ChezScheme-9.5.4/ta6le/bin. Should I place the contents in /akariDown/ChezScheme-9.5.4/ta6le/bin to akariDown/ChezScheme/bin?

MakitaToki commented 3 years ago

I try to install chezscheme via apt, and now I know why command not found. Thanks. @melted

gallais commented 3 years ago

If you want to open a PR to fix this, cf. #1589 for the modifications that need to be made. Ideally you'd also modify libs/test/Test/Golden.idr so that the change is also used there.

I wonder whether we could be a bit sneaky and use a little bit of magic to add the SCHEME that was used to make bootstrap to the list of blessed names.

Either by patching the code before compilation, or by recording the value somewhere (e.g. in an ~/.idris2/conf) so that we may look it up later when we fail to find the chez we're looking for.