Skip to content

Commit eb747e5

Browse files
committed
Check that library/profiler_builtins actually found some source files
The current `build.rs` will automatically skip source files that don't exist. An unfortunate side-effect is that if _no_ files could be found (e.g. because the directory was wrong), the build fails with a mysterious linker error. We can reduce the awkwardness of this by explicitly checking that at least one source file was found.
1 parent 2168ce3 commit eb747e5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: profiler_builtins/build.rs

+4
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,16 @@ fn main() {
8484
let root = Path::new("../../src/llvm-project/compiler-rt");
8585

8686
let src_root = root.join("lib").join("profile");
87+
assert!(src_root.exists(), "profiler runtime source directory not found: {src_root:?}");
88+
let mut n_sources_found = 0u32;
8789
for src in profile_sources {
8890
let path = src_root.join(src);
8991
if path.exists() {
9092
cfg.file(path);
93+
n_sources_found += 1;
9194
}
9295
}
96+
assert!(n_sources_found > 0, "couldn't find any profiler runtime source files in {src_root:?}");
9397

9498
cfg.include(root.join("include"));
9599
cfg.warnings(false);

0 commit comments

Comments
 (0)