Skip to content

Commit 8485ec7

Browse files
jbachorikclaude
andcommitted
Fix LD_LIBRARY_PATH issue for unwindingReport tasks on musl
Apply the same LD_LIBRARY_PATH removal fix to runUnwindingValidator and unwindingReport tasks that was previously applied to test tasks. Without this fix, JDK 11 + musl systems fail with cross-JDK library conflicts when LD_LIBRARY_PATH causes the launcher to load the wrong libjli.so library. Removing LD_LIBRARY_PATH allows RPATH to work correctly and load the correct library from $ORIGIN/../lib/jli. Tasks fixed: - runUnwindingValidator{Config} (Exec tasks) - unwindingReport{Config} (Exec tasks) Resolves unwinding report failures on musl CI builds. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 7516783 commit 8485ec7

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

build-logic/conventions/src/main/kotlin/com/datadoghq/profiler/ProfilerTestPlugin.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,15 @@ class ProfilerTestPlugin : Plugin<Project> {
454454
runTask.environment(key, value)
455455
}
456456
}
457+
458+
// CRITICAL FIX: Remove LD_LIBRARY_PATH to let RPATH work correctly
459+
runTask.doFirst {
460+
val currentLdLibPath = (runTask.environment["LD_LIBRARY_PATH"] as? String) ?: System.getenv("LD_LIBRARY_PATH")
461+
if (!currentLdLibPath.isNullOrEmpty()) {
462+
project.logger.info("Removing LD_LIBRARY_PATH to prevent cross-JDK library conflicts (was: $currentLdLibPath)")
463+
runTask.environment.remove("LD_LIBRARY_PATH")
464+
}
465+
}
457466
}
458467

459468
// Create report task using Exec to bypass Gradle's toolchain system
@@ -492,6 +501,15 @@ class ProfilerTestPlugin : Plugin<Project> {
492501
}
493502
}
494503
reportTask.environment("CI", project.hasProperty("CI") || System.getenv("CI")?.toBoolean() ?: false)
504+
505+
// CRITICAL FIX: Remove LD_LIBRARY_PATH to let RPATH work correctly
506+
reportTask.doFirst {
507+
val currentLdLibPath = (reportTask.environment["LD_LIBRARY_PATH"] as? String) ?: System.getenv("LD_LIBRARY_PATH")
508+
if (!currentLdLibPath.isNullOrEmpty()) {
509+
project.logger.info("Removing LD_LIBRARY_PATH to prevent cross-JDK library conflicts (was: $currentLdLibPath)")
510+
reportTask.environment.remove("LD_LIBRARY_PATH")
511+
}
512+
}
495513
}
496514
}
497515
}

0 commit comments

Comments
 (0)