Commits 5a9be20243fd ("boost: enhance main makefile to build against
arbitrary boost") and 765fa172ab41 ("boost: enhance modules/common.gmk
to build against arbitrary boost") added support for allowing the user
to specify arbitrary boost_base but left in place the special casing
when building for aarch64.
As boost_base can also be used to specify the location for aarch64
boost libraries when required, drop the extra logic that hard codes
paths for arm64 in favour of the more flexible approach.
As an added benefit the change also enables cross building in
environments where the compiler can be trusted to correctly resolve
the library paths such as on Debian or Ubuntu.
Makefile | 33 ++++++++++-----------------------
modules/common.gmk | 27 +++++++--------------------
2 files changed, 17 insertions(+), 43 deletions(-)
diff --git a/Makefile b/Makefile
index 9d80f095a3c7..b5d3f2cb0892 100644
--- a/Makefile
+++ b/Makefile
@@ -1847,33 +1847,20 @@ endif
#Allow user specify non-default location of boost
ifeq ($(boost_base),)
- ifeq ($(CROSS_PREFIX),)
- # link with -mt if present, else the base version (and hope it is multithreaded)
- boost-mt := -mt
+ # link with -mt if present, else the base version (and hope it is multithreaded)
+ boost-mt := -mt
+ boost-lib-dir := $(dir $(shell $(CC) --print-file-name libboost_system$(boost-mt).a))
+ ifeq ($(filter /%,$(boost-lib-dir)),)
+ boost-mt :=
boost-lib-dir := $(dir $(shell $(CC) --print-file-name libboost_system$(boost-mt).a))
ifeq ($(filter /%,$(boost-lib-dir)),)
- boost-mt :=
- boost-lib-dir := $(dir $(shell $(CC) --print-file-name libboost_system$(boost-mt).a))
- ifeq ($(filter /%,$(boost-lib-dir)),)
- $(error Error: libboost_system.a needs to be installed.)
- endif
- endif
- # When boost_env=host, we won't use "-nostdinc", so the build machine's
- # header files will be used normally. So we don't need to add anything
- # special for Boost.
- boost-includes =
- else
- ifeq ($(arch),aarch64)
- aarch64_boostbase = build/downloaded_packages/aarch64/boost/install
- ifeq (,$(wildcard $(aarch64_boostbase)))
- $(error Missing $(aarch64_boostbase) directory. Please run "./scripts/download_aarch64_packages.py")
- endif
-
- boost-lib-dir := $(firstword $(dir $(shell find $(aarch64_boostbase)/ -name libboost_system*.a)))
- boost-mt := $(if $(filter %-mt.a, $(wildcard $(boost-lib-dir)/*.a)),-mt)
- boost-includes = -isystem $(aarch64_boostbase)/usr/include
+ $(error Error: libboost_system.a needs to be installed.)
endif
endif
+ # When boost_env=host, we won't use "-nostdinc", so the build machine's
+ # header files will be used normally. So we don't need to add anything
+ # special for Boost.
+ boost-includes =
else
# Use boost specified by the user
boost-lib-dir := $(firstword $(dir $(shell find $(boost_base)/ -name libboost_system*.a)))
diff --git a/modules/common.gmk b/modules/common.gmk
index e0814b42414e..6ae5870ae365 100644
--- a/modules/common.gmk
+++ b/modules/common.gmk
@@ -123,27 +123,14 @@ endif
# Let us detect presence of boost headers and library
# Allow user specify non-default location of boost
ifeq ($(boost_base),)
- ifeq ($(CROSS_PREFIX),)
- boost-lib-dir := $(dir $(shell $(CC) --print-file-name libboost_system.so))
- ifeq ($(filter /%,$(boost-lib-dir)),)
- $(error Error: libboost_system.so needs to be installed.)
- endif
- # When boost_env=host, we won't use "-nostdinc", so the build machine's
- # header files will be used normally. So we don't need to add anything
- # special for Boost.
- boost-includes =
- else
- ifeq ($(arch),aarch64)
- aarch64_boostbase = $(src)/build/downloaded_packages/aarch64/boost/install
- ifeq (,$(wildcard $(aarch64_boostbase)))
- $(error Missing $(aarch64_boostbase) directory. Please run "./scripts/download_aarch64_packages.py")
- endif
-
- boost-lib-dir := $(firstword $(dir $(shell find $(aarch64_boostbase)/ -name libboost_system.so)))
- LDFLAGS += -L$(boost-lib-dir)
- boost-includes = -isystem $(aarch64_boostbase)/usr/include
- endif
+ boost-lib-dir := $(dir $(shell $(CC) --print-file-name libboost_system.so))
+ ifeq ($(filter /%,$(boost-lib-dir)),)
+ $(error Error: libboost_system.so needs to be installed.)
endif
+ # When boost_env=host, we won't use "-nostdinc", so the build machine's
+ # header files will be used normally. So we don't need to add anything
+ # special for Boost.
+ boost-includes =
else
ifeq ($(filter /%,$(boost_base)),)
absolute_boost_base := $(src)/$(boost_base)# It must be relative OSv root
--
2.29.2