lemmy
lemmy copied to clipboard
error: failed to run custom build command for `lemmy_utils v0.16.3...
I can't build the Project.
I did this: https://join-lemmy.org/docs/en/contributing/local_development.html
It failed @ "cargo run"
cargo run
Compiling lemmy_utils v0.16.3 (/home/johnnyb/lemmy/lemmy/crates/utils)
Compiling task-local-extensions v0.1.1
Compiling diesel v1.4.8
Compiling tokio-stream v0.1.8
error: failed to run custom build command for `lemmy_utils v0.16.3 (/home/johnnyb/lemmy/lemmy/crates/utils)`
Caused by:
process didn't exit successfully: `/home/johnnyb/lemmy/lemmy/target/debug/build/lemmy_utils-8fc58a1472ad9f1e/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-changed=translations/email/en.json
cargo:rerun-if-changed=translations/email/fi.json
cargo:rerun-if-changed=translations/email/ko.json
cargo:rerun-if-changed=translations/email/pt.json
--- stderr
Error: Fmt(Os { code: 2, kind: NotFound, message: "No such file or directory" })
warning: build failed, waiting for other jobs to finish...
error: build failed
Any Help?
git pull --recurse-submodules
or
git submodule update --init --recursive --remote
git pull --recurse-submodules
or
git submodule update --init --recursive
Fetching submodule crates/utils/translations Already up to date.
Didn't work, same error
edit: https://join-lemmy.org/docs/en/contributing/docker_development.html works tho
That uses the same files, so if Docker build works, local build should work as well. Does git status
show anything out of date? And does crates/utils/translations/translations/en.json
exist?
GIt status:
git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean
crates/utils/translations/translations/en.json exists.
Its clearly missing otherwise you wouldn't be getting a nosuchfilefound excepotion. Show us the output of
head crates/utils/translations/translations/en.json
Its clearly missing otherwise you wouldn't be getting a nosuchfilefound excepotion. Show us the output of
head crates/utils/translations/translations/en.json
head crates/utils/translations/translations/en.json { "post": "post", "remove_post": "Remove Post", "no_posts": "No Posts.", "create_a_post": "Create a post", "create_post": "Create Post", "number_of_posts": "{{formattedCount}} Post", "number_of_posts_plural": "{{formattedCount}} Posts", "posts": "Posts", "related_posts": "These posts might be related",
Other files mentioned in the error message also exist? Then that error doesnt really make sense. Maybe try a clean build.
IE cargo clean
IE
cargo clean
didn't work, same error after doing cargo run again
Other files mentioned in the error message also exist?
No, that's the only error
Maybe try a clean build.
I can try again tomorrow
thanks for helping
I have the same issue and a clean build does not appear to have fixed anything. Maybe this is some missing dependency for translations? It doesn't say what file is missing.
Try these commands:
git submodule init
git submodule update --recursive --remote
cargo run
Try these commands:
git submodule init git submodule update --recursive --remote cargo run
Thanks but this doesn't solve the problem.
I can confirm that I already checked out submodules and all the files are there.
The CI would be failing if that wasn't working properly, but I'll test it locally in a new folder.
This could also be a permissions issue, though I'm just taking a stab in the dark. The error message is the same, IIRC because it doesn't know the difference between a file that doesn't exist and one it doesn't have access to. But again, the error message doesn't list what file it's asking for so the submodule that it's building could be a red herring and this is some dependency that it can't find or similar. Maybe the error message needs to be improved as a starting point?
I just ran those exact three commands on a fresh clone, and everything worked fine. The only thing I can suspect, if the files are there:
- Old rust version
- Not running cargo clean
- Not using --remote when cloning the submodules.
I'm not sure how permissions could get messed up, unless you cloned the repo with a different user that you added submodules.
Almost guaranteed its the rust version, or not properly installing rust using rustup. No other explanation for why a cargo run would fail, but a docker build working on the same files passes.
Please don't close this, it is still affecting two people. We are not lying when we say we ran cargo clean, or when we say that we initialized submodules. Here is an exact session starting from scratch that, on my machine at least, reproduces the issue.
$ git clone [email protected]:LemmyNet/lemmy.git --recursive
Cloning into 'lemmy'...
remote: Enumerating objects: 47566, done.
remote: Counting objects: 100% (3614/3614), done.
remote: Compressing objects: 100% (1973/1973), done.
remote: Total 47566 (delta 2024), reused 2976 (delta 1626), pack-reused 43952
Receiving objects: 100% (47566/47566), 11.65 MiB | 14.29 MiB/s, done.
Resolving deltas: 100% (31957/31957), done.
Submodule 'crates/utils/translations' (https://github.com/LemmyNet/lemmy-translations.git) registered for path 'crates/utils/translations'
Cloning into '/home/sam/Projects/lemmy/crates/utils/translations'...
remote: Enumerating objects: 1848, done.
remote: Counting objects: 100% (1848/1848), done.
remote: Compressing objects: 100% (1019/1019), done.
remote: Total 1848 (delta 1523), reused 1131 (delta 826), pack-reused 0
Receiving objects: 100% (1848/1848), 463.97 KiB | 7.36 MiB/s, done.
Resolving deltas: 100% (1523/1523), done.
Submodule path 'crates/utils/translations': checked out 'ad40feba4263a850f135946847d3ddd1a890a6e7'
$ cd lemmy
$ cargo build
$ cargo build
Compiling serde_derive v1.0.136
Compiling tracing-attributes v0.1.20
Compiling tokio-macros v1.7.0
Compiling futures-macro v0.3.21
Compiling thiserror-impl v1.0.30
Compiling pin-project-internal v1.0.10
Compiling async-trait v0.1.53
Compiling actix-macros v0.2.3
Compiling html5ever v0.25.2
Compiling diesel_derives v1.4.1
Compiling derive_more v0.99.17
Compiling smart-default v0.6.0
Compiling strum_macros v0.24.0
Compiling lemmy_apub_lib_derive v0.16.3 (/home/sam/Projects/lemmy/crates/apub_lib_derive)
Compiling prost-derive v0.9.0
Compiling actix_derive v0.6.0
Compiling async-stream-impl v0.3.3
Compiling futures-util v0.3.21
Compiling darling_macro v0.13.1
Compiling pest_derive v2.1.0
Compiling pin-project v1.0.10
Compiling thiserror v1.0.30
Compiling tracing v0.1.32
Compiling darling_macro v0.12.4
Compiling actix-web-codegen v4.0.0
Compiling async-stream v0.3.3
Compiling tokio v1.17.0
Compiling tracing-futures v0.2.5
Compiling tracing-subscriber v0.3.9
Compiling darling v0.13.1
Compiling comrak v0.12.1
Compiling lemmy_utils v0.16.3 (/home/sam/Projects/lemmy/crates/utils)
error: failed to run custom build command for `lemmy_utils v0.16.3 (/home/sam/Projects/lemmy/crates/utils)`
Caused by:
process didn't exit successfully: `/home/sam/Projects/lemmy/target/debug/build/lemmy_utils-d93e76ca7f395151/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-changed=translations/email/en.json
cargo:rerun-if-changed=translations/email/fi.json
cargo:rerun-if-changed=translations/email/ko.json
cargo:rerun-if-changed=translations/email/pt.json
--- stderr
Error: Fmt(Os { code: 2, kind: NotFound, message: "No such file or directory" })
warning: build failed, waiting for other jobs to finish...
error: build failed
The reason is a wrong Rust version. Some repo is out of date.
Here is how to solve it: Rust must be v 1.60.0
rustc --version
rustc 1.60.0
Do this:
sudo apt update sudo apt upgrade curl https://sh.rustup.rs -sSf | sh
Install it.
Then:
source $HOME/.cargo/env
check your Version again:
rustc --version
now it compiles.
Ahh, I see, it looks like Rust on Fedora is 1.59.0. I'm stuck with the default fedora packages for <reasons>, so I won't be able to build since it seems to require a very recent version. Oh well, thanks for all the help.
You're gonna wanna use rustup to install rust.
I can't, sadly.
weirdly enough, I'm hitting this on nixos with rust 1.61. how weird. Also testing on lemmy 0.16.4 when the submodules are not there I hit a different error
Error: FileRead { file: "translations/email/en.json", source: Os { code: 2, kind: NotFound, message: "No such file or directory" } }
which is clear and correct. But when the submodules are there, I hit
Error: Fmt(Os { code: 2, kind: NotFound, message: "No such file or directory" })
I was wondering what the Fmt in front of the error meant.
I discovered it's actually just a missing rustfmt
binary.
Adding the rustfmt
dependency to my build, just fixed it.
Just in case anyone comes here again.
I opened https://github.com/LemmyNet/lemmy/issues/2333 about specifying a minimum supported rust version.
@happysalada There should be no need to install rustfmt for a simple build. Which command did you run to get that second error?
just cargo build
you can see the other people in the thread have exactly the same error (it starts with Fmt
).
Not sure why, but it looks like rustfmt is required here.
I don't think it appears on most machines since people have it by default, however, on some build environments with little dependencies this is where we see the error.
(I'm coming here from updating lemmy on nixos).
@happysalada Could you test if a toolchain file can solve the problem for you? I suppose it should look something like this, but not sure which components are really needed.
[toolchain]
channel = "stable"
components = [ "rustfmt", "rustc-dev" ]
It would also be nice to show a better error message in case a user forgot to sync the submodule, but i cant think of any good way to do that.
Depending on the distribution, a toolchain file might not work. On nixos for example, rust doesn't use a toolchain file, you have to pull separately each component manually. Nix won't allow you to download something from the internet without defining how to build it from source or its sha256. I don't know about other distributions. For nixos, we have to add "rustfmt" to the list of build inputs, there is unfortunately no way around it.
lemmy % cargo build
Compiling serde_derive v1.0.137
Compiling tokio-macros v1.7.0
Compiling tracing-attributes v0.1.20
Compiling futures-macro v0.3.21
Compiling thiserror-impl v1.0.31
Compiling actix-macros v0.2.3
Compiling async-trait v0.1.56
Compiling pin-project-internal v1.0.10
Compiling html5ever v0.25.2
Compiling diesel_derives v1.4.1
Compiling derive_more v0.99.17
Compiling openssl-macros v0.1.0
Compiling strum_macros v0.24.0
Compiling smart-default v0.6.0
Compiling activitypub_federation_derive v0.2.0
Compiling actix_derive v0.6.0
Compiling futures-util v0.3.21
Compiling pin-project v1.0.10
Compiling darling_macro v0.13.1
Compiling darling_macro v0.14.1
Compiling thiserror v1.0.31
Compiling pest_derive v2.1.0
Compiling tracing v0.1.34
Compiling tokio v1.18.2
Compiling openssl v0.10.40
Compiling darling_macro v0.12.4
Compiling actix-web-codegen v4.0.0
Compiling darling v0.13.1
Compiling darling v0.14.1
Compiling comrak v0.12.1
Compiling tracing-futures v0.2.5
Compiling tracing-subscriber v0.3.9
Compiling darling v0.12.4
Compiling lemmy_utils v0.16.5 (/Users/medivh/lemmy/crates/utils)
Compiling doku-derive v0.11.0 (https://github.com/anixe/doku#10a0339a)
error: failed to run custom build command for lemmy_utils v0.16.5 (/Users/medivh/lemmy/crates/utils)
Caused by:
process didn't exit successfully: /Users/medivh/lemmy/target/debug/build/lemmy_utils-d071c63e4373867a/build-script-build
(exit status: 1)
--- stderr
Error: FileRead { file: "translations/email/en.json", source: Os { code: 2, kind: NotFound, message: "No such file or directory" } }
warning: build failed, waiting for other jobs to finish...

@medivh63 Did you follow the steps in this comment?