From 6ce4e47c1cc251f9eab8ec63b0514fa5269cfab0 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 22 Dec 2011 17:23:09 +0100 Subject: [PATCH] Do not rely on '/sbin/' in PATH Do not rely on '/sbin/' being present in the PATH variable. This patch fixes build problems of hybrid Linux/Genode programs on Debian. --- base-linux/lib/import/import-lx_hybrid.mk | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/base-linux/lib/import/import-lx_hybrid.mk b/base-linux/lib/import/import-lx_hybrid.mk index 419bcec59..0ee42b810 100644 --- a/base-linux/lib/import/import-lx_hybrid.mk +++ b/base-linux/lib/import/import-lx_hybrid.mk @@ -23,13 +23,25 @@ INC_DIR += $(shell echo "int main() {return 0;}" |\ # CXX_LINK_OPT += $(addprefix -L,$(HOST_LIB_SEARCH_DIRS)) +# +# Determine ldconfig executable +# +# On Ubuntu, /sbin/ is in the PATH variable. Hence we try using the program +# found via 'which'. If 'which' does not return anything (i.e., on Debian), +# try using the expected location '/sbin/'. +# +LDCONFIG := $(firstword $(wildcard $(shell which ldconfig) /sbin/ldconfig)) +ifeq ($(LDCONFIG),) +$(error ldconfig is not found) +endif + # # Add search paths for shared-library lookup # # We add all locations of shared libraries present in the ld.cache to our # library search path. # -HOST_SO_SEARCH_DIRS := $(sort $(dir $(shell ldconfig -p | sed "s/^.* \//\//" | grep "^\/"))) +HOST_SO_SEARCH_DIRS := $(sort $(dir $(shell $(LDCONFIG) -p | sed "s/^.* \//\//" | grep "^\/"))) LINK_ARG_PREFIX := -Wl, CXX_LINK_OPT += $(addprefix $(LINK_ARG_PREFIX)-rpath-link $(LINK_ARG_PREFIX),$(HOST_SO_SEARCH_DIRS))