Skip to content

psm doesn't build with windows-msvc #55

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
mati865 opened this issue Aug 17, 2021 · 2 comments
Closed

psm doesn't build with windows-msvc #55

mati865 opened this issue Aug 17, 2021 · 2 comments

Comments

@mati865
Copy link
Member

mati865 commented Aug 17, 2021

Error from Rust's build error:

2021-08-03T04:49:01.0150077Z �[0m�[0m�[1m�[31merror�[0m�[1m:�[0m failed to run custom build command for `psm v0.1.14`
2021-08-03T04:49:01.0152144Z 
2021-08-03T04:49:01.0152722Z Caused by:
2021-08-03T04:49:01.0153890Z   process didn't exit successfully: `D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage0-rustc\release\build\psm-acef9b08e5c009b2\build-script-build` (exit code: 1)
2021-08-03T04:49:01.0154975Z   --- stdout
2021-08-03T04:49:01.0155534Z   OPT_LEVEL = Some("3")
2021-08-03T04:49:01.0156155Z   TARGET = Some("x86_64-pc-windows-msvc")
2021-08-03T04:49:01.0156840Z   HOST = Some("x86_64-pc-windows-msvc")
2021-08-03T04:49:01.0158421Z   CC_x86_64-pc-windows-msvc = None
2021-08-03T04:49:01.0159511Z   CC_x86_64_pc_windows_msvc = None
2021-08-03T04:49:01.0160219Z   HOST_CC = None
2021-08-03T04:49:01.0242469Z   CC = Some("D:/a/rust/rust/citools/clang-rust/bin/clang-cl.exe")
2021-08-03T04:49:01.0243229Z   CFLAGS_x86_64-pc-windows-msvc = None
2021-08-03T04:49:01.0279183Z   CFLAGS_x86_64_pc_windows_msvc = None
2021-08-03T04:49:01.0280041Z   HOST_CFLAGS = None
2021-08-03T04:49:01.0359038Z   CFLAGS = None
2021-08-03T04:49:01.0359690Z   CRATE_CC_NO_DEFAULTS = None
2021-08-03T04:49:01.0360448Z   CARGO_CFG_TARGET_FEATURE = Some("crt-static,fxsr,sse,sse2")
2021-08-03T04:49:01.0361117Z   DEBUG = Some("false")
2021-08-03T04:49:01.0361596Z   cargo:rustc-cfg=asm
2021-08-03T04:49:01.0363357Z   running: "clang" "-O3" "-ffunction-sections" "-fdata-sections" "--target=x86_64-pc-windows-msvc" "-Wall" "-Wextra" "-xassembler-with-cpp" "-DCFG_TARGET_OS_windows" "-DCFG_TARGET_ARCH_x86_64" "-DCFG_TARGET_ENV_msvc" "-o" "D:\\a\\rust\\rust\\build\\x86_64-pc-windows-msvc\\stage0-rustc\\x86_64-pc-windows-msvc\\release\\build\\psm-a238117c39c7b175\\out\\src/arch/x86_64_windows_gnu.o" "-c" "src/arch/x86_64_windows_gnu.s"
2021-08-03T04:49:01.0365776Z 
2021-08-03T04:49:01.0366688Z   --- stderr
2021-08-03T04:49:01.0367055Z 
2021-08-03T04:49:01.0368748Z 
2021-08-03T04:49:01.0369707Z   error occurred: Failed to find tool. Is `clang` installed? (see https://github.com/alexcrichton/cc-rs#compile-time-requirements for help)
2021-08-03T04:49:01.0371531Z 
2021-08-03T04:49:01.0371833Z 
2021-08-03T04:49:01.0372425Z �[0m�[0m�[1m�[33mwarning�[0m�[1m:�[0m build failed, waiting for other jobs to finish...

Probably caused by e1dc224

@nagisa
Copy link
Member

nagisa commented Aug 18, 2021

Hm. So

stacker/psm/build.rs

Lines 76 to 92 in 7b9a03f

// There seems to be a bug with clang-cl where using
// `/clang:-xassembler-with-cpp` is apparently accepted (ie no warnings
// about unused/unknown arguments), but results in the same exact error
// as if the flag was not present, so instead we take advantage of the
// fact that we're not actually compiling any C/C++ code, only assembling
// and can just use clang directly.
if cfg
.get_compiler()
.path()
.file_name()
.and_then(|f| f.to_str())
.map(|fname| fname.contains("clang-cl"))
.unwrap_or(false)
{
cfg.compiler("clang");
}
is the relevant section here.

Alas clang-cl does not appear to support MASM, so we can't just use the MSVC files, and the regular gnu ones require the preprocessor. Though I guess we can just inline the definitions for those particular files that are affected?

@nagisa
Copy link
Member

nagisa commented Aug 18, 2021

Should be fixed with psm 0.1.15

@nagisa nagisa closed this as completed Aug 18, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants