lambda-rust icon indicating copy to clipboard operation
lambda-rust copied to clipboard

Fails with /usr/local/bin/build.sh: line 35: //.cargo/env: No such file or directory

Open smirnoal opened this issue 4 years ago • 6 comments

it may be a bug in Rust installer, but build.sh fails with error

% docker run --rm \     
    -u $(id -u):$(id -g) \
    -v ${PWD}:/code \
    -v ${HOME}/.cargo/registry:/cargo/registry \
    -v ${HOME}/.cargo/git:/cargo/git \
    softprops/lambda-rust
/usr/local/bin/build.sh: line 35: //.cargo/env: No such file or directory

smirnoal avatar Jan 28 '21 11:01 smirnoal

I have this issue too

ggomagundan avatar Feb 03 '21 06:02 ggomagundan

I have this issue as well. If I run the container without a different/non-root uid, it works fine (uses /root/.cargo/env).

Running OSX Big Sur with Docker installed through the homebrew cask.

$HOME appears to come through as / for me (thus, the error on line 53 -- . $HOME/.cargo/env). My uid/gid are 501/20.

find / -iname .cargo in the container as root only turns up that one in /root/.cargo.

That script appears to be the entrypoint, and nothing in it seems to be installing cargo or setting up a .cargo directory (imagine it's probably part of the build). I don't think there's any chance the script could skip line 53, either.

As a workaround, you could probably add an additional volume for /.cargo/ with the necessary env file in it, but that's a lot of work and you'd have to figure out what to put in that file. Or if you trust it, I suppose you could run as root. As mentioned, the ownership/permissions might get a little wonky when you build, but you could change them back with chown.

snydergd avatar Feb 19 '21 21:02 snydergd

I also just hit this issue but was able to resolve it by building the container from master.

Try cloning the repo and just running make build in the root of the repo. Annoyingly this means that the fix will only apply to your local docker install so won't help if you are using CICD. For that case you will need to push to a container registry and use your repository until a fixed build is pushed to the softprops repo.

alisonjenkins avatar Feb 24 '21 06:02 alisonjenkins

Hello, any update on this? While we can build it locally as @alanjjenkins mentioned above, it would be great if we didn't have to do this intermediary step. Thanks!

RaviH avatar Apr 19 '21 16:04 RaviH

Any update on this? Thanks!

encee avatar Jul 29 '21 16:07 encee

To fix this, run the following command to open /home/<your_user>/.bashrc : gedit ~/.bashrc

And just delete the line that will say something like: . "$HOME/.cargo/env"

Save the file and open a new terminal and you should no longer see the error.

amritabithi avatar Aug 13 '22 03:08 amritabithi