Hi, everyone!
I am trying to build Anki from the latest commit to the master branch of the source code repository. I’m running into some errors related to rustfmt that I don’t totally understand.
Here is the complete output of the run
script in the root of the repository:
$ ./run
make: Entering directory '/home/wrycode/code/anki'
make[1]: Entering directory '/home/wrycode/code/anki/rslib'
make[1]: Nothing to be done for 'develop'.
make[1]: Leaving directory '/home/wrycode/code/anki/rslib'
make[1]: Entering directory '/home/wrycode/code/anki/rspy'
touch ../proto/backend.proto
FTL_TEMPLATE_DIRS="../qt/ftl" FTL_LOCALE_DIRS="../qt/ftl/repo/desktop" CARGO_TARGET_DIR="target" MACOSX_DEPLOYMENT_TARGET=10.7 \
maturin develop --release --strip
🔗 Found pyo3 bindings
🐍 Found CPython 3.8 at python
Compiling openssl v0.10.30
Compiling askama v0.10.3
Compiling anki v2.1.36 (/home/wrycode/code/anki/rslib)
Compiling num_enum v0.5.1
error: failed to run custom build command for `anki v2.1.36 (/home/wrycode/code/anki/rslib)`
Caused by:
process didn't exit successfully: `/home/wrycode/code/anki/rspy/target/release/build/anki-5e11832502fa7988/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-changed=./ftl/custom-study.ftl
cargo:rerun-if-changed=./ftl/card-template-rendering.ftl
cargo:rerun-if-changed=./ftl/findreplace.ftl
cargo:rerun-if-changed=./ftl/statistics.ftl
cargo:rerun-if-changed=./ftl/deck-config.ftl
cargo:rerun-if-changed=./ftl/database-check.ftl
cargo:rerun-if-changed=./ftl/media-check.ftl
cargo:rerun-if-changed=./ftl/empty-cards.ftl
cargo:rerun-if-changed=./ftl/sync.ftl
cargo:rerun-if-changed=./ftl/notetypes.ftl
cargo:rerun-if-changed=./ftl/search.ftl
cargo:rerun-if-changed=./ftl/filtering.ftl
cargo:rerun-if-changed=./ftl/card-stats.ftl
cargo:rerun-if-changed=./ftl/network.ftl
cargo:rerun-if-changed=./ftl/card-templates.ftl
cargo:rerun-if-changed=./ftl/scheduling.ftl
cargo:rerun-if-changed=./ftl/importing.ftl
cargo:rerun-if-changed=./ftl/errors.ftl
cargo:rerun-if-changed=./ftl/addons.ftl
cargo:rerun-if-changed=./ftl/profiles.ftl
cargo:rerun-if-changed=./ftl/preferences.ftl
cargo:rerun-if-changed=../proto/backend.proto
This version of rustfmt is deprecated. Use rustfmt-nightly. Use --force to run deprecated rustfmt.
usage: rustfmt [options] <file>...
Options:
-h, --help show this message
-V, --version show version information
-v, --verbose print verbose output
-f, --force force rustfmt to actually run
--write-mode [replace|overwrite|display|diff|coverage|checkstyle]
mode to write in (not usable when piping from stdin)
--skip-children
don't reformat child modules
--config-help show details of rustfmt configuration options
--dump-default-config PATH
Dumps the default configuration to a file and exits.
--dump-minimal-config PATH
Dumps configuration options that were checked during
formatting to a file.
--config-path [Path for the configuration file]
Recursively searches the given path for the
rustfmt.toml config file. If not found reverts to the
input file path
--file-lines JSON
Format specified line ranges. See README for more
detail on the JSON format.
--- stderr
thread 'main' panicked at 'rustfmt backend_proto.rs failed', /home/wrycode/code/anki/rslib/build.rs:217:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
💥 maturin failed
Caused by: Failed to build a native library through cargo
Caused by: Failed to build a native library through cargo
Caused by: Cargo build finished with "exit code: 101": `cargo rustc --message-format json --manifest-path Cargo.toml --lib --release -- -C link-arg=-s`
make[1]: *** [Makefile:64: .build/develop] Error 1
make[1]: Leaving directory '/home/wrycode/code/anki/rspy'
make: *** [Makefile:94: develop] Error 2
make: Leaving directory '/home/wrycode/code/anki'
I looked at the makefiles in rslib
and rspy
and they both call cargo fmt
as well as rustup component add rustfmt-preview --toolchain $(RUST_TOOLCHAIN)
. The rust-toolchain
file is set to stable
for both rust crates but I tried setting them to nightly
and got the same errors.
The build process is kind of opaque to me. Can anyone point me in the right direction in terms of understanding where the problem occurs?