Skip to content
This repository was archived by the owner on Dec 17, 2022. It is now read-only.

Compile errors when building 0.4.0 #6

Closed
rishflab opened this issue Sep 5, 2021 · 5 comments
Closed

Compile errors when building 0.4.0 #6

rishflab opened this issue Sep 5, 2021 · 5 comments

Comments

@rishflab
Copy link

rishflab commented Sep 5, 2021

I was trying to compile this plugin in order to help resolve dprint/dprint#409 but compilation failed.

   Compiling cargo_metadata v0.8.2
     Running `rustc --crate-name cargo_metadata /home/rishflab/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo_metadata-0.8.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' -C metadata=d968fcedfcbd54b1 -C extra-filename=-d968fcedfcbd54b1 --out-dir /home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps --target wasm32-unknown-unknown -L dependency=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps -L dependency=/home/rishflab/dprint/dprint-plugin-rustfmt/target/release/deps --extern semver=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libsemver-f7536294878aa226.rmeta --extern serde=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libserde-596361274aa9d55a.rmeta --extern serde_derive=/home/rishflab/dprint/dprint-plugin-rustfmt/target/release/deps/libserde_derive-4951c2f7191e6604.so --extern serde_json=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libserde_json-6167f5ede36f440b.rmeta --cap-lints allow`
     Running `rustc --crate-name rustfmt_nightly --edition=2018 /home/rishflab/.cargo/git/checkouts/rustfmt-c4b65366788d3254/129c888/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="cargo-fmt"' --cfg 'feature="default"' --cfg 'feature="rustfmt-format-diff"' -C metadata=d6ee6c195b970233 -C extra-filename=-d6ee6c195b970233 --out-dir /home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps --target wasm32-unknown-unknown -L dependency=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps -L dependency=/home/rishflab/dprint/dprint-plugin-rustfmt/target/release/deps --extern annotate_snippets=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libannotate_snippets-c92b79408f0600e9.rmeta --extern anyhow=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libanyhow-101a732f15831f18.rmeta --extern bytecount=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libbytecount-c9ef821899239c91.rmeta --extern cargo_metadata=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libcargo_metadata-d968fcedfcbd54b1.rmeta --extern derive_new=/home/rishflab/dprint/dprint-plugin-rustfmt/target/release/deps/libderive_new-fc3c5c9fc137cb6c.so --extern diff=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libdiff-3377d3aad505ccd7.rmeta --extern dirs=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libdirs-4f67ea63a3126779.rmeta --extern env_logger=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libenv_logger-2cede2fd4135419e.rmeta --extern getopts=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libgetopts-848c5087eb088b76.rmeta --extern ignore=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libignore-8a1282242b63696f.rmeta --extern itertools=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libitertools-0532b425598748cd.rmeta --extern lazy_static=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/liblazy_static-dc505f6b51090c17.rmeta --extern log=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/liblog-f89072dff55fef5a.rmeta --extern regex=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libregex-dde5f988033996b8.rmeta --extern rustc_workspace_hack=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/librustc_workspace_hack-dbb7d9fb6d938fc8.rmeta --extern rustfmt_config_proc_macro=/home/rishflab/dprint/dprint-plugin-rustfmt/target/release/deps/librustfmt_config_proc_macro-cbd058a62e07c989.so --extern serde=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libserde-596361274aa9d55a.rmeta --extern serde_json=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libserde_json-6167f5ede36f440b.rmeta --extern structopt=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libstructopt-627ff929530a0ed2.rmeta --extern term=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libterm-2d22f5c3efe7c2ad.rmeta --extern thiserror=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libthiserror-7312a45965ecbb1b.rmeta --extern toml=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libtoml-c58bb194ddf37f8e.rmeta --extern unicode_segmentation=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libunicode_segmentation-63227aa007118084.rmeta --extern unicode_width=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libunicode_width-dd37efb992b30009.rmeta --extern unicode_categories=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libunicode_categories-fa1780c05dcbb100.rmeta --cap-lints allow`
error[E0463]: can't find crate for `rustc_ast`
  --> /home/rishflab/.cargo/git/checkouts/rustfmt-c4b65366788d3254/129c888/src/lib.rs:14:1
   |
14 | extern crate rustc_ast;
   | ^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `rustfmt-nightly`

Caused by:
  process didn't exit successfully: `rustc --crate-name rustfmt_nightly --edition=2018 /home/rishflab/.cargo/git/checkouts/rustfmt-c4b65366788d3254/129c888/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="cargo-fmt"' --cfg 'feature="default"' --cfg 'feature="rustfmt-format-diff"' -C metadata=d6ee6c195b970233 -C extra-filename=-d6ee6c195b970233 --out-dir /home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps --target wasm32-unknown-unknown -L dependency=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps -L dependency=/home/rishflab/dprint/dprint-plugin-rustfmt/target/release/deps --extern annotate_snippets=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libannotate_snippets-c92b79408f0600e9.rmeta --extern anyhow=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libanyhow-101a732f15831f18.rmeta --extern bytecount=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libbytecount-c9ef821899239c91.rmeta --extern cargo_metadata=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libcargo_metadata-d968fcedfcbd54b1.rmeta --extern derive_new=/home/rishflab/dprint/dprint-plugin-rustfmt/target/release/deps/libderive_new-fc3c5c9fc137cb6c.so --extern diff=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libdiff-3377d3aad505ccd7.rmeta --extern dirs=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libdirs-4f67ea63a3126779.rmeta --extern env_logger=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libenv_logger-2cede2fd4135419e.rmeta --extern getopts=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libgetopts-848c5087eb088b76.rmeta --extern ignore=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libignore-8a1282242b63696f.rmeta --extern itertools=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libitertools-0532b425598748cd.rmeta --extern lazy_static=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/liblazy_static-dc505f6b51090c17.rmeta --extern log=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/liblog-f89072dff55fef5a.rmeta --extern regex=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libregex-dde5f988033996b8.rmeta --extern rustc_workspace_hack=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/librustc_workspace_hack-dbb7d9fb6d938fc8.rmeta --extern rustfmt_config_proc_macro=/home/rishflab/dprint/dprint-plugin-rustfmt/target/release/deps/librustfmt_config_proc_macro-cbd058a62e07c989.so --extern serde=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libserde-596361274aa9d55a.rmeta --extern serde_json=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libserde_json-6167f5ede36f440b.rmeta --extern structopt=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libstructopt-627ff929530a0ed2.rmeta --extern term=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libterm-2d22f5c3efe7c2ad.rmeta --extern thiserror=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libthiserror-7312a45965ecbb1b.rmeta --extern toml=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libtoml-c58bb194ddf37f8e.rmeta --extern unicode_segmentation=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libunicode_segmentation-63227aa007118084.rmeta --extern unicode_width=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libunicode_width-dd37efb992b30009.rmeta --extern unicode_categories=/home/rishflab/dprint/dprint-plugin-rustfmt/target/wasm32-unknown-unknown/release/deps/libunicode_categories-fa1780c05dcbb100.rmeta --cap-lints allow` (exit status: 1)
warning: build failed, waiting for other jobs to finish...
error: build failed
@rishflab
Copy link
Author

rishflab commented Sep 6, 2021

I think the dependency to rust fmt needs to be given a rev tag in the Cargo.toml to lock it to a commit

@dsherret
Copy link
Member

dsherret commented Sep 6, 2021

Yes, I think you're right. Last time I went to go try to build this I encountered the same problem. I will look into it soon or maybe @thomaseizinger knows a quick fix.

It's really so unfortunate this plugin is no longer a wasm plugin and if it were a wasm plugin then I believe this would solve all your issues. I opened #7 to track this.

@thomaseizinger
Copy link
Contributor

Yes, I think you're right. Last time I went to go try to build this I encountered the same problem. I will look into it soon or maybe @thomaseizinger knows a quick fix.

The revision is locked in the Cargo.lock file: https://github.com/dprint/dprint-plugin-rustfmt/blob/main/Cargo.lock#L572

I don't quite understand why it would fail to compile.

@thomaseizinger
Copy link
Contributor

thomaseizinger commented Sep 6, 2021

Compiles cleanly on my machine.

❯ uname -a
Linux thomas-thinkpad 5.10.61-1-MANJARO #1 SMP PREEMPT Thu Aug 26 20:36:54 UTC 2021 x86_64 GNU/Linux

Command used:

cargo build --bin dprint-plugin-rustfmt --features=process --release --verbose

@dsherret
Copy link
Member

This should be resolved now. I'm able to compile, but wasn't able to previously.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants