Skip to content

Build from source with autodiff fails on Mac OS #147985

@kevinyamauchi

Description

@kevinyamauchi

Summary

I am trying to build rustc with autodiff support using the instructions in the guide. The build is currently failing on my M2 Macbook. I would appreciate any guidance on how to get the build to complete. Thanks!

Command used

git clone git@github.com:rust-lang/rust
cd rust
./configure --release-channel=nightly --enable-llvm-enzyme --enable-llvm-assertions --enable-option-checking --disable-docs --set llvm.download-ci-llvm=true

RUST_BACKTRACE=1 ./x build -v --stage 1 library | tee build_output.txt

I noticed that the suggested configuration was updated recently (#147888), so I also tried the configuration below and obtained the same result.

./configure --enable-llvm-link-shared --enable-llvm-plugins --enable-llvm-enzyme --release-channel=nightly --enable-llvm-assertions --enable-clang --enable-lld --enable-option-checking --enable-ninja --disable-docs

Expected behaviour

The build completes without errors.

Actual behaviour

The build fails with a RuntimeError.

    Finished `release` profile [optimized] target(s) in 3.45s
using sysroot /Users/kyamauch/Documents/rust_source/rust/build/aarch64-apple-darwin/stage1
Dirty - /Users/kyamauch/Documents/rust_source/rust/build/aarch64-apple-darwin/stage1-std
running: DYLD_LIBRARY_PATH="/Users/kyamauch/Documents/rust_source/rust/build/aarch64-apple-darwin/stage1/lib" "/Users/kyamauch/Documents/rust_source/rust/build/aarch64-apple-darwin/stage1/bin/rustc" "--target" "aarch64-apple-darwin" "--print=deployment-target" (failure_mode=Exit) (created at src/bootstrap/src/core/builder/mod.rs:1614:23, executed at src/bootstrap/src/core/build_steps/compile.rs:538:26)
rustc -Cllvm-args="..." with: Unknown command line argument '-mergefunc-use-aliases'.  Try: 'rustc -Cllvm-args="..." with --help'
rustc -Cllvm-args="..." with: Did you mean '--riscv-no-aliases'?
rustc -Cllvm-args="..." with: Unknown command line argument '-preserve-alignment-assumptions-during-inlining=false'.  Try: 'rustc -Cllvm-args="..." with --help'
rustc -Cllvm-args="..." with: Did you mean '--mips-align-constant-islands=false'?
rustc -Cllvm-args="..." with: Unknown command line argument '-import-cold-multiplier=0.1'.  Try: 'rustc -Cllvm-args="..." with --help'
rustc -Cllvm-args="..." with: Did you mean '--ignore-xcoff-visibility=0.1'?
Command `DYLD_LIBRARY_PATH="/Users/kyamauch/Documents/rust_source/rust/build/aarch64-apple-darwin/stage1/lib" "/Users/kyamauch/Documents/rust_source/rust/build/aarch64-apple-darwin/stage1/bin/rustc" "--target" "aarch64-apple-darwin" "--print=deployment-target" (failure_mode=Exit)` failed with exit code 1
Created at: src/bootstrap/src/core/builder/mod.rs:1614:23
Executed at: src/bootstrap/src/core/build_steps/compile.rs:538:26

--- STDOUT vvv


Traceback (most recent call last):
  File "/Users/kyamauch/Documents/rust_source/rust/x.py", line 53, in <module>
    bootstrap.main()
  File "/Users/kyamauch/Documents/rust_source/rust/src/bootstrap/bootstrap.py", line 1410, in main
    bootstrap(args)
  File "/Users/kyamauch/Documents/rust_source/rust/src/bootstrap/bootstrap.py", line 1370, in bootstrap
    run(args, env=env, verbose=build.verbose, is_bootstrap=True)
  File "/Users/kyamauch/Documents/rust_source/rust/src/bootstrap/bootstrap.py", line 237, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /Users/kyamauch/Documents/rust_source/rust/build/bootstrap/debug/bootstrap build -v --stage 1 library

Bootstrap configuration (bootstrap.toml)

# Use different pre-set defaults than the global defaults.
#
# See `src/bootstrap/defaults` for more information.
# Note that this has no default value (x.py uses the defaults in `bootstrap.example.toml`).
profile = 'dist'

[llvm]

# Currently, we only support this when building LLVM for the build triple.
#
# Note that many of the LLVM options are not currently supported for
# downloading. Currently only the "assertions" option can be toggled.
download-ci-llvm = true

# Indicates whether the LLVM assertions are enabled or not
# NOTE: When assertions are disabled, bugs in the integration between rustc and LLVM can lead to
# unsoundness (segfaults, etc.) in the rustc process itself, not just in the generated code.
assertions = true

# Whether to build Enzyme as AutoDiff backend.
enzyme = true

[gcc]

[build]

# Whether to build documentation by default. If false, rustdoc and
# friends will still be compiled but they will not be used to generate any
# documentation.
#
# You can still build documentation when this is disabled by explicitly passing paths,
# e.g. `x doc library`.
docs = false

# Arguments passed to the `./configure` script, used during distcheck. You
# probably won't fill this in but rather it's filled in by the `./configure`
# script. Useful for debugging.
configure-args = ['--release-channel=nightly', '--enable-llvm-enzyme', '--enable-llvm-assertions', '--enable-option-checking', '--disable-docs', '--set', 'llvm.download-ci-llvm=true']

[install]

[rust]

# The "channel" for the Rust build to produce. The stable/beta channels only
# allow using stable features, whereas the nightly and dev channels allow using
# nightly features.
#
# You can set the channel to "auto-detect" to load the channel name from `src/ci/channel`.
#
# If using tarball sources, default value is "auto-detect", otherwise, it's "dev".
channel = 'nightly'

[dist]

[target.aarch64-apple-darwin]

Operating system

Mac OS 15.4.1 (M2 Macbook Pro).

HEAD

b2ee1b3

Additional context

Build Log

build_output.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-autodiff`#![feature(autodiff)]`O-macosOperating system: macOST-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