From 74d42005e25e4a3c8356d44010b82a206b8aa7e6 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 10 Apr 2023 11:18:10 +0200 Subject: Fix inconsistent /usr/local/{include,lib} search In particular, we were adding -L/usr/local/lib which means it is considered before built-in directories (/usr/lib, etc) but in our own library search code we were considering it after (because we were storing it at the end of sys_lib_dirs). Now in both sys_{hdr,lib}_dirs we store /usr/local/{include,lib} after mode and before built-in directories. Note that as part of this fix we now pass -isystem /usr/local/include instead of -idirafter (which is consistent with the -L behavior and also the customarily expected semantics). --- libbuild2/cc/common.hxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'libbuild2/cc/common.hxx') diff --git a/libbuild2/cc/common.hxx b/libbuild2/cc/common.hxx index c17db08..9090c9c 100644 --- a/libbuild2/cc/common.hxx +++ b/libbuild2/cc/common.hxx @@ -198,18 +198,22 @@ namespace build2 build2::cc::importable_headers* importable_headers; // The order of sys_*_dirs is the mode entries first, followed by the - // compiler built-in entries, and finished off with any extra entries - // (e.g., fallback directories such as /usr/local/*). + // extra entries (e.g., /usr/local/*), followed by the compiler built-in + // entries. + // + // Note that even if we wanted to, we wouldn't be able to support extra + // trailing (after built-in) directories since we would need a portable + // equivalent of -idirafter for both headers and libraries. // const dir_paths& sys_lib_dirs; // x.sys_lib_dirs const dir_paths& sys_hdr_dirs; // x.sys_hdr_dirs const dir_paths* sys_mod_dirs; // compiler_info::sys_mod_dirs - size_t sys_lib_dirs_mode; // Number of leading mode entries (0 if none). + size_t sys_lib_dirs_mode; // Number of mode entries (0 if none). size_t sys_hdr_dirs_mode; size_t sys_mod_dirs_mode; - size_t sys_lib_dirs_extra; // First trailing extra entry (size if none). + size_t sys_lib_dirs_extra; // Number of extra entries (0 if none). size_t sys_hdr_dirs_extra; // Note that x_obj is patched in by the x.objx module. So it stays NULL -- cgit v1.1