Skip to content

Commit f817d70

Browse files
committed
Auto merge of #152085 - ZuseZ4:mingw-enzyme, r=<try>
cp pr 151795 and enable enzyme try-job: dist-aarch64-llvm-mingw
2 parents 8bccf12 + 1d1eef1 commit f817d70

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use crate::utils::build_stamp::{self, BuildStamp};
3535
use crate::utils::channel::{self, Info};
3636
use crate::utils::exec::{BootstrapCommand, command};
3737
use crate::utils::helpers::{
38-
exe, is_dylib, move_file, t, target_supports_cranelift_backend, timeit,
38+
exe, is_dylib, libdir, move_file, t, target_supports_cranelift_backend, timeit,
3939
};
4040
use crate::utils::tarball::{GeneratedTarball, OverlayKind, Tarball};
4141
use crate::{CodegenBackendKind, Compiler, DependencyType, FileType, LLVM_TOOLS, Mode, trace};
@@ -2533,7 +2533,7 @@ fn maybe_install_llvm(
25332533
),
25342534
)]
25352535
pub fn maybe_install_llvm_target(builder: &Builder<'_>, target: TargetSelection, sysroot: &Path) {
2536-
let dst_libdir = sysroot.join("lib/rustlib").join(target).join("lib");
2536+
let dst_libdir = sysroot.join("lib/rustlib").join(target).join(libdir(target));
25372537
// We do not need to copy LLVM files into the sysroot if it is not
25382538
// dynamically linked; it is already included into librustc_llvm
25392539
// statically.
@@ -2558,11 +2558,12 @@ pub fn maybe_install_llvm_target(builder: &Builder<'_>, target: TargetSelection,
25582558
)]
25592559
pub fn maybe_install_llvm_runtime(builder: &Builder<'_>, target: TargetSelection, sysroot: &Path) {
25602560
let dst_libdir = sysroot.join(builder.sysroot_libdir_relative(Compiler::new(1, target)));
2561+
let dst_runtime_libdir = dst_libdir.parent().unwrap().join(libdir(target));
25612562
// We do not need to copy LLVM files into the sysroot if it is not
25622563
// dynamically linked; it is already included into librustc_llvm
25632564
// statically.
25642565
if builder.llvm_link_shared() {
2565-
maybe_install_llvm(builder, target, &dst_libdir, false);
2566+
maybe_install_llvm(builder, target, &dst_runtime_libdir, false);
25662567
}
25672568
}
25682569

src/bootstrap/src/core/build_steps/llvm.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ impl Step for Enzyme {
11401140
let llvm_version_major = llvm::get_llvm_version_major(builder, &host_llvm_config);
11411141
let lib_ext = std::env::consts::DLL_EXTENSION;
11421142
let libenzyme = format!("libEnzyme-{llvm_version_major}");
1143-
let build_dir = out_dir.join("lib");
1143+
let build_dir = out_dir.join("bin");
11441144
let dylib = build_dir.join(&libenzyme).with_extension(lib_ext);
11451145

11461146
trace!("checking build stamp to see if we need to rebuild enzyme artifacts");
@@ -1203,6 +1203,7 @@ impl Step for Enzyme {
12031203
// At this point, `out_dir` should contain the built libEnzyme-<LLVM-version>.<dylib-ext>
12041204
// file.
12051205
if !dylib.exists() {
1206+
eprintln!("{} does not exist", dylib.display());
12061207
eprintln!(
12071208
"`{libenzyme}` not found in `{}`. Either the build has failed or Enzyme was built with a wrong version of LLVM",
12081209
build_dir.display()

src/ci/github-actions/jobs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,8 @@ auto:
691691
--target=aarch64-pc-windows-gnullvm,i686-pc-windows-gnullvm
692692
--enable-full-tools
693693
--enable-profiler
694+
--enable-llvm-link-shared
695+
--enable-llvm-enzyme
694696
DIST_REQUIRE_ALL_TOOLS: 1
695697
CODEGEN_BACKENDS: llvm,cranelift
696698
CC_i686_pc_windows_gnullvm: i686-w64-mingw32-clang
@@ -703,6 +705,8 @@ auto:
703705
--build=x86_64-pc-windows-gnullvm
704706
--enable-full-tools
705707
--enable-profiler
708+
--enable-llvm-link-shared
709+
--enable-llvm-enzyme
706710
DIST_REQUIRE_ALL_TOOLS: 1
707711
CODEGEN_BACKENDS: llvm,cranelift
708712
<<: *job-windows

0 commit comments

Comments
 (0)