Skip to content

LLVM build failures on Windows/Mac #135782

Closed
@Hoverbear

Description

@Hoverbear

Summary

On Windows and Mac, x.py build src/llvm-project can fail when download-ci-llvm = false is set in the config.toml.

Command used

Clone the rust repo, then copy the config.example.toml to config.toml and set the following:

[llvm]
download-ci-llvm = false

Then run:

x.py build src/llvm-project

Expected behaviour

A successful build, exiting 0.

Actual behaviour

On Mac, the result is:

-- Installing: /Users/ana/git/ferrocene/ferrocene/build/aarch64-apple-darwin/lld/lib/cmake/lld/LLDConfigVersion.cmake
cargo:root=/Users/ana/git/ferrocene/ferrocene/build/aarch64-apple-darwin/lld
        finished in 31.764 seconds
Building crtbegin.o and crtend.o for aarch64-apple-darwin
cargo:warning=/Users/ana/git/ferrocene/ferrocene/src/llvm-project/compiler-rt/lib/builtins/crtbegin.c:15:28: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment and section separated by a comma
cargo:warning=   15 |     __attribute__((section(".eh_frame"), aligned(sizeof(void *)))) = {};
cargo:warning=      |                            ^
cargo:warning=/Users/ana/git/ferrocene/ferrocene/src/llvm-project/compiler-rt/lib/builtins/crtbegin.c:49:24: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment and section separated by a comma
cargo:warning=   49 | __attribute__((section(".init_array"),
cargo:warning=      |                        ^
cargo:warning=/Users/ana/git/ferrocene/ferrocene/src/llvm-project/compiler-rt/lib/builtins/crtbegin.c:106:24: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment and section separated by a comma
cargo:warning=  106 | __attribute__((section(".fini_array"),
cargo:warning=      |                        ^
cargo:warning=3 errors generated.


error occurred: Command env -u IPHONEOS_DEPLOYMENT_TARGET "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=arm64-apple-macosx15.2" "-std=c11" "-DCRT_HAS_INITFINI_ARRAY" "-DEH_USE_FRAME_REGISTRY" "-o" "/Users/ana/git/ferrocene/ferrocene/build/aarch64-apple-darwin/native/crt/df7af2d07715af86-crtbegin.o" "-c" "/Users/ana/git/ferrocene/ferrocene/src/llvm-project/compiler-rt/lib/builtins/crtbegin.c" with args cc did not execute successfully (status code exit status: 1).

On Windows, the result is:

-- Installing: D:/git/ferrocene/ferrocene/build/x86_64-pc-windows-msvc/llvm/include/llvm/Config/llvm-config.h
-- Installing: D:/git/ferrocene/ferrocene/build/x86_64-pc-windows-msvc/llvm/include/llvm/Support/VCSRevision.h
-- Installing: D:/git/ferrocene/ferrocene/build/x86_64-pc-windows-msvc/llvm/lib/cmake/llvm/LLVMConfigExtensions.cmake

cargo:root=D:\git\ferrocene\ferrocene\build\x86_64-pc-windows-msvc\llvm
        finished in 1242.431 seconds
Building crtbegin.o and crtend.o for x86_64-pc-windows-msvc



cargo:warning=cl : Command line warning D9002 : ignoring unknown option '-std=c11'
crtbegin.c
D:\git\ferrocene\ferrocene\src/llvm-project/compiler-rt/lib/builtins/crtbegin.c(9): fatal error C1034: stddef.h: no include path set


error occurred: Command "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.40.33807\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-O2" "-Brepro" "-std=c11" "-DCRT_HAS_INITFINI_ARRAY" "-DEH_USE_FRAME_REGISTRY" "-FoD:\\git\\ferrocene\\ferrocene\\build\\x86_64-pc-windows-msvc\\native\\crt\\89a91fa0b39682bb-crtbegin.o" "-c" "D:\\git\\ferrocene\\ferrocene\\src/llvm-project/compiler-rt/lib/builtins/crtbegin.c" with args cl.exe did not execute successfully (status code exit code: 2).


Build completed unsuccessfully in 0:39:09

Bootstrap configuration (config.toml)

The same as the config.example.toml but:

[llvm]
download-ci-llvm = false

Operating system

This is happening on, as far as I know, all Windows and Mac targets. I tested on Mac 15.2 and Windows 11 24H2.

HEAD

bcd0683 and 6a64e3b both display the issue

Additional context

After discussing with @japaric, I believe that these steps (building crtbegin.o and crtend.o) are unnecessary, bootstrap seems to claim that these steps are for cross compiling to MUSL.

We believe the issue happened sometime between #134839 (where the problem is not present) and #134987 (where the problem is now present)

(Build logs excluded as they are longer than the Github Issues limit)

windows-log.txt

mac-log.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcE-needs-investigationCall for partcipation: This issues needs some investigation to determine current statusO-macosOperating system: macOSO-windowsOperating system: WindowsT-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions