edit icon indicating copy to clipboard operation
edit copied to clipboard

Build Instructions Failed

Open rsauve opened this issue 6 months ago • 6 comments

When I compile Microsoft Edit repository I receive the following error:

~/Downloads/edit$ cargo build --config .cargo/release.toml --release Compiling edit v1.0.0 (/home/robert/Downloads/edit) error[E0554]: #![feature] may not be used on the stable release channel --> src/lib.rs:4:1 | 4 | / #![feature( 5 | | allocator_api, 6 | | breakpoint, 7 | | cold_path, ... | 14 | | os_string_truncate 15 | | )] | |__^

For more information about this error, try rustc --explain E0554. error: could not compile edit (lib) due to 1 previous error

================================================================== I am running Linux Mint 22.1

I installed Rust: ~/Downloads/edit$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ~/Downloads/edit$ rustup install nightly

I tried to compile Edit: ~/Downloads/edit$ cargo build --config .cargo/release.toml --release

Failed to compile as shown above.

What is the correct procedure to compile Microsoft Edit? Perhaps the Build Instructions need to be updated?

rsauve avatar May 20 '25 03:05 rsauve

You have installed the nightly build of rust, but you must also set it as the default:

$ rustup default nightly

tofpie avatar May 20 '25 03:05 tofpie

What is the output of rustup show?

I have stable and nightly toolchains, with stable as the active one:

PS C:\GitHub\edit> rustup show
Default host: x86_64-pc-windows-msvc
rustup home:  C:\Users\zcobol\.rustup

installed toolchains
--------------------
stable-x86_64-pc-windows-msvc (active, default)
nightly-x86_64-pc-windows-msvc

active toolchain
----------------
name: stable-x86_64-pc-windows-msvc
active because: it's the default toolchain
installed targets:
  x86_64-pc-windows-msvc

and this was the command to build edit so I won't have to change the default toolchain:

cargo +nightly build --config .cargo/release.toml --release

Build output:

PS C:\GitHub\edit> cargo +nightly build --config .cargo/release.toml --release
   Compiling compiler_builtins v0.1.159
   Compiling core v0.0.0 (C:\Users\zcobol\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core)
   Compiling std v0.0.0 (C:\Users\zcobol\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std)
   Compiling windows-targets v0.0.0 (C:\Users\zcobol\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\windows_targets)
   Compiling serde v1.0.219
   Compiling windows_x86_64_msvc v0.52.6
   Compiling toml v0.5.11
   Compiling winres v0.1.12
   Compiling edit v1.0.0 (C:\GitHub\edit)
   Compiling rustc-std-workspace-core v1.99.0 (C:\Users\zcobol\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\rustc-std-workspace-core)
   Compiling alloc v0.0.0 (C:\Users\zcobol\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\alloc)
   Compiling cfg-if v1.0.0
   Compiling rustc-demangle v0.1.24
   Compiling panic_abort v0.0.0 (C:\Users\zcobol\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\panic_abort)
   Compiling unwind v0.0.0 (C:\Users\zcobol\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\unwind)
   Compiling rustc-std-workspace-alloc v1.99.0 (C:\Users\zcobol\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\rustc-std-workspace-alloc)
   Compiling panic_unwind v0.0.0 (C:\Users\zcobol\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\panic_unwind)
   Compiling std_detect v0.1.5 (C:\Users\zcobol\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\stdarch\crates\std_detect)
   Compiling hashbrown v0.15.3
   Compiling rustc-std-workspace-std v1.99.0 (C:\Users\zcobol\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\rustc-std-workspace-std)
   Compiling rustc-literal-escaper v0.0.2
   Compiling proc_macro v0.0.0 (C:\Users\zcobol\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\proc_macro)
   Compiling windows-targets v0.52.6
   Compiling windows-sys v0.59.0
    Finished `release` profile [optimized + debuginfo] target(s) in 22.48s

Before running the command I had to add a component:

rustup component add rust-src --toolchain nightly-x86_64-pc-windows-msvc

zcobol avatar May 20 '25 06:05 zcobol

You have installed the nightly build of rust, but you must also set it as the default:

$ rustup default nightly

Thank you tofpie for your help.

I tried to set the nightly build as the default:

~/Downloads/edit$ rustup default nightly info: using existing install for 'nightly-x86_64-unknown-linux-gnu' info: default toolchain set to 'nightly-x86_64-unknown-linux-gnu'

Now I get this: ~/Downloads/edit$ cargo build --config .cargo/release.toml --release error: "/home/robert/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/Cargo.lock" does not exist, unable to build with the standard library, try: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu

Okay, so I try again: ~/Downloads/edit$ rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu info: downloading component 'rust-src' info: installing component 'rust-src'

~/Downloads/edit$ cargo build --config .cargo/release.toml --release Updating crates.io index Downloaded getopts v0.2.21 Downloaded rustc-literal-escaper v0.0.2 ...... Finished release profile [optimized + debuginfo] target(s) in 38.25s

I found the binary in directory: ../target/release/

I think that the Build Instructions at: https://github.com/microsoft/edit#build-instructions need to be updated as they are rather vague.

rsauve avatar May 20 '25 12:05 rsauve

Good point about it being vague. In the meantime, what you're missing is this I believe:

rustup component add rust-src

lhecker avatar May 20 '25 16:05 lhecker

build with:

RUSTC_BOOTSTRAP=1 cargo build

I got it working on termux Android. im providing the build in a contribution "issue"

jellieware avatar Jun 19 '25 01:06 jellieware

I have same problem on Slackware 15+current GNU/Linux (64-bit n86) when just trying to build (normally-numbered) long-term/stable/user release... the instructions seem to describe that and (git commit hash-numbered) current/experimental/testing release at same time: a bit confusing.

dchmelik avatar Jun 23 '25 23:06 dchmelik

I'm struggling with the build instructions as well. I'm on KISS Linux.

rustup install nightly
rustup default nightly
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-musl
cargo build --config .cargo/release.toml --release

The output is:

info: syncing channel updates for 'nightly-x86_64-unknown-linux-musl'

  nightly-x86_64-unknown-linux-musl unchanged - rustc 1.90.0-nightly (430d6eddf 2025-07-25)

info: using existing install for 'nightly-x86_64-unknown-linux-musl'
info: default toolchain set to 'nightly-x86_64-unknown-linux-musl'

  nightly-x86_64-unknown-linux-musl unchanged - rustc 1.90.0-nightly (430d6eddf 2025-07-25)

info: note that the toolchain 'nightly-x86_64-unknown-linux-musl' is currently in use (overridden by '/home/tyler/.cache/kiss/proc/22189/build/edit/rust-toolchain.toml')
info: component 'rust-src' is up to date
   Compiling libc v0.2.172
   Compiling edit v1.2.0 (/home/tyler/.cache/kiss/proc/22189/build/edit)
error[E0554]: `#![feature]` may not be used on the stable release channel
  --> src/lib.rs:4:1
   |
4  | / #![feature(
5  | |     allocator_api,
6  | |     breakpoint,
7  | |     cold_path,
...  |
12 | |     maybe_uninit_uninit_array_transpose
13 | | )]
   | |__^

warning: use of deprecated type alias `libc::time_t`: This type is changed to 64-bit in musl 1.2.0, we'll follow that change in the future release. See #1848 for more info.
   --> src/sys/unix.rs:218:60
    |
218 |                         tv_sec: timeout.as_secs() as libc::time_t,
    |                                                            ^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

For more information about this error, try `rustc --explain E0554`.
warning: `edit` (lib) generated 1 warning
error: could not compile `edit` (lib) due to 1 previous error; 1 warning emitted

When I include RUSTC_BOOTSTRAP=1 as in:

rustup install nightly
rustup default nightly
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-musl
RUSTC_BOOTSTRAP=1 cargo build --config .cargo/release.toml --release

The output is:

info: syncing channel updates for 'nightly-x86_64-unknown-linux-musl'

  nightly-x86_64-unknown-linux-musl unchanged - rustc 1.90.0-nightly (430d6eddf 2025-07-25)

info: using existing install for 'nightly-x86_64-unknown-linux-musl'
info: default toolchain set to 'nightly-x86_64-unknown-linux-musl'

  nightly-x86_64-unknown-linux-musl unchanged - rustc 1.90.0-nightly (430d6eddf 2025-07-25)

info: note that the toolchain 'nightly-x86_64-unknown-linux-musl' is currently in use (overridden by '/home/tyler/.cache/kiss/proc/2793/build/edit/rust-toolchain.toml')
info: component 'rust-src' is up to date
error: "/usr/lib/rustlib/src/rust/library/Cargo.lock" does not exist, unable to build with the standard library, try:
        rustup component add rust-src

If I try with RUSTC_BOOTSTRAP=1 without rustup install nightly (whether or not I include rustup component add rust-src) I simply get the following output:

info: component 'rust-src' is up to date
error: "/usr/lib/rustlib/src/rust/library/Cargo.lock" does not exist, unable to build with the standard library, try:
        rustup component add rust-src

Is there any way the build process can be simplified? One of the benefits of KISS Linux is that software should be able to build from source in a repeatable way but the complexities of edit's nightly/bootstrap requirements seem to be over-complicating things.

tylerdq avatar Jul 26 '25 20:07 tylerdq

In the future the project will not require nightly Rust. But this project requiring nightly right now, for all intents and purposes, cannot be considered a hurdle.

lhecker avatar Jul 28 '25 13:07 lhecker

I'm not sure what you mean by that last part but since I can't build the project I'll look forward to when it's not nightly-only or someone has ideas about ways to address the errors I mentioned.

tylerdq avatar Jul 28 '25 19:07 tylerdq

error: "/usr/lib/rustlib/src/rust/library/Cargo.lock" does not exist
info: note that the toolchain 'nightly-x86_64-unknown-linux-musl' is currently in use (overridden by
...
error[E0554]: `#![feature]` may not be used on the stable release channel

Considering that it says it's using the nightly toolchain but reporting issues as though it were the stable one, it seems to indicate something that might be out of our control. I'm sorry. It may be that "KISS Linux" is unsuitable for projects requiring nightly builds of Rust right now.

Failure to locate rust-src after you've installed it is a bug that your distributor may be interested in knowing about, regardless. 🙂

DHowett avatar Jul 28 '25 21:07 DHowett

Thanks, that helped point me in the right direction. I built rust-src and updated rust to 1.88.0 then got it to build with:

rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-musl
RUSTC_BOOTSTRAP=1 cargo build --config .cargo/release.toml --release

I'm guessing that updating rust was the missing piece. KISS has community distribution while deferring to individual user repos so I think I needed to make sure I was on the most recent version of rust.

tylerdq avatar Jul 29 '25 20:07 tylerdq