From e9025a189f595ed89dfc535599e0d12cfb03d158 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 5 Apr 2021 15:15:33 -0700 Subject: [PATCH] makefile: Explicitly add /lib and /usr/lib to the library search path Some compiler & linkers on some platforms don't dynamically provide a way to determine the library search path, so if /lib and /usr/lib exist as directories they are added to the end of the library search path. As reported in #1026 --- makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/makefile b/makefile index 96a02b3c..a29dc0d8 100644 --- a/makefile +++ b/makefile @@ -477,6 +477,16 @@ ifeq (${WIN32},) #*nix Environments (&& cygwin) endif endif endif + ifeq (,$(filter /lib/,$(LIBPATH))) + ifeq (existlib,$(shell if $(TEST) -d /lib/; then echo existlib; fi)) + LIBPATH += /lib/ + endif + endif + ifeq (,$(filter /usr/lib/,$(LIBPATH))) + ifeq (existusrlib,$(shell if $(TEST) -d /usr/lib/; then echo existusrlib; fi)) + LIBPATH += /usr/lib/ + endif + endif # Some gcc versions don't support LTO, so only use LTO when the compiler is known to support it ifeq (,$(NO_LTO)) ifneq (,$(GCC_VERSION))