{"id":268,"date":"2025-04-21T18:40:34","date_gmt":"2025-04-21T15:10:34","guid":{"rendered":"https:\/\/downloaddevtools.com\/blog\/?p=268"},"modified":"2025-04-21T18:40:37","modified_gmt":"2025-04-21T15:10:37","slug":"how-to-install-and-run-the-rust-compiler-on-windows","status":"publish","type":"post","link":"https:\/\/downloaddevtools.com\/blog\/how-to-install-and-run-the-rust-compiler-on-windows\/","title":{"rendered":"How to Install and Run the Rust Compiler on Windows 10 and 11 (Step-by-Step Guide)"},"content":{"rendered":"\n<p>In this paper we describe how to install and run Rust compilers in Windows 10 and 11 using <strong>ABI GNU<\/strong> instead of MSVC, which is the default installer. This guide helps you set up the Rust development area on Windows and compile your program using the Rust language.\u00a0<\/p>\n\n\n\n\n\n<p>Nowadays, Rust programming languages have become so popular, and many programmers try to learn and master this newborn language. Also, companies search for people who are masters at Rust. If you are one of the people trying to learn this skill, we offer you a <a href=\"https:\/\/skillwells.com\/shop\/mastering-rust\/\" target=\"_blank\" rel=\"noopener\"><strong>Master The Rust Programming Language : Beginner To Advanced course<\/strong><\/a>. By using this course you can take advantage of related job opportunities.\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"507\" src=\"https:\/\/downloaddevtools.com\/blog\/wp-content\/uploads\/2025\/04\/Rust-Programming-Language-min-1024x507.png\" alt=\"Rust Programming Language\" class=\"wp-image-270\" srcset=\"https:\/\/downloaddevtools.com\/blog\/wp-content\/uploads\/2025\/04\/Rust-Programming-Language-min-1024x507.png 1024w, https:\/\/downloaddevtools.com\/blog\/wp-content\/uploads\/2025\/04\/Rust-Programming-Language-min-300x149.png 300w, https:\/\/downloaddevtools.com\/blog\/wp-content\/uploads\/2025\/04\/Rust-Programming-Language-min-768x380.png 768w, https:\/\/downloaddevtools.com\/blog\/wp-content\/uploads\/2025\/04\/Rust-Programming-Language-min.png 1260w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Install Rust with <strong>rustup<\/strong> tool<\/h2>\n\n\n\n<p><strong>rustup<\/strong> tool is manager of the Rust version, which easily installs and keeps toolchains in Rust. To install <strong>rustup<\/strong>, follow the steps:\u00a0<\/p>\n\n\n\n<p>Go to the <a href=\"https:\/\/www.rust-lang.org\/tools\/install\" target=\"_blank\" rel=\"noopener\">Rust installing official page<\/a> or use the code below in PowerShell or CMD environments:\u00a0<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ncurl --proto &#039;=https&#039; --tlsv1.2 -sSf https:\/\/sh.rustup.rs | sh\n<\/pre><\/div>\n\n\n<p>This code launches the installation process and helps you pass the initial steps of installing. After finishing, make sure rustup is installed successfully. You can check it by running this code:&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nrustup --version\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">Installing Toolchain related to ABI GNU<\/h2>\n\n\n\n<p>By default, Rust uses the MSVC version, so to change to the GNU version, follow these steps:&nbsp;<\/p>\n\n\n\n<p>Install Toolchain GNU:&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nrustup toolchain install stable-x86_64-pc-windows-gnu\n<\/pre><\/div>\n\n\n<p>Set the default version to GNU:&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nrustup default stable-x86_64-pc-windows-gnu\n<\/pre><\/div>\n\n\n<p>Add GNU target to Toolchian:&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nrustup target add x86_64-pc-windows-gnu\n<\/pre><\/div>\n\n\n<p>These commands ensure you use GNU-related settings when compiling programs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing necessary tools for linker<\/h2>\n\n\n\n<p>When using ABI GNU, you need a linker of GNU package tools such as mingw-w64. To do so, the best choice is to use the <strong>MSYS2 <\/strong>environment.<\/p>\n\n\n\n<p><strong>Download and install MSYS2:<\/strong><\/p>\n\n\n\n<p>Visit the <a href=\"https:\/\/www.msys2.org\/\" target=\"_blank\" rel=\"noopener\">msys2.org<\/a> website, then download and install your window appropriate version.<\/p>\n\n\n\n<p><strong>Update MSYS2:<\/strong><\/p>\n\n\n\n<p>After installing, run MSYS and enter the commands below to update MSYS2 packages:&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\npacman -Syu\n<\/pre><\/div>\n\n\n<p>If you need, close the terminal and reopen it and repeat the update command.<\/p>\n\n\n\n<p><strong>Installing the GNU (mingw-w64) compiler:\u00a0<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\npacman -S mingw-w64-x86_64-gcc\n<\/pre><\/div>\n\n\n<p>After installing, with the below command, check if the correct version of gcc is available:&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ngcc --version\n<\/pre><\/div>\n\n\n<p>These steps provide a necessary environment to link Rust programs with ABI GNU.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Compile Rust programs with ABI GNU<\/h2>\n\n\n\n<p>Now that Rust environments with related tools are ready, you can compile Rust programs with ABI GNU easily. There are two common ways to do so:&nbsp;<\/p>\n\n\n\n<p><strong>First: using rustc<\/strong><\/p>\n\n\n\n<p>Suppose your program file with the name rust_hello.rs exists. On this command line, compile your program directly:&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nrustc --target=x86_64-pc-windows-gnu rust_hello.rs\n<\/pre><\/div>\n\n\n<p>The above command generates an executable file that uses GNU settings.&nbsp;<\/p>\n\n\n\n<p><strong>Second: use of Cargo (Rust package tool manager)<\/strong><\/p>\n\n\n\n<p>Cargo is the default tool for managing Rust projects that makes dependencies and creating processes easy. In the project directory, by having a Cargo.toml file, you can run the below command:&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ncargo build --target=x86_64-pc-windows-gnu\n<\/pre><\/div>\n\n\n<p>This method is recommended because it makes dependency management and project making easy.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Supplementary tips<\/h2>\n\n\n\n<p><strong>Fix linking errors<\/strong>:<\/p>\n\n\n\n<p>If you face errors such as link.exe not found, remember this error is related to the MSVC environment. By using the toolchain GNU and installing mingw-w64 correctly, this problem will be fixed.&nbsp;<\/p>\n\n\n\n<p><strong>Checking Rust installation:&nbsp;<\/strong><\/p>\n\n\n\n<p>Running the command below helps you make sure Rust has been installed correctly:&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nrustc --version cargo --version\n<\/pre><\/div>\n\n\n<p><strong>\u201cCan&#8217;t find crate for std\u201d error:&nbsp;<\/strong><\/p>\n\n\n\n<p>If you face such an error, make sure the GNU target is installed and has been added correctly:&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nrustup target add x86_64-pc-windows-gnu\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"474\" src=\"https:\/\/downloaddevtools.com\/blog\/wp-content\/uploads\/2025\/04\/How-Rust-Compiler-Works-min-1024x474.png\" alt=\"How Rust Compiler Works\" class=\"wp-image-271\" srcset=\"https:\/\/downloaddevtools.com\/blog\/wp-content\/uploads\/2025\/04\/How-Rust-Compiler-Works-min-1024x474.png 1024w, https:\/\/downloaddevtools.com\/blog\/wp-content\/uploads\/2025\/04\/How-Rust-Compiler-Works-min-300x139.png 300w, https:\/\/downloaddevtools.com\/blog\/wp-content\/uploads\/2025\/04\/How-Rust-Compiler-Works-min-768x355.png 768w, https:\/\/downloaddevtools.com\/blog\/wp-content\/uploads\/2025\/04\/How-Rust-Compiler-Works-min-1536x711.png 1536w, https:\/\/downloaddevtools.com\/blog\/wp-content\/uploads\/2025\/04\/How-Rust-Compiler-Works-min-2048x948.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>By following the instructions in this paper, the Rust development environment will be set completely to use ABI GNU. This method is especially appropriate for developers who use assigned GNU tools such as mingw-w64 and can prevent some MSVC-related problems. Now you are ready to compile your programs and enjoy Rust&#8217;s advanced facilities.&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this paper we describe how to install and run Rust compilers in Windows 10 and 11 using ABI GNU [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":272,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[7],"tags":[16],"class_list":["post-268","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-educational","tag-rust"],"_links":{"self":[{"href":"https:\/\/downloaddevtools.com\/blog\/wp-json\/wp\/v2\/posts\/268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/downloaddevtools.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/downloaddevtools.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/downloaddevtools.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/downloaddevtools.com\/blog\/wp-json\/wp\/v2\/comments?post=268"}],"version-history":[{"count":11,"href":"https:\/\/downloaddevtools.com\/blog\/wp-json\/wp\/v2\/posts\/268\/revisions"}],"predecessor-version":[{"id":282,"href":"https:\/\/downloaddevtools.com\/blog\/wp-json\/wp\/v2\/posts\/268\/revisions\/282"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/downloaddevtools.com\/blog\/wp-json\/wp\/v2\/media\/272"}],"wp:attachment":[{"href":"https:\/\/downloaddevtools.com\/blog\/wp-json\/wp\/v2\/media?parent=268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/downloaddevtools.com\/blog\/wp-json\/wp\/v2\/categories?post=268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/downloaddevtools.com\/blog\/wp-json\/wp\/v2\/tags?post=268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}