cargo install cargo-xbuild
# build driver for x64
cargo xbuild --target x86_64-kernel-windows-msvc.json
# build driver for x86
cargo xbuild --target i686-kernel-windows-msvc.json
License: MIT License
cargo install cargo-xbuild
# build driver for x64
cargo xbuild --target x86_64-kernel-windows-msvc.json
# build driver for x86
cargo xbuild --target i686-kernel-windows-msvc.json
The 1 variant compiles ok.
The 2 variant throws errors like:
error[E0432]: unresolved import `crate::shared::basetsd`
--> ...\.cargo\git\checkouts\winapi-rs-f8a1797f224d11f2\ef14b40\src\km\fwp\fwpstypes.rs:1:20
|
1 | use crate::shared::basetsd::*;
| ^^^^^^^ could not find `basetsd` in `shared`
If we use --verbose flag can see different running commands for winapi:
Running `rustc --crate-name winapi ... --sysroot C:\Users\0g\git\win_driver_example\target/sysroot --cfg "feature=\"ws2ipdef\"" --cfg "feature=\"wdm\"" --cfg "feature=\"vcruntime\"" --cfg "feature=\"devpropdef\"" --cfg "feature=\"minwindef\"" --cfg "feature=\"ntdef\"" --cfg "feature=\"excpt\"" --cfg "feature=\"in6addr\"" --cfg "feature=\"minwinbase\"" --cfg "feature=\"inaddr\"" --cfg "feature=\"ifdef\"" --cfg "feature=\"guiddef\"" --cfg "feature=\"basetsd\"" --cfg "feature=\"netioapi\"" --cfg "feature=\"winnt\"" --cfg "feature=\"ws2def\"" --cfg "feature=\"ktmtypes\"" -l dylib=iphlpapi -l dylib=kernel32`
Running `rustc --crate-name winapi ... --sysroot C:\Users\0g\git\win-driver-example\target/sysroot`
When using rustc 1.43.0-nightly (e02974078 2020-02-18)
and running cargo xbuild --target x86_64-kernel-windows-msvc.json
on a new clone of master, I get the following linker error:
= note: LINK : warning LNK4216: Exported entry point DriverEntry Creating object D:\dev\rust\win_driver_example\target\x86_64-kernel-windows-msvc\debug\deps\win_driver_example.dll.exp libcompiler_builtins-a5dc3a27f854a583.rlib(compiler_builtins-a5dc3a27f854a583.compiler_builtins.2hb76v1n-cgu.12.rcgu.o) : error LNK2001: unresolved external symbol _fltused libcompiler_builtins-a5dc3a27f854a583.rlib(compiler_builtins-a5dc3a27f854a583.compiler_builtins.2hb76v1n-cgu.4.rcgu.o) : error LNK2001: unresolved external symbol _fltused libcompiler_builtins-a5dc3a27f854a583.rlib(compiler_builtins-a5dc3a27f854a583.compiler_builtins.2hb76v1n-cgu.14.rcgu.o) : error LNK2001: unresolved external symbol _fltused libcompiler_builtins-a5dc3a27f854a583.rlib(compiler_builtins-a5dc3a27f854a583.compiler_builtins.2hb76v1n-cgu.1.rcgu.o) : error LNK2001: unresolved external symbol _fltused libcompiler_builtins-a5dc3a27f854a583.rlib(compiler_builtins-a5dc3a27f854a583.compiler_builtins.2hb76v1n-cgu.13.rcgu.o) : error LNK2001: unresolved external symbol _fltused libcompiler_builtins-a5dc3a27f854a583.rlib(compiler_builtins-a5dc3a27f854a583.compiler_builtins.2hb76v1n-cgu.2.rcgu.o) : error LNK2001: unresolved external symbol _fltused libcompiler_builtins-a5dc3a27f854a583.rlib(compiler_builtins-a5dc3a27f854a583.compiler_builtins.2hb76v1n-cgu.9.rcgu.o) : error LNK2001: unresolved external symbol _fltused libcore-7339924e45ccdcb4.rlib(core-7339924e45ccdcb4.core.e6t8h8ow-cgu.12.rcgu.o) : error LNK2001: unresolved external symbol _fltused libcore-7339924e45ccdcb4.rlib(core-7339924e45ccdcb4.core.e6t8h8ow-cgu.3.rcgu.o) : error LNK2001: unresolved external symbol _fltused libcompiler_builtins-a5dc3a27f854a583.rlib(compiler_builtins-a5dc3a27f854a583.compiler_builtins.2hb76v1n-cgu.15.rcgu.o) : error LNK2001: unresolved external symbol _fltused libcompiler_builtins-a5dc3a27f854a583.rlib(compiler_builtins-a5dc3a27f854a583.compiler_builtins.2hb76v1n-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol _fltused libcore-7339924e45ccdcb4.rlib(core-7339924e45ccdcb4.core.e6t8h8ow-cgu.7.rcgu.o) : error LNK2001: unresolved external symbol _fltused libcore-7339924e45ccdcb4.rlib(core-7339924e45ccdcb4.core.e6t8h8ow-cgu.14.rcgu.o) : error LNK2001: unresolved external symbol _fltused libcore-7339924e45ccdcb4.rlib(core-7339924e45ccdcb4.core.e6t8h8ow-cgu.6.rcgu.o) : error LNK2001: unresolved external symbol _fltused libcore-7339924e45ccdcb4.rlib(core-7339924e45ccdcb4.core.e6t8h8ow-cgu.5.rcgu.o) : error LNK2001: unresolved external symbol _fltused D:\dev\rust\win_driver_example\target\x86_64-kernel-windows-msvc\debug\deps\win_driver_example.sys : fatal error LNK1120: 1 unresolved externals error: aborting due to previous error
It looks like I'm experiencing the same problem demonstrated here, which I guess is an LLVM/Rust-core issue that uses floating point calculations - which aren't allowed when running in the Windows Kernel.
I'm fairly new to Rust and therefore not sure how to handle this properly.
As demonstrated in the link I managed to work around the error by adding the following snippet to my lib.rs:
#[used]
#[no_mangle]
static _fltused: i32 = 0;
typo:
recv -> rev
And you can use branch
or rev
:
warning: dependency (winapi) specification is ambiguous. Only one of `branch`, `tag` or `rev` is allowed. This will be considered an error in future versions
I am trying to create a driver based on this repository. Trying to build the repo without any changes eventually gives me the error in the title.
language item required, but not found: eh_personality
My primary interest is in Windows kernel-mode drivers, and I've just recently started playing with Rust.
In trying to build (either target for) this project using "rustc 1.47.0-nightly (770bd3d1d 2020-08-10)" I get:
error: internal compiler error: src\librustc_codegen_llvm\context.rs:159:13: data-layout for builtin
x86_64-pc-windows-msvctarget,
e-m:w-i64:64-f80:128-n8:16:32:64-S128, differs from LLVM default,
e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128``
and the compiler eventually panics.
Because I'm a complete Rust noob, I have no insight into this whatsoever... even though I've tried to work my way through target definitions and the "data_layout" specification.
Any help would be appreciated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.