Gleam: No such file or directory src/libcore/result.rs:997:5

Created on 19 Jun 2019  Â·  16Comments  Â·  Source: gleam-lang/gleam

Hi Louis,

Trying out Gleam and getting an error when I try to compile an unmodified project built using rebar3 new gleam_lib my_proj

Here is the error:

╰─$ rebar3 compile
===> Plugin {rebar_gleam,{git,"https://github.com/gleam-lang/rebar_gleam"}} not available. It will not be used.
===> Verifying dependencies...
===> Fetching gleam_stdlib ({pkg,<<"gleam_stdlib">>,<<"0.2.0">>})
===> Version cached at /Users/steven/.cache/rebar3/hex/hexpm/packages/gleam_stdlib-0.2.0.tar is up to date, reusing it
===> Compiling gleam_stdlib
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:997:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
===> Hook for compile failed!
bug

Most helpful comment

Hi all! I've just released a fix for this, as well as Gleam v0.2.0!
Please update your copy of the compiler and then update the rebar_gleam plugin with rebar3 as global plugins upgrade rebar_gleam

All 16 comments

Thanks for the report.

I've been unable to reproduce the issue, could you try building the latest version of the compiler and see if the problem is still there? If so could you provide an example project for me to debug with? Thank you

Hey, just did a fresh install, here are my versions:

╭─steven@Stevens-MBP ~/code/testytest ‹master›
╰─$ gleam --version
gleam 0.1.1

╭─steven@Stevens-MBP ~/code/testytest ‹master›
╰─$ rebar3 -v
===> Plugin {rebar_gleam,{git,"https://github.com/gleam-lang/rebar_gleam"}} not available. It will not be used.
rebar 3.10.0 on Erlang/OTP 21 Erts 10.3.5.3

╭─steven@Stevens-MBP ~/code/testytest ‹master›
╰─$ rustc -V
rustc 1.35.0

╭─steven@Stevens-MBP ~/code/testytest ‹master›
╰─$ erl
Erlang/OTP 21 [erts-10.3.5.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Eshell V10.3.5.3  (abort with ^G)
1>

Here is my rebar3 config file:

{plugins, [
    {rebar_gleam, {git, "https://github.com/gleam-lang/rebar_gleam"}},
    rebar3_proper
]}.

Here is a link to an example project I am getting the issue with: shdblowers/testytest

First, thanks SO much for working on this project! I feel like it's something that's greatly needed for a lot of modules and projects.

I'm also getting this bug as well and I have a similar version as @shdblowers . I've tried running the generated hello world project from rebar as well as cloned down the url shortener app and i'm getting this error in both cases.

I built from master last night and it's still displaying 0.1.1 for the version number. However, I also built this a couple weeks ago but for some reason it wasn't on my path then. I'm not sure if it's referencing that older version somehow? When I run make install on master (36ae227) it still says install 0.1.1 even though 0.1.2 should be available according to the git tags/commits.

I did get some warnings when compiling, perhaps these are helpful?

gleam|master ⇒ make install
cd gleam && cargo install --path . --force
  Installing gleam v0.1.1 (/Users/work/Projects/gleam/gleam)
   Compiling libc v0.2.50
   Compiling autocfg v0.1.2
   Compiling rand_core v0.4.0
   Compiling proc-macro2 v0.4.27
...
  Compiling codespan v0.2.1
   Compiling codespan-reporting v0.2.1
   Compiling docopt v1.0.2
   Compiling lalrpop v0.16.3
   Compiling gleam v0.1.1 (/Users/work/Projects/gleam/gleam)
warning: variant is never constructed: `Constant`
   --> src/ast.rs:175:5
    |
175 |     Constant { value: Box<Expr<Scope<T>, T>> },
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: #[warn(dead_code)] on by default

warning: method is never used: `new`
    --> /Users/work/Projects/gleam/gleam/target/release/build/gleam-3d2b8497a3a3d2f0/out/grammar.rs:3439:9
     |
3439 |         pub fn new() -> ExprParser {
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^

    Finished release [optimized] target(s) in 2m 13s
   Replacing /Users/work/.cargo/bin/gleam

I'm also new to Erlang and Rebar but i'm comfortable with Elixir so i'm not sure if i'm setting something up incorrectly. Is there a certain commit that I could checkout that might be better?


# MacOS 10.14
⇒ rustc -V
rustc 1.35.0 (3c235d560 2019-05-20)

⇒ gleam -V
gleam 0.1.1

⇒ rebar3 -v
rebar 3.6.1 on Erlang/OTP 22 Erts 10.4

⇒ which rebar3
/Users/adam/.mix/rebar3
Projects|⇒ git clone https://github.com/gleam-lang/example-url-shortener.git
Projects|⇒ cd example-url-shortener
example-url-shortener|master ⇒ rebar3 shell
===> Verifying dependencies...
===> Fetching elli ({pkg,<<"elli">>,<<"3.2.0">>})
===> Downloaded package, caching at /Users/work/.cache/rebar3/hex/default/packages/elli-3.2.0.tar
===> Fetching gleam_experimental_elli ({git,
                                               "https://github.com/gleam-lang/gleam_experimental_elli"})
===> WARNING: It is recommended to use {branch, Name}, {tag, Tag} or {ref, Ref}, otherwise updating the dep may not work as expected.
===> Fetching gleam_stdlib ({pkg,<<"gleam_stdlib">>,<<"0.2.0">>})
===> Version cached at /Users/work/.cache/rebar3/hex/default/packages/gleam_stdlib-0.2.0.tar is up to date, reusing it
===> Skipping elli (from {pkg,<<"elli">>,<<"3.2.0">>,
                                     <<"7842861819869EBBFF7230BC77ECF2DF551AE3EAEF5FDE6B01A7561CACCB811E">>}) as an app of the same name has already been fetched
===> Compiling gleam_stdlib
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:997:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
===> Hook for compile failed!

Ok more info here... rolling back to 6d3906e (tag: v0.1.2) v0.1.2 works great. I can everything to compile then 👍

Hi, I'm facing the same issue, I tried unsuccessfully to update rust but it doesn't work

$ rebar3 compile
===> Plugin {rebar_gleam,{git,"https://github.com/gleam-lang/rebar_gleam"}} not available. It will not be used.
===> Verifying dependencies...
===> Compiling gleam_stdlib
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:997:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
===> Hook for compile failed!

$ erl -V
Erlang/OTP 21 [erts-10.3.5.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

$ rustc --version
rustc 1.35.0 (3c235d560 2019-05-20)

$  gleam -V
gleam 0.1.1

$ uname -r
5.1.12-300.fc30.x86_64 # Fedora 30

$ rebar3 --version
===> Plugin {rebar_gleam,{git,"https://github.com/gleam-lang/rebar_gleam"}} not available. It will not be used.
rebar 3.10.0 on Erlang/OTP 21 Erts 10.3.5.2

Going to v0.1.2 also work for me btw

@Koisell Thanks for your help! Are you using the latest version of the rebar plugin? Please run rebar3 as global upgrade rebar_gleam to pull the latest version

Hi all! I've just released a fix for this, as well as Gleam v0.2.0!
Please update your copy of the compiler and then update the rebar_gleam plugin with rebar3 as global plugins upgrade rebar_gleam

Awesome! ⚡️

I'm still getting this error with v0.2.0 and the latest rebar_gleam. Am I doing this correctly? I also noticed the std lib got bumped in the commit message to 0.3 but the hex package did not get updated so it's still pulling in 0.2.0, perhaps that's the issue here.

Repro:

$ gleam -V
> gleam 0.2.0

rebar3 new gleam_lib testupgrade
cd testupgrade
rebar3 compile
testupgrade|⇒ rebar3 compile
===> Verifying dependencies...
===> Compiling gleam_stdlib
thread 'main' panicked at 'collect_source src_dir: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:997:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
===> Hook for compile failed!

testupgrade|⇒ cat rebar.lock
{"1.1.0",
[{<<"gleam_stdlib">>,{pkg,<<"gleam_stdlib">>,<<"0.2.0">>},0}]}.
[
{pkg_hash,[
 {<<"gleam_stdlib">>, <<"A711E3BDEFE7C50A67389FAF80CC9BF0E14EBFD4CC33466032BD3AE59ACD7481">>}]}
].

If you're using an existing project you will also need to upgrade the gleam_stdlib library to the latest version in your rebar3 project. For new projects you'll likely want to update your rebar3 package index so it uses the latest version (v0.3.0).

@lpil ah ok thanks for your help! I would have assumed a new project (via rebar_gleam) would have looked for the latest lib before fetching it 🤔

This seems to be a gap in my Erlang tooling knowledge. I've only been using Elixir for the beam. I'm assuming adding version numbers to the generated code could be a burden at this early stage but if not it would be helpful for newcomers (or even a comment to add that latest version)


For future readers, I was able to add a version number to my rebar.config, delete the lock file, and recompile to get it to run without issues.

{deps, [
    {gleam_stdlib, "0.3.0"}
]}.

new output

testupgrade|⇒ rebar3 compile
===> Verifying dependencies...
===> Package gleam_stdlib-0.3.0 not found. Fetching registry updates and trying again...
===> Updating package registry...
===> Writing registry to /Users/work/.cache/rebar3/hex/default/registry
===> Generating package index...
===> Writing index to /Users/work/.cache/rebar3/hex/default/packages.idx
===> Fetching gleam_stdlib ({pkg,<<"gleam_stdlib">>,<<"0.3.0">>})
===> Downloaded package, caching at /Users/work/.cache/rebar3/hex/default/packages/gleam_stdlib-0.3.0.tar
===> Compiling gleam_stdlib
===> Compiling testupgrade

Adding the version number seems like it could be useful. Would you like to contribute this change? :)

@lpil for sure, I can do that 👍 Also I made a make file addition for myself to help make future upgrades easier make upgrade version=0.8.2 . If this is something that's useful I can add that as well:

.PHONY: upgrade
upgrade:
    git fetch &&\
    git fetch --tags &&\
    git checkout v$(version) &&\
    make install &&\
    rebar3 as global plugins upgrade rebar_gleam

Thanks for the fix on this Louis and also the library in general, looking forward to playing about with it some more.

Thank you! :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lpil picture lpil  Â·  6Comments

lpil picture lpil  Â·  7Comments

scripttease picture scripttease  Â·  3Comments

Jwsonic picture Jwsonic  Â·  4Comments

lpil picture lpil  Â·  7Comments