Skip to content

Commit b68d329

Browse files
committed
Auto merge of #38601 - schulzch:master, r=brson
Partial fix for #38489. Fixes script name resolution for windows by invoking `emcc.bat` instead of `emcc`, etc. Remaining issue: ``` Traceback (most recent call last): File "C:\Program Files\Emscripten\emscripten\1.35.0\\emcc", line 1309, in <module> final = shared.Building.llvm_opt(final, link_opts, DEFAULT_FINAL) File "C:\Program Files\Emscripten\emscripten\1.35.0\tools\shared.py", line 1471, in llvm_opt assert os.path.exists(target), 'Failed to run llvm optimizations: ' + output AssertionError: Failed to run llvm optimizations: ```
2 parents 6dcf51a + 14994ac commit b68d329

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

src/librustc_back/target/asmjs_unknown_emscripten.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
// except according to those terms.
1010

1111
use super::{Target, TargetOptions};
12+
use super::emscripten_base::{cmd};
1213

1314
pub fn target() -> Result<Target, String> {
1415
let opts = TargetOptions {
15-
linker: "emcc".to_string(),
16-
ar: "emar".to_string(),
16+
linker: cmd("emcc"),
17+
ar: cmd("emar"),
1718

1819
dynamic_linking: false,
1920
executables: true,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub fn cmd(name: &str) -> String {
12+
if cfg!(windows) {
13+
format!("{}.bat", name)
14+
} else {
15+
name.to_string()
16+
}
17+
}

src/librustc_back/target/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ mod apple_ios_base;
5858
mod arm_base;
5959
mod bitrig_base;
6060
mod dragonfly_base;
61+
mod emscripten_base;
6162
mod freebsd_base;
6263
mod haiku_base;
6364
mod linux_base;

src/librustc_back/target/wasm32_unknown_emscripten.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
// except according to those terms.
1010

1111
use super::{Target, TargetOptions};
12+
use super::emscripten_base::{cmd};
1213

1314
pub fn target() -> Result<Target, String> {
1415
let opts = TargetOptions {
15-
linker: "emcc".to_string(),
16-
ar: "emar".to_string(),
16+
linker: cmd("emcc"),
17+
ar: cmd("emar"),
1718

1819
dynamic_linking: false,
1920
executables: true,

0 commit comments

Comments
 (0)