rust-osdev / bootloader

An experimental pure-Rust x86 bootloader
Apache License 2.0
1.39k stars 212 forks source link

Problem building outdated proc-macros2 version on nightly #378

Closed AarSeBail closed 1 year ago

AarSeBail commented 1 year ago

When I try and build my kernel with the latest nightly I am hit with the following error from

error: failed to run custom build command for `bootloader v0.11.3`

Caused by:
  process didn't exit successfully: `/home/user/Code/project/target/debug/build/bootloader-5b7a829b00971b70/build-script-build` (exit status: 101)
  --- stderr
      Blocking waiting for file lock on package cache
      Blocking waiting for file lock on package cache
      Blocking waiting for file lock on package cache
       Ignored package `bootloader-x86_64-bios-stage-3 v0.11.3` is already installed, use --force to override
  warning: be sure to add `/home/user/Code/project/target/debug/build/bootloader-607e72802a02d67f/out/bin` to your PATH to be able to run the installed binaries
      Blocking waiting for file lock on crate metadata
       Ignored package `bootloader-x86_64-bios-boot-sector v0.11.3` is already installed, use --force to override
  warning: be sure to add `/home/user/Code/project/target/debug/build/bootloader-607e72802a02d67f/out/bin` to your PATH to be able to run the installed binaries
       Ignored package `bootloader-x86_64-bios-stage-2 v0.11.3` is already installed, use --force to override
  warning: be sure to add `/home/user/Code/project/target/debug/build/bootloader-607e72802a02d67f/out/bin` to your PATH to be able to run the installed binaries
      Updating crates.io index
      Blocking waiting for file lock on package cache
      Updating crates.io index
    Installing bootloader-x86_64-uefi v0.11.3
      Blocking waiting for file lock on package cache
      Updating crates.io index
    Installing bootloader-x86_64-bios-stage-4 v0.11.3
      Blocking waiting for file lock on package cache
      Blocking waiting for file lock on package cache
      Updating crates.io index
      Blocking waiting for file lock on package cache
  warning: package `spin v0.9.5` in Cargo.lock is yanked in registry `crates-io`, consider running without --locked
      Blocking waiting for file lock on package cache
  warning: package `spin v0.9.5` in Cargo.lock is yanked in registry `crates-io`, consider running without --locked
      Updating crates.io index
      Blocking waiting for file lock on package cache
      Blocking waiting for file lock on package cache
      Updating crates.io index
      Blocking waiting for file lock on package cache
      Blocking waiting for file lock on package cache
      Blocking waiting for file lock on package cache
     Compiling compiler_builtins v0.1.93
     Compiling core v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
     Compiling proc-macro2 v1.0.51
     Compiling unicode-ident v1.0.8
     Compiling quote v1.0.23
     Compiling syn v1.0.109
     Compiling autocfg v1.1.0
     Compiling semver v1.0.16
     Compiling compiler_builtins v0.1.93
     Compiling serde_derive v1.0.154
     Compiling rustversion v1.0.12
     Compiling serde v1.0.154
     Compiling log v0.4.17
     Compiling bootloader_api v0.11.3
     Compiling lock_api v0.4.9
     Compiling core v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
  error[E0635]: unknown feature `proc_macro_span_shrink`
    --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.51/src/lib.rs:92:30
     |
  92 |     feature(proc_macro_span, proc_macro_span_shrink)
     |                              ^^^^^^^^^^^^^^^^^^^^^^

     Compiling rustc_version v0.4.0
  For more information about this error, try `rustc --explain E0635`.
  error: could not compile `proc-macro2` (lib) due to previous error
  warning: build failed, waiting for other jobs to finish...
     Compiling proc-macro2 v1.0.51
     Compiling unicode-ident v1.0.8
     Compiling quote v1.0.23
     Compiling autocfg v1.1.0
     Compiling semver v1.0.16
     Compiling syn v1.0.109
     Compiling serde_derive v1.0.154
     Compiling serde v1.0.154
     Compiling rustversion v1.0.12
     Compiling log v0.4.17
  error[E0635]: unknown feature `proc_macro_span_shrink`
    --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.51/src/lib.rs:92:30
     |
  92 |     feature(proc_macro_span, proc_macro_span_shrink)
     |                              ^^^^^^^^^^^^^^^^^^^^^^

     Compiling bootloader_api v0.11.3
     Compiling lock_api v0.4.9
  For more information about this error, try `rustc --explain E0635`.
     Compiling rustc_version v0.4.0
  error: could not compile `proc-macro2` (lib) due to previous error
  warning: build failed, waiting for other jobs to finish...
  error: failed to compile `bootloader-x86_64-uefi v0.11.3`, intermediate artifacts can be found at `/tmp/cargo-installKXTJY7`.
  To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
  thread 'main' panicked at 'failed to build uefi bootloader', /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bootloader-0.11.3/build.rs:108:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  error: failed to compile `bootloader-x86_64-bios-stage-4 v0.11.3`, intermediate artifacts can be found at `/tmp/cargo-installYLXDlU`.
  To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

This is an issue that appeared with the June 28th nightly. What is confusing to me is that this should have been fixed by dtolnay/proc-macro2#356, which shipped in proc-macro2 1.0.60. When I view cargo tree I only see dependencies on 1.0.63. I'm not at all familiar with this project, so is there a dependency on proc-macro2 1.0.51 somewhere that needs to be bumped to 1.0.63+?

AarSeBail commented 1 year ago

I have gotten a fork to build at https://github.com/AarSeBail/bootloader/tree/main by bumping the versions of serde, async-process, and gpt. It will not be able to be merged, however, until Quyzi/gpt#91 is resolved. At that point the gpt dependency needs to be reverted from a git dependency.

AarSeBail commented 1 year ago

A new gpt branch, 3.0.1, has been created in the meantime, which should be stable. I have switched the branch of the dependency, so I believe the changes may be merged now.