{"id":3204,"date":"2021-06-04T01:14:20","date_gmt":"2021-06-03T16:14:20","guid":{"rendered":"https:\/\/ecpplus.net\/weblog\/?p=3204"},"modified":"2021-06-23T10:00:18","modified_gmt":"2021-06-23T01:00:18","slug":"rust-cross-compile-on-ubuntu","status":"publish","type":"post","link":"https:\/\/ecpplus.net\/weblog\/rust-cross-compile-on-ubuntu\/","title":{"rendered":"Rust\u3067 Windows\u7528\u30d0\u30a4\u30ca\u30ea\u3092 Ubuntu \u4e0a\u3067\u30af\u30ed\u30b9\u30b3\u30f3\u30d1\u30a4\u30eb"},"content":{"rendered":"<p>Windows \u306e PowerShell \u4e0a\u3067\u52d5\u304b\u3059\u30c4\u30fc\u30eb\u3092 Rust \u3067\u4f5c\u3063\u3066 Windows \u7528\u306b\u30d3\u30eb\u30c9\u3057\u3088\u3046\u3068\u3057\u305f\u3002\u304c\u3001Windows\u4e0a\u306b\u30d3\u30eb\u30c9\u74b0\u5883\u3092\u4f5c\u308d\u3046\u3068\u3059\u308b\u306815GB\u304f\u3089\u3044\u30b9\u30c8\u30ec\u30fc\u30b8\u3092\u4f7f\u3046\u3088\u3046\u3060\u3063\u305f\u3002<\/p>\n<p>WSL\u306e Ubuntu \u4e0a\u306b\u74b0\u5883\u3092\u4f5c\u308b\u307b\u3046\u304c\u30c7\u30a3\u30b9\u30af\u5bb9\u91cf\u98df\u308f\u306a\u3044\u3088\u3046\u306a\u306e\u3067\u3001\u30af\u30ed\u30b9\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u3066\u307f\u305f\u3002<\/p>\n<h2>\u74b0\u5883<\/h2>\n<ul>\n<li>Windows 10<\/li>\n<li>Ubuntu 20.04 LTS<\/li>\n<\/ul>\n<h2>\u624b\u9806<\/h2>\n<h3>mingw-w64 \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p>Windows \u30d0\u30a4\u30ca\u30ea\u3092\u4f5c\u308b\u305f\u3081\u306b\u5fc5\u8981\u3002800MB\u7a0b\u5ea6\u306e\u5bb9\u91cf\u306e\u307f\u98df\u3046\u3088\u3046\u3060\u3002Windows \u4e0a\u306b\u6bd4\u3079\u308b\u3068\u5fc5\u8981\u5bb9\u91cf\u306f\u5c11\u306a\u3081\u306a\u306e\u3067\u3053\u3061\u3089\u3092\u9078\u629e\u3057\u305f\u3002<\/p>\n<pre><code class=\"language-sh\">sudo apt install mingw-w64<\/code><\/pre>\n<h3>Target \u3092\u8ffd\u52a0\u3059\u308b<\/h3>\n<p>Target \u3092\u8ffd\u52a0\u3059\u308b\u3002 <a target=\"_blank\" href=\"https:\/\/doc.rust-lang.org\/nightly\/rustc\/platform-support.html\\\" rel=\"noreferrer noopener\">Platform Support (doc.rust-lang.org)<\/a> \u306b target \u4e00\u89a7\u304c\u3042\u308b\u3002<\/p>\n<pre><code class=\"language-sh\">rustup target add x86_64-pc-windows-gnu<\/code><\/pre>\n<h3><code>~\/.cargo\/config<\/code> \u3092\u7de8\u96c6<\/h3>\n<pre><code class=\"language-toml\">[target.x86_64-pc-windows-gnu]\nlinker = &quot;\/usr\/bin\/x86_64-w64-mingw32-gcc&quot;<\/code><\/pre>\n<h3>\u30d3\u30eb\u30c9<\/h3>\n<pre><code class=\"language-sh\">cargo build --target x86_64-pc-windows-gnu<\/code><\/pre>\n<p><code>target\/x86_64-pc-windows-gnu\/debug\/<\/code> \u4ee5\u4e0b\u306b <code>.exe<\/code> \u30d5\u30a1\u30a4\u30eb\u304c\u3067\u304d\u3066\u3044\u308b\u306e\u3067\u3001Windows \u306b\u30b3\u30d4\u30fc\u3057\u3066\u4f7f\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Windows \u306e PowerShell \u4e0a\u3067\u52d5\u304b\u3059\u30c4\u30fc\u30eb\u3092 Rust \u3067\u4f5c\u3063\u3066 Windows \u7528\u306b\u30d3\u30eb\u30c9\u3057\u3088\u3046\u3068\u3057\u305f\u3002\u304c\u3001Windows\u4e0a\u306b\u30d3\u30eb\u30c9\u74b0\u5883\u3092\u4f5c\u308d\u3046\u3068\u3059\u308b\u306815GB\u304f\u3089\u3044\u30b9\u30c8\u30ec\u30fc\u30b8\u3092\u4f7f\u3046\u3088\u3046\u3060\u3063\u305f\u3002 WSL [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4156,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[7,64,13],"class_list":["post-3204","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development","tag-linux","tag-rust","tag-windows"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/posts\/3204","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/comments?post=3204"}],"version-history":[{"count":9,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/posts\/3204\/revisions"}],"predecessor-version":[{"id":4157,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/posts\/3204\/revisions\/4157"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/media\/4156"}],"wp:attachment":[{"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/media?parent=3204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/categories?post=3204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/tags?post=3204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}