rust-lang / compiler-builtins

Porting `compiler-rt` intrinsics to Rust
https://github.com/rust-lang/rust/issues/35437
Other
372 stars 211 forks source link

Optimizing Compiler builtins causes build failure on VxWorks #679

Closed biabbas closed 2 months ago

biabbas commented 2 months ago

Enabling optimized-compiler-builtins for a build cause the build failure as seen in the attached build log. build_with_compiler_builtins_enabled.log

tgross35 commented 2 months ago

Some more discussion here https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Optimizing.20Compiler.20builtins.20causes.20build.20failure.20on.20VxWorks. Logs as copied there:

warning: [compiler_builtins@0.1.121](mailto:compiler_builtins@0.1.121): clang: error: unknown argument: '-nologo'
warning: [compiler_builtins@0.1.121](mailto:compiler_builtins@0.1.121): clang: error: unknown argument: '-nologo'
warning: [compiler_builtins@0.1.121](mailto:compiler_builtins@0.1.121): clang: error: no such file or directory: '-std=c11'; did you mean '-std=c11'?
warning: [compiler_builtins@0.1.121](mailto:compiler_builtins@0.1.121): clang: error: no such file or directory: '-x'
warning: [compiler_builtins@0.1.121](mailto:compiler_builtins@0.1.121): clang: error: no such file or directory: 'c'
warning: [compiler_builtins@0.1.121](mailto:compiler_builtins@0.1.121): clang: error: no such file or directory: '-I.'
warning: [compiler_builtins@0.1.121](mailto:compiler_builtins@0.1.121): clang: error: no such file or directory: '-I/ala-salim-lx12/bi/vxhvp9859/vsb_linux/vsb/usr/h/published/UTILS_UNIX'
warning: [compiler_builtins@0.1.121](mailto:compiler_builtins@0.1.121): clang: error: no such file or directory: '-I/ala-salim-lx12/bi/vxhvp9859/vsb_linux/vsb/share/h'
warning: [compiler_builtins@0.1.121](mailto:compiler_builtins@0.1.121): clang: error: no such file or directory: '-isystem/ala-salim-lx12/bi/vxhvp9859/vsb_linux/vsb/usr/h/public'
warning: [compiler_builtins@0.1.121](mailto:compiler_builtins@0.1.121): clang: error: no such file or directory: '-I/ala-salim-lx12/bi/vxhvp9859/vsb_linux/vsb/usr/3pp/develop/usr/include'
warning: [compiler_builtins@0.1.121](mailto:compiler_builtins@0.1.121): clang: error: no such file or directory: '-c'
warning: [compiler_builtins@0.1.121](mailto:compiler_builtins@0.1.121): clang: error: no such file or directory: '-o'
warning: [compiler_builtins@0.1.121](mailto:compiler_builtins@0.1.121): clang: error: no such file or directory: 'absvdi2.o'
 cargo::rustc-check-cfg=cfg(__ashldi3, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__ashlsi3, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__ashrdi3, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__ashrsi3, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__bswapsi2, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__bswapdi2, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__bswapti2, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__divdi3, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__divsi3, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__divmoddi4, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__divmodsi4, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__divmodsi4, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__divmodti4, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__lshrdi3, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__lshrsi3, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__moddi3, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__modsi3, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__muldi3, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__udivdi3, values("optimized-c"))
cargo::rustc-check-cfg=cfg(__udivmoddi4, values("optimized-c"))
..
..
CFLAGS_x86_64-wrs-vxworks = None
cargo:rerun-if-env-changed=CFLAGS_x86_64_wrs_vxworks
CFLAGS_x86_64_wrs_vxworks = Some("-nologo -MD -Brepro -m64")
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
cargo:rerun-if-env-changed=CFLAGS_x86_64-wrs-vxworks
CFLAGS_x86_64-wrs-vxworks = None
cargo:rerun-if-env-changed=CFLAGS_x86_64_wrs_vxworks
CFLAGS_x86_64_wrs_vxworks = Some("-nologo -MD -Brepro -m64")
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
cargo:rerun-if-env-changed=CFLAGS_x86_64-wrs-vxworks
CFLAGS_x86_64-wrs-vxworks = None
cargo:rerun-if-env-changed=CFLAGS_x86_64_wrs_vxworks
CFLAGS_x86_64_wrs_vxworks = Some("-nologo -MD -Brepro -m64")
cargo:warning=clang: error: unknown argument: '-nologo'
cargo:warning=clang: error: unknown argument: '-nologo'
cargo:warning=clang: error: no such file or directory: '-std=c11'; did you mean '-std=c11'?
cargo:warning=clang: error: no such file or directory: '-x'
cargo:warning=clang: error: no such file or directory: 'c'
cargo:warning=clang: error: no such file or directory: '-I.'
cargo:warning=clang: error: no such file or directory: '-I/ala-salim-lx12/bi/vxhvp9859/vsb_linux/vsb/usr/h/published/UTILS_UNIX'
cargo:warning=clang: error: no such file or directory: '-I/ala-salim-lx12/bi/vxhvp9859/vsb_linux/vsb/share/h'
cargo:warning=clang: error: no such file or directory: '-isystem/ala-salim-lx12/bi/vxhvp9859/vsb_linux/vsb/usr/h/public'
cargo:warning=clang: error: no such file or directory: '-I/ala-salim-lx12/bi/vxhvp9859/vsb_linux/vsb/usr/3pp/develop/usr/include'
cargo:warning=clang: error: no such file or directory: '-c'
cargo:warning=clang: error: no such file or directory: '-o'
cargo:warning=clang: error: no such file or directory: 'absvdi2.o'
--- stderr
error occurred: Command "wr-cc" "-nologo" "-MD" "-O2" "-Brepro" "-m64" "-nologo" "-MD" "-Brepro" "-m64" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DCOMPILER_RT_HAS_FLOAT16" "-DVISIBILITY_HIDDEN" "-Fo/ala-salim-lx12/bi/rust_18/build_86/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-wrs-vxworks/release/build/compiler_builtins-e92c00408ebf978e/out/c7963db79df6c4ac-absvdi2.o" "-c" "--" "/ala-salim-lx12/bi/rust_18/rust_src/src/llvm-project/compiler-rt/lib/builtins/absvdi2.c" with args wr-cc did not execute successfully (status code exit status: 1).
biabbas commented 2 months ago

Error seems to be at cc crate failing to detect wr-cc as a clang compiler. Thus -nologo and "--" args were added as if wr-cc was a msvc compiler. Will fix it and continue this at cc crate.

tgross35 commented 2 months ago

Glad you found the issue, thanks for following up.