rust-osdev / cargo-xbuild

Automatically cross-compiles the sysroot crates core, compiler_builtins, and alloc.
Apache License 2.0
258 stars 25 forks source link

Installing xbuild version 0.6.1 on windows is broken #92

Closed MarnixKuijs closed 4 years ago

MarnixKuijs commented 4 years ago

When running the command cargo install cargo-xbuild it will fail to install due to compilation error in flock.rs

error[E0433]: failed to resolve: maybe a missing crate `winapi`?
   --> C:\.cargo\registry\src\github.com-1ecc6299db9ec823\cargo-xbuild-0.6.1\src\flock.rs:259:9
    |
259 |     use winapi::shared::minwindef::DWORD;
    |         ^^^^^^ maybe a missing crate `winapi`?

error[E0433]: failed to resolve: maybe a missing crate `winapi`?
   --> C:\.cargo\registry\src\github.com-1ecc6299db9ec823\cargo-xbuild-0.6.1\src\flock.rs:260:9
    |
260 |     use winapi::shared::winerror::{ERROR_INVALID_FUNCTION, ERROR_LOCK_VIOLATION};
    |         ^^^^^^ maybe a missing crate `winapi`?

error[E0433]: failed to resolve: maybe a missing crate `winapi`?
   --> C:\.cargo\registry\src\github.com-1ecc6299db9ec823\cargo-xbuild-0.6.1\src\flock.rs:261:9
    |
261 |     use winapi::um::fileapi::{LockFileEx, UnlockFile};
    |         ^^^^^^ maybe a missing crate `winapi`?

error[E0433]: failed to resolve: maybe a missing crate `winapi`?
   --> C:\.cargo\registry\src\github.com-1ecc6299db9ec823\cargo-xbuild-0.6.1\src\flock.rs:262:9
    |
262 |     use winapi::um::minwinbase::{LOCKFILE_EXCLUSIVE_LOCK, LOCKFILE_FAIL_IMMEDIATELY};
    |         ^^^^^^ maybe a missing crate `winapi`?

error[E0425]: cannot find value `LOCKFILE_EXCLUSIVE_LOCK` in this scope
   --> C:\.cargo\registry\src\github.com-1ecc6299db9ec823\cargo-xbuild-0.6.1\src\flock.rs:269:25
    |
269 |         lock_file(file, LOCKFILE_EXCLUSIVE_LOCK)
    |                         ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `LOCKFILE_FAIL_IMMEDIATELY` in this scope
   --> C:\.cargo\registry\src\github.com-1ecc6299db9ec823\cargo-xbuild-0.6.1\src\flock.rs:273:25
    |
273 |         lock_file(file, LOCKFILE_FAIL_IMMEDIATELY)
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `LOCKFILE_EXCLUSIVE_LOCK` in this scope
   --> C:\.cargo\registry\src\github.com-1ecc6299db9ec823\cargo-xbuild-0.6.1\src\flock.rs:277:25
    |
277 |         lock_file(file, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY)
    |                         ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `LOCKFILE_FAIL_IMMEDIATELY` in this scope
   --> C:\.cargo\registry\src\github.com-1ecc6299db9ec823\cargo-xbuild-0.6.1\src\flock.rs:277:51
    |
277 |         lock_file(file, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY)
    |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `ERROR_LOCK_VIOLATION` in this scope
   --> C:\.cargo\registry\src\github.com-1ecc6299db9ec823\cargo-xbuild-0.6.1\src\flock.rs:282:37
    |
282 |             .map_or(false, |x| x == ERROR_LOCK_VIOLATION as i32)
    |                                     ^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `ERROR_INVALID_FUNCTION` in this scope
   --> C:\.cargo\registry\src\github.com-1ecc6299db9ec823\cargo-xbuild-0.6.1\src\flock.rs:287:37
    |
287 |             .map_or(false, |x| x == ERROR_INVALID_FUNCTION as i32)
    |                                     ^^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function, tuple struct or tuple variant `UnlockFile` in this scope
   --> C:\.cargo\registry\src\github.com-1ecc6299db9ec823\cargo-xbuild-0.6.1\src\flock.rs:292:23
    |
292 |             let ret = UnlockFile(file.as_raw_handle(), 0, 0, !0, !0);
    |                       ^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `DWORD` in this scope
   --> C:\.cargo\registry\src\github.com-1ecc6299db9ec823\cargo-xbuild-0.6.1\src\flock.rs:301:38
    |
301 |     fn lock_file(file: &File, flags: DWORD) -> Result<()> {
    |                                      ^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
254 |     use flock::io::sys::c::DWORD;
    |
254 |     use flock::io::sys::net::sys_common::backtrace::backtrace_rs::windows::DWORD;
    |

error[E0425]: cannot find function, tuple struct or tuple variant `LockFileEx` in this scope
   --> C:\.cargo\registry\src\github.com-1ecc6299db9ec823\cargo-xbuild-0.6.1\src\flock.rs:304:23
    |
304 |             let ret = LockFileEx(file.as_raw_handle(), flags, 0, !0, !0, &mut overlapped);
    |                       ^^^^^^^^^^ not found in this scope

Version 0.6.0 does install and compile properly

phil-opp commented 4 years ago

This seems to be related to https://github.com/rust-osdev/cargo-xbuild/pull/91. I can reproduce this issue when trying to compile on Windows, so I will yank version 0.6.1 for now. Thanks a lot for reporting!

phil-opp commented 4 years ago

Fixed in #94