)]}'
{
  "commit": "bef8e620f19adbfd1530e916ab8caa296ef9c3ee",
  "tree": "54784206000cbb37a0a12f10978b2caeb72a806e",
  "parents": [
    "14210df0e27ccd7d9e6a05b8085cbd438e4bbc65",
    "3af88c5a8f9f3729e9f335da637c09af9a188a03"
  ],
  "author": {
    "name": "bors",
    "email": "bors@rust-lang.org",
    "time": "Sun May 31 23:36:28 2026 +0000"
  },
  "committer": {
    "name": "bors",
    "email": "bors@rust-lang.org",
    "time": "Sun May 31 23:36:28 2026 +0000"
  },
  "message": "Auto merge of #157205 - sgasho:link_llvm_dynamically_on_mac, r\u003dZuseZ4\n\nLink LLVM dynamically on aarch64-apple-darwin\n\n--set llvm.link-shared\u003dtrue on dist-aarch64-apple to link LLVM dynamically on MacOS. \r\nAlso, I fixed some link problems, by normalizing the libLLVM.dylib name, and creating a symlink(On Linux, we use linker script, but we can not use it for MacOS. ld64 does not recognize linker scripts) from versioned dylib to unversioned libLLVM.dylib to build successfully.\r\n\r\n## How I verified on my Mac\r\n\r\n1. remove the old build dir\r\n\r\n```shell\r\nrm -rf build/\r\n```\r\n\r\n2. configure for rust-dev dist\r\n\r\n```shell\r\n./configure \\\r\n    --set llvm.download-ci-llvm\u003dfalse \\\r\n    --set llvm.link-shared\u003dtrue \\\r\n    --release-channel\u003dnightly\r\n```\r\n\r\n3. dist\r\n\r\n```shell\r\n./x dist rust-dev --host\u003daarch64-apple-darwin --target\u003daarch64-apple-darwin\r\n```\r\n\r\n4. move tarball to /tmp(or, wherever else except for inside build/) and delete the current build dir\r\n\r\nWe create build/ for both rust-dev dist, and local build tests. Once dist finished, we have to clear the directory so we can use it for build tests\r\n\r\n```shell\r\ncp build/dist/rust-dev-nightly-aarch64-apple-darwin.tar.xz /tmp/\r\n\r\nrm -rf build\r\n```\r\n\r\nI saw a symlink created as expected\r\n\r\n\u003cimg width\u003d\"652\" height\u003d\"406\" alt\u003d\"rust-dev artifacts\" src\u003d\"https://github.com/user-attachments/assets/dc49a637-8a1f-45c8-84f2-2ef101faae51\" /\u003e\r\n\r\n\r\n6. modify download.rs temporary so it gets the locally built tarball at step3\r\n\r\n```rust\r\n    #[cfg(not(test))]\r\n    fn download_ci_llvm(\u0026self, _llvm_sha: \u0026str) {\r\n        let tarball \u003d PathBuf::from(\"/tmp/rust-dev-nightly-aarch64-apple-darwin.tar.xz\");\r\n        let llvm_root \u003d self.ci_llvm_root();\r\n        self.unpack(\u0026tarball, \u0026llvm_root, \"rust-dev\");\r\n    //     let llvm_assertions \u003d self.llvm_assertions;\r\n\r\n    //     let cache_prefix \u003d format!(\"llvm-{llvm_sha}-{llvm_assertions}\");\r\n    //     let cache_dst \u003d\r\n    //         self.bootstrap_cache_path.as_ref().cloned().unwrap_or_else(|| self.out.join(\"cache\"));\r\n\r\n    //     let rustc_cache \u003d cache_dst.join(cache_prefix);\r\n    //     if !rustc_cache.exists() {\r\n    //         t!(fs::create_dir_all(\u0026rustc_cache));\r\n    //     }\r\n    //     let base \u003d if llvm_assertions {\r\n    //         \u0026self.stage0_metadata.config.artifacts_with_llvm_assertions_server\r\n    //     } else {\r\n    //         \u0026self.stage0_metadata.config.artifacts_server\r\n    //     };\r\n    //     let version \u003d self.artifact_version_part(llvm_sha);\r\n    //     let filename \u003d format!(\"rust-dev-{}-{}.tar.xz\", version, self.host_target.triple);\r\n    //     let tarball \u003d rustc_cache.join(\u0026filename);\r\n    //     if !tarball.exists() {\r\n    //         let help_on_error \u003d \"ERROR: failed to download llvm from ci\r\n\r\n    // HELP: There could be two reasons behind this:\r\n    //     1) The host triple is not supported for `download-ci-llvm`.\r\n    //     2) Old builds get deleted after a certain time.\r\n    // HELP: In either case, disable `download-ci-llvm` in your bootstrap.toml:\r\n\r\n    // [llvm]\r\n    // download-ci-llvm \u003d false\r\n    // \";\r\n    //         self.download_file(\u0026format!(\"{base}/{llvm_sha}/{filename}\"), \u0026tarball, help_on_error);\r\n    //     }\r\n    //     let llvm_root \u003d self.ci_llvm_root();\r\n    //     self.unpack(\u0026tarball, \u0026llvm_root, \"rust-dev\");\r\n    }\r\n```\r\n\r\n7. configure for ./x build\r\n\r\n```shell\r\nrm -rf bootstrap.toml // delete existing config of rust-dev dist\r\n\r\n// maybe we don\u0027t need to specify llvm.download-ci-llvm\u003dtrue, since I bumped download-ci-llvm-stamp.\r\n// but anyway, I explicitly specified it when I tested it\r\n\r\n./configure \\\r\n    --set llvm.download-ci-llvm\u003dtrue \\\r\n    --set llvm.link-shared\u003dtrue \\\r\n    --release-channel\u003dnightly\r\n```\r\n\r\n8. ./x build\r\n\r\n```shell\r\n./x build (library)\r\n```\r\n\r\nResult: build completed successfully\r\n\r\n\u003cimg width\u003d\"861\" height\u003d\"763\" alt\u003d\"スクリーンショット 2026-06-01 0 38 21\" src\u003d\"https://github.com/user-attachments/assets/9660ac43-c275-4174-b80a-3483b4acfd40\" /\u003e\r\n\r\nr? @Kobzol \r\n\r\ncc: @ZuseZ4 \r\n",
  "tree_diff": []
}
