work around LLVM 10 llvm-config giving absolute path to libz.so

This commit is contained in:
Andrew Kelley 2020-02-04 15:04:11 -05:00
parent a9df637fb1
commit 73256dda91
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9

View File

@ -230,9 +230,15 @@ fn findLLVM(b: *Builder, llvm_config_exe: []const u8) !LibraryDep {
while (it.next()) |lib_arg| {
if (mem.startsWith(u8, lib_arg, "-l")) {
try result.system_libs.append(lib_arg[2..]);
} else if (fs.path.isAbsolute(lib_arg)) {
if (mem.endsWith(u8, lib_arg, "libz.so")) {
// llvm-config version 10 started giving an absolute path to zlib as
// a shared object, which fails to deal with rpaths correctly. Here
// we change it to a normal -lz
try result.system_libs.append("z");
} else {
if (fs.path.isAbsolute(lib_arg)) {
try result.libs.append(lib_arg);
}
} else {
if (mem.endsWith(u8, lib_arg, ".lib")) {
lib_arg = lib_arg[0 .. lib_arg.len - 4];
@ -241,7 +247,6 @@ fn findLLVM(b: *Builder, llvm_config_exe: []const u8) !LibraryDep {
}
}
}
}
{
var it = mem.tokenize(includes_output, " \r\n");
while (it.next()) |include_arg| {