Open tanriol opened 2 months ago
Indeed, and ever-so-helpfully I don't see a generalised way to pass -x
-equivalents in https://docs.rs/cc/latest/cc/struct.Build.html :v
Can you try making the line with .flag("-xc")
be .flag("-Xclang").flag("-xc")
instead? That would turn this into Tool::is_like_msvc()
.
I've been using rust-embed-resource via
tauri
for quite some time by cross-compiling the Windows version on Linux usingclang-cl
as compiler (cargoconfig.toml
snippet below).For some time the build used to succeed with a warning about
-xc
being unrecognized. Now (presumably after clang/llvm upgrade, although I'm not sure) the build fails with the following error:clang-cl: error: unsupported option '-x c'; did you mean '/TC' or '/TP'?
More context
``` The following warnings were emitted during compilation: warning: test-cross@0.0.0: clang-cl: error: unsupported option '-x c'; did you mean '/TC' or '/TP'? error: failed to run custom build command for `test-cross v0.0.0 (/tmp/test-cross/src-tauri)` Caused by: process didn't exit successfully: `/tmp/test-cross/src-tauri/target/debug/build/test-cross-35b858db60db2b87/build-script-build` (exit status: 1) --- stdout cargo:rerun-if-env-changed=TAURI_CONFIG cargo:rerun-if-changed=tauri.conf.json cargo:rustc-cfg=desktop cargo:rustc-env=TAURI_ANDROID_PACKAGE_PREFIX=com_tauri_dev cargo:rustc-cfg=dev cargo:PERMISSION_FILES_PATH=/tmp/test-cross/src-tauri/target/x86_64-pc-windows-msvc/debug/build/test-cross-18f49f7db6edd6fc/out/app-manifest/__app__-permission-files cargo:rerun-if-changed=capabilities cargo:rustc-env=TAURI_ENV_TARGET_TRIPLE=x86_64-pc-windows-msvc package.metadata does not exist cargo:warning=clang-cl: error: unsupported option '-x c'; did you mean '/TC' or '/TP'? --- stderr error occurred: Command "clang-cl" "-nologo" "-MD" "-Z7" "-Brepro" "-m64" "-I" "/tmp/test-cross/src-tauri/target/x86_64-pc-windows-msvc/debug/build/test-cross-18f49f7db6edd6fc/out" "-W4" "-xc" "-DRC_INVOKED" "-E" "--" "/tmp/test-cros s/src-tauri/target/x86_64-pc-windows-msvc/debug/build/test-cross-18f49f7db6edd6fc/out/resource.rc" with args clang-cl did not execute successfully (status code exit status: 1). warning: build failed, waiting for other jobs to finish... ```I've traced this to this
cc
invocation.