From b1c8c7973370caf638a4a278395616848c02b038 Mon Sep 17 00:00:00 2001 From: Akuli Date: Thu, 14 Mar 2019 20:48:33 +0200 Subject: [PATCH] Add /lib/x86_64-linux-gnu or similar to default system library search paths this makes compiling with libraries like zlib and ncurses easier --- std/build.zig | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/std/build.zig b/std/build.zig index 38be979da67b4b4afaed5122f34e45a9275508e1..558372b7884e54d92e5605df482882572c360fec 100644 --- a/std/build.zig +++ b/std/build.zig @@ -372,6 +372,10 @@ pub const Builder = struct { .abi = builtin.abi, }).linuxTriple(self.allocator); + // TODO: $ ld --verbose | grep SEARCH_DIR + // the output contains some paths that end with lib64, maybe include them too? + // also, what is the best possible order of things? + self.addNativeSystemIncludeDir("/usr/local/include"); self.addNativeSystemLibPath("/usr/local/lib"); @@ -380,6 +384,11 @@ pub const Builder = struct { self.addNativeSystemIncludeDir("/usr/include"); self.addNativeSystemLibPath("/usr/lib"); + + // example: on a 64-bit debian-based linux distro, with zlib installed from apt: + // zlib.h is in /usr/include (added above) + // libz.so.1 is in /lib/x86_64-linux-gnu (added here) + self.addNativeSystemLibPath(self.fmt("/lib/{}", triple)); }, } } -- 2.54.0