1diff --git a/build_llvm.py b/build_llvm.py
2index aee0a9f1..6b9806c9 100644
3--- a/build_llvm.py
4+++ b/build_llvm.py
5@@ -350,25 +350,19 @@ def build_warp_clang_for_arch(args, lib_name: str, arch: str) -> None:
6
7 clang_dll_path = os.path.join(build_path, f"bin/{lib_name}")
8
9- if args.build_llvm:
10- # obtain Clang and LLVM libraries from the local build
11- install_path = os.path.join(llvm_install_path, f"{args.mode}-{arch}")
12- libpath = os.path.join(install_path, "lib")
13- else:
14- # obtain Clang and LLVM libraries from packman
15- fetch_prebuilt_libraries(arch)
16- libpath = os.path.join(base_path, f"_build/host-deps/llvm-project/release-{arch}/lib")
17-
18+ # obtain Clang and LLVM libraries from the local build
19 libs = []
20-
21- for _, _, libraries in os.walk(libpath):
22- libs.extend(libraries)
23- break # just the top level contains library files
24+ install_paths = ["@LLVM_LIB@", "@LIBCLANG_LIB@"]
25+ libpaths = [os.path.join(install_path, "lib") for install_path in install_paths]
26+ for libpath in libpaths:
27+ for _, _, libraries in os.walk(libpath):
28+ libs.extend(libraries)
29+ break # just the top level contains library files
30
31 if os.name == "nt":
32 libs.append("Version.lib")
33 libs.append("Ws2_32.lib")
34- libs.append(f'/LIBPATH:"{libpath}"')
35+ libs.extend(f'/LIBPATH:"{libpath}"' for libpath in libpaths)
36 else:
37 libs = [f"-l{lib[3:-2]}" for lib in libs if os.path.splitext(lib)[1] == ".a"]
38 if sys.platform == "darwin":
39@@ -376,7 +370,8 @@ def build_warp_clang_for_arch(args, lib_name: str, arch: str) -> None:
40 else:
41 libs.insert(0, "-Wl,--start-group")
42 libs.append("-Wl,--end-group")
43- libs.append(f"-L{libpath}")
44+ libs.extend(f"-L{libpath}" for libpath in libpaths)
45+ libs.append("-lz")
46 libs.append("-lpthread")
47 libs.append("-ldl")
48 if sys.platform != "darwin":
49diff --git a/warp/build_dll.py b/warp/build_dll.py
50index 2218ff13..3fcf5796 100644
51--- a/warp/build_dll.py
52+++ b/warp/build_dll.py
53@@ -404,8 +404,8 @@ def build_dll_for_arch(args, dll_path, cpp_paths, cu_path, arch, libs: Optional[
54 cuda_compiler = "clang++" if getattr(args, "clang_build_toolchain", False) else "nvcc"
55 cpp_compiler = "clang++" if getattr(args, "clang_build_toolchain", False) else "g++"
56
57- cpp_includes = f' -I"{warp_home_path.parent}/external/llvm-project/out/install/{mode}-{arch}/include"'
58- cpp_includes += f' -I"{warp_home_path.parent}/_build/host-deps/llvm-project/release-{arch}/include"'
59+ cpp_includes = ' -I"@LLVM_DEV@/include"'
60+ cpp_includes += ' -I"@LIBCLANG_DEV@/include"'
61 cuda_includes = f' -I"{cuda_home}/include"' if cu_path else ""
62 includes = cpp_includes + cuda_includes