authorgravatar for akuviljanen17@gmail.comAkuli <akuviljanen17@gmail.com> 2019-03-14 20:48:33+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-03-14 14:51:24-04:00
logb1c8c7973370caf638a4a278395616848c02b038
tree0149cbcfb39273272ac5975afe41956a0f4ba760
parent080dd27157e79adc8e5d5b7c1dcf94919624abab

Add /lib/x86_64-linux-gnu or similar to default system library search paths

this makes compiling with libraries like zlib and ncurses easier

1 files changed, 9 insertions(+), 0 deletions(-)

std/build.zig+9
...@@ -372,6 +372,10 @@ pub const Builder = struct {...@@ -372,6 +372,10 @@ pub const Builder = struct {
372 .abi = builtin.abi,372 .abi = builtin.abi,
373 }).linuxTriple(self.allocator);373 }).linuxTriple(self.allocator);
374374
375 // TODO: $ ld --verbose | grep SEARCH_DIR
376 // the output contains some paths that end with lib64, maybe include them too?
377 // also, what is the best possible order of things?
378
375 self.addNativeSystemIncludeDir("/usr/local/include");379 self.addNativeSystemIncludeDir("/usr/local/include");
376 self.addNativeSystemLibPath("/usr/local/lib");380 self.addNativeSystemLibPath("/usr/local/lib");
377381
...@@ -380,6 +384,11 @@ pub const Builder = struct {...@@ -380,6 +384,11 @@ pub const Builder = struct {
380384
381 self.addNativeSystemIncludeDir("/usr/include");385 self.addNativeSystemIncludeDir("/usr/include");
382 self.addNativeSystemLibPath("/usr/lib");386 self.addNativeSystemLibPath("/usr/lib");
387
388 // example: on a 64-bit debian-based linux distro, with zlib installed from apt:
389 // zlib.h is in /usr/include (added above)
390 // libz.so.1 is in /lib/x86_64-linux-gnu (added here)
391 self.addNativeSystemLibPath(self.fmt("/lib/{}", triple));
383 },392 },
384 }393 }
385 }394 }