GithubHelp home page GithubHelp logo

minwinsdk's Introduction

Minimal Windows 10 SDK

Installs only the necessary Windows 10 .lib files to save you having to download the full Visual Studio package. You can either download the zip file or the installer.

How to Install

First Visual Studio needs to be installed, but not as much as usual. Using powershell:

> Invoke-WebRequest https://aka.ms/vs/16/release/vs_buildtools.exe -OutFile vs_buildtools.exe
> .\vs_buildtools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.Component.VC.Runtime.UCRTSDK

This will install the Visual Studio package manager then open up the GUI installer. You can click straight on install. All the necessary components are already selected.

Wait for that to finish then run this installer. Alternatively, see Manually Install Only the Libs.

> Invoke-WebRequest https://github.com/ChrisDenton/minwinsdk/releases/download/0.0.1/minwinsdk.exe  -OutFile minwinsdk.exe
> .\minwinsdk

If all goes well you should finally be able to install rustup

> Invoke-WebRequest https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe -OutFile rustup-init.exe
> .\rustup-init -y --default-host x86_64-pc-windows-msvc

Manually Install Only the Libs

Download Minimal.Windows.SDK.zip and unzip it somewhere nice. You may want to set the LIB environment variable for your default target.

Using the libs

If you used the installer or manually set the LIB environment variable then it should "just work" for the default target. If using another target you may need to set the library search path appropriately. You can do this globally in your cargo configuration file. By default it's located at %USERPROFILE%\.cargo\config.toml but you might need to create it.

Add this to the config (replacing path\to\libs with the folder the libs are in):

[target.x86_64-pc-windows-msvc]
rustflags = [ "-L", "path\to\libs\x64"]

[target.i686-pc-windows-msvc]
rustflags = [ "-L", "path\to\libs\x86"]

[target.aarch64-pc-windows-msvc]
rustflags = [ "-L", "path\to\libs\arm64"]

[target.thumbv7a-pc-windows-msvc]
rustflags = [ "-L", "path\to\libs\arm"]

Limitations

  • I have not yet tested that all the imports work.
  • These libs do not (yet?) include ucrt.lib.
  • I only provide an x86_64 installer. There's no inherent reason for this, it's just that I'm being lazy.
  • I wrote this in a very short space of time so this should be considered alpha quality software (if we're being very generous). Honestly it's probably better to just download the zip file and install the libs manually. That way you'll avoid any scary warnings berating you for downloading software from the internet. Which you should never do. 👀

The future

This should become obsolete once Rust has raw-dylibs.

minwinsdk's People

Contributors

chrisdenton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

bytebaker

minwinsdk's Issues

error: linking with `link.exe` failed: exit code: 1120

Hello. I made all steps:

PS C:\Users\8Observer8> Invoke-WebRequest https://aka.ms/vs/16/release/vs_buildtools.exe -OutFile vs_buildtools.exe
PS C:\Users\8Observer8> .\vs_buildtools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.Component.VC.Runtime.UCRTSDK
PS C:\Users\8Observer8> .\vs_buildtools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.Component.VC.Runtime.UCRTSDK
PS C:\Users\8Observer8> .\vs_buildtools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.Component.VC.Runtime.UCRTSDK
PS C:\Users\8Observer8> Invoke-WebRequest https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe -OutFile rustup-init.exe
PS C:\Users\8Observer8> .\rustup-init -y --default-host x86_64-pc-windows-msvc
info: profile set to 'default'
info: setting default host triple to x86_64-pc-windows-msvc
info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
info: latest update on 2024-03-28, rust version 1.77.1 (7cf61ebde 2024-03-27)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
 14.9 MiB /  14.9 MiB (100 %)  11.3 MiB/s in  3s ETA:  0s
info: downloading component 'rust-std'
 18.2 MiB /  18.2 MiB (100 %)  11.3 MiB/s in  4s ETA:  0s
info: downloading component 'rustc'
 58.1 MiB /  58.1 MiB (100 %)  11.2 MiB/s in 11s ETA:  0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 14.9 MiB /  14.9 MiB (100 %)  36.8 KiB/s in  9m 42s ETA:  0s
  9 IO-ops /   9 IO-ops (100 %)   3 IOPS in  2s ETA:  0s
info: installing component 'rust-std'
 18.2 MiB /  18.2 MiB (100 %)   6.0 MiB/s in  7s ETA:  0s
  9 IO-ops /   9 IO-ops (100 %)   0 IOPS in 31s ETA: Unknown
info: installing component 'rustc'
 58.1 MiB /  58.1 MiB (100 %)   7.1 MiB/s in 13s ETA:  0s
  9 IO-ops /   9 IO-ops (100 %)   0 IOPS in 19s ETA: Unknown
info: installing component 'rustfmt'
info: default toolchain set to 'stable-x86_64-pc-windows-msvc'

  stable-x86_64-pc-windows-msvc installed - rustc 1.77.1 (7cf61ebde 2024-03-27)


Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload its PATH environment variable to include
Cargo's bin directory (%USERPROFILE%\.cargo\bin).

I downloaded this folder:

image

I created config.toml here: C:\Users\8Observer8\.cargo

[target.x86_64-pc-windows-msvc]
rustflags = [ "-L", "E:\Program Files (installed)\Minimal Windows SDK\libs\x64"]

Visual Studio Build Tools are installed:

image

main.rs

fn main() {
    println!("Hello Rust!");
}

How to solve these errors:

E:\_Projects\Rust\rust-hello>rustc main.rs
error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\8OBSER~1\\AppData\\Local\\Temp\\rustc7H02qM\\symbols.o" "main.main.f243dba173d1fb40-cgu.0.rcgu.o" "main.1k7xnxz5r7j3vzlw.rcgu.o" "/LIBPATH:C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-af7a289140bfd09b.rlib" "C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-804f96e85949d3c7.rlib" "C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-d732e2e30f000f5c.rlib" "C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_detect-245c07b81320e419.rlib" "C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-071209d3d999dcc9.rlib" "C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-f692450d6626dc45.rlib" "C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-80b2971dd5ef99d4.rlib" "C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-9b96265a2194d52d.rlib" "C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-9f5f4b367cf5c108.rlib" "C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-1c3a36fab1085cf8.rlib" "C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-2cc1781d1b9a07fd.rlib" "C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-9e99b6830b9b39fb.rlib" "C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-d4d285127ad54f3d.rlib" "kernel32.lib" "advapi32.lib" "bcrypt.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "kernel32.lib" "ws2_32.lib" "kernel32.lib" "ntdll.lib" "kernel32.lib" "msvcrt.lib" "/NXCOMPAT" "/LIBPATH:C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "/OUT:main.exe" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\8Observer8\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis"
  = note: libstd-af7a289140bfd09b.rlib(std-af7a289140bfd09b.std.9b8e320a6364d5d1-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_NtReadFile referenced in function _ZN3std3sys3pal7windows6handle6Handle16synchronous_read17hffc61af22a99a0e0E
          libstd-af7a289140bfd09b.rlib(std-af7a289140bfd09b.std.9b8e320a6364d5d1-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_NtWriteFile referenced in function _ZN3std3sys3pal7windows6handle6Handle17synchronous_write17h92e24a1e4a3615efE
          main.exe : fatal error LNK1120: 2 unresolved externals


error: aborting due to 1 previous error

I tried to use the installer too: https://github.com/ChrisDenton/minwinsdk/releases/download/0.0.1/minwinsdk.exe The "LIB" and another variable was added to the environment variables.

But when I installed these packages, the problem was disappeared:

image

License

Hi, this seems to be missing a license. Ideally, FLOSS compatible licensing terms would be great.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.