From ad9bc29d45261de7da7fa689b3693c0388e41a3f Mon Sep 17 00:00:00 2001 From: Jackie Huang Date: Tue, 9 Jun 2020 21:06:58 +0800 Subject: [PATCH] stx-metal: add patches to fix build failures on CentOS - Add a patch to avoid using 'which' to check CC since the 'which' on CentOS doesn't allow options. - Add a patch to fix libamon link failure. - Rename all the patches with number prefix to make clear the patch order. Issue-ID: INF-156 Signed-off-by: Jackie Huang Change-Id: I07264e6c2f51cad0c075cd290440bfaf06c4c750 --- ...-dont-install-empty-directory-unless-nee.patch} | 0 ...-dont-install-empty-directory-unless-nee.patch} | 0 ...nprintf-to-avoid-overflowing-amon.tx_buf.patch} | 0 ...when-linking-and-pass-flags-down-to-subm.patch} | 0 ...move-argparse-requirement-from-inventory.patch} | 0 .../0007-mtce-do-not-use-which-to-check-CC.patch | 60 ++++++++++++++++++++++ ...s.patch => 0008-stx-warrior-adjust-paths.patch} | 0 ...send_pulse.patch => 0009-pmon_send_pulse.patch} | 0 .../files/0010-libamon-add-shared-option.patch | 29 +++++++++++ meta-stx/recipes-core/stx-metal/stx-metal.bb | 20 ++++---- 10 files changed, 100 insertions(+), 9 deletions(-) rename meta-stx/recipes-core/stx-metal/files/{0001-mtce-control-dont-install-empty-directory-unless-nee.patch => 0002-mtce-control-dont-install-empty-directory-unless-nee.patch} (100%) rename meta-stx/recipes-core/stx-metal/files/{0001-mtce-storage-dont-install-empty-directory-unless-nee.patch => 0003-mtce-storage-dont-install-empty-directory-unless-nee.patch} (100%) rename meta-stx/recipes-core/stx-metal/files/{0001-Use-snprintf-to-avoid-overflowing-amon.tx_buf.patch => 0004-Use-snprintf-to-avoid-overflowing-amon.tx_buf.patch} (100%) rename meta-stx/recipes-core/stx-metal/files/{0001-Use-LDFLAGS-when-linking-and-pass-flags-down-to-subm.patch => 0005-Use-LDFLAGS-when-linking-and-pass-flags-down-to-subm.patch} (100%) rename meta-stx/recipes-core/stx-metal/files/{0001-stx-metal-remove-argparse-requirement-from-inventory.patch => 0006-stx-metal-remove-argparse-requirement-from-inventory.patch} (100%) create mode 100644 meta-stx/recipes-core/stx-metal/files/0007-mtce-do-not-use-which-to-check-CC.patch rename meta-stx/recipes-core/stx-metal/files/{stx-warrior-adjust-paths.patch => 0008-stx-warrior-adjust-paths.patch} (100%) rename meta-stx/recipes-core/stx-metal/files/{pmon_send_pulse.patch => 0009-pmon_send_pulse.patch} (100%) create mode 100644 meta-stx/recipes-core/stx-metal/files/0010-libamon-add-shared-option.patch diff --git a/meta-stx/recipes-core/stx-metal/files/0001-mtce-control-dont-install-empty-directory-unless-nee.patch b/meta-stx/recipes-core/stx-metal/files/0002-mtce-control-dont-install-empty-directory-unless-nee.patch similarity index 100% rename from meta-stx/recipes-core/stx-metal/files/0001-mtce-control-dont-install-empty-directory-unless-nee.patch rename to meta-stx/recipes-core/stx-metal/files/0002-mtce-control-dont-install-empty-directory-unless-nee.patch diff --git a/meta-stx/recipes-core/stx-metal/files/0001-mtce-storage-dont-install-empty-directory-unless-nee.patch b/meta-stx/recipes-core/stx-metal/files/0003-mtce-storage-dont-install-empty-directory-unless-nee.patch similarity index 100% rename from meta-stx/recipes-core/stx-metal/files/0001-mtce-storage-dont-install-empty-directory-unless-nee.patch rename to meta-stx/recipes-core/stx-metal/files/0003-mtce-storage-dont-install-empty-directory-unless-nee.patch diff --git a/meta-stx/recipes-core/stx-metal/files/0001-Use-snprintf-to-avoid-overflowing-amon.tx_buf.patch b/meta-stx/recipes-core/stx-metal/files/0004-Use-snprintf-to-avoid-overflowing-amon.tx_buf.patch similarity index 100% rename from meta-stx/recipes-core/stx-metal/files/0001-Use-snprintf-to-avoid-overflowing-amon.tx_buf.patch rename to meta-stx/recipes-core/stx-metal/files/0004-Use-snprintf-to-avoid-overflowing-amon.tx_buf.patch diff --git a/meta-stx/recipes-core/stx-metal/files/0001-Use-LDFLAGS-when-linking-and-pass-flags-down-to-subm.patch b/meta-stx/recipes-core/stx-metal/files/0005-Use-LDFLAGS-when-linking-and-pass-flags-down-to-subm.patch similarity index 100% rename from meta-stx/recipes-core/stx-metal/files/0001-Use-LDFLAGS-when-linking-and-pass-flags-down-to-subm.patch rename to meta-stx/recipes-core/stx-metal/files/0005-Use-LDFLAGS-when-linking-and-pass-flags-down-to-subm.patch diff --git a/meta-stx/recipes-core/stx-metal/files/0001-stx-metal-remove-argparse-requirement-from-inventory.patch b/meta-stx/recipes-core/stx-metal/files/0006-stx-metal-remove-argparse-requirement-from-inventory.patch similarity index 100% rename from meta-stx/recipes-core/stx-metal/files/0001-stx-metal-remove-argparse-requirement-from-inventory.patch rename to meta-stx/recipes-core/stx-metal/files/0006-stx-metal-remove-argparse-requirement-from-inventory.patch diff --git a/meta-stx/recipes-core/stx-metal/files/0007-mtce-do-not-use-which-to-check-CC.patch b/meta-stx/recipes-core/stx-metal/files/0007-mtce-do-not-use-which-to-check-CC.patch new file mode 100644 index 0000000..746d2b4 --- /dev/null +++ b/meta-stx/recipes-core/stx-metal/files/0007-mtce-do-not-use-which-to-check-CC.patch @@ -0,0 +1,60 @@ +From 840f382ee691596474966f74bd1be37722bbc91c Mon Sep 17 00:00:00 2001 +From: Jackie Huang +Date: Tue, 9 Jun 2020 20:52:31 +0800 +Subject: [PATCH] mtce: do not use which to check CC + +Signed-off-by: Jackie Huang +--- + mtce-common/src/common/Makefile | 4 +--- + mtce/src/common/Makefile | 4 +--- + mtce/src/public/Makefile | 4 +--- + 3 files changed, 3 insertions(+), 9 deletions(-) + +diff --git a/mtce-common/src/common/Makefile b/mtce-common/src/common/Makefile +index e0a5574..d44eef6 100755 +--- a/mtce-common/src/common/Makefile ++++ b/mtce-common/src/common/Makefile +@@ -54,9 +54,7 @@ CCFLAGS = -g -O2 -Wall -Wextra -Werror -std=c++11 + STATIC_ANALYSIS_TOOL = cppcheck + STATIC_ANALYSIS_TOOL_EXISTS = $(shell [[ -e `which $(STATIC_ANALYSIS_TOOL)` ]] && echo 1 || echo 0) + +-ifeq (,$(shell which ${CC})) +-CC=g++ +-endif ++CC ?= g++ + + .cpp.o: + $(CXX) $(CCFLAGS) $(INCLUDES) $(EXTRACCFLAGS) -c $< -o $@ +diff --git a/mtce/src/common/Makefile b/mtce/src/common/Makefile +index 229a1a3..f797724 100755 +--- a/mtce/src/common/Makefile ++++ b/mtce/src/common/Makefile +@@ -17,9 +17,7 @@ CCFLAGS = -g -O2 -Wall -Wextra -Werror -std=c++11 + STATIC_ANALYSIS_TOOL = cppcheck + STATIC_ANALYSIS_TOOL_EXISTS = $(shell [[ -e `which $(STATIC_ANALYSIS_TOOL)` ]] && echo 1 || echo 0) + +-ifeq (,$(shell which ${CC})) +-CC=g++ +-endif ++CC ?= g++ + + .cpp.o: + $(CXX) $(CCFLAGS) $(INCLUDES) $(EXTRACCFLAGS) -c $< -o $@ +diff --git a/mtce/src/public/Makefile b/mtce/src/public/Makefile +index 403638f..7dd80e4 100644 +--- a/mtce/src/public/Makefile ++++ b/mtce/src/public/Makefile +@@ -13,9 +13,7 @@ LDFLAGS = -shared + CFLAGS = -fPIC -g -O2 -Wall -Wextra -Werror + TARGET_LIB = libamon.so + lib: build +-ifeq (,$(shell which ${CC})) +-CC=gcc +-endif ++CC ?= gcc + + STATIC_ANALYSIS_TOOL = cppcheck + STATIC_ANALYSIS_TOOL_EXISTS = $(shell [[ -e `which $(STATIC_ANALYSIS_TOOL)` ]] && echo 1 || echo 0) +-- +2.7.4 + diff --git a/meta-stx/recipes-core/stx-metal/files/stx-warrior-adjust-paths.patch b/meta-stx/recipes-core/stx-metal/files/0008-stx-warrior-adjust-paths.patch similarity index 100% rename from meta-stx/recipes-core/stx-metal/files/stx-warrior-adjust-paths.patch rename to meta-stx/recipes-core/stx-metal/files/0008-stx-warrior-adjust-paths.patch diff --git a/meta-stx/recipes-core/stx-metal/files/pmon_send_pulse.patch b/meta-stx/recipes-core/stx-metal/files/0009-pmon_send_pulse.patch similarity index 100% rename from meta-stx/recipes-core/stx-metal/files/pmon_send_pulse.patch rename to meta-stx/recipes-core/stx-metal/files/0009-pmon_send_pulse.patch diff --git a/meta-stx/recipes-core/stx-metal/files/0010-libamon-add-shared-option.patch b/meta-stx/recipes-core/stx-metal/files/0010-libamon-add-shared-option.patch new file mode 100644 index 0000000..185375c --- /dev/null +++ b/meta-stx/recipes-core/stx-metal/files/0010-libamon-add-shared-option.patch @@ -0,0 +1,29 @@ +From d233ae2930996102bbdd16085b29058a4d01179c Mon Sep 17 00:00:00 2001 +From: Jackie Huang +Date: Tue, 9 Jun 2020 22:49:56 +0800 +Subject: [PATCH] libamon: add shared option + +The -shared option is set in the parent Makefile, but somehow +it's lost on CentOS, so add it diretly in the target command. + +Signed-off-by: Jackie Huang +--- + mtce/src/public/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mtce/src/public/Makefile b/mtce/src/public/Makefile +index 7dd80e4..1967a90 100644 +--- a/mtce/src/public/Makefile ++++ b/mtce/src/public/Makefile +@@ -37,7 +37,7 @@ ${TARGET_LIB}.${VER_MJR}: ${TARGET_LIB}.${VER} + ln -sf $^ $@ + + ${TARGET_LIB}.${VER}: $(OBJS) +- $(CC) ${LDFLAGS} -Wl,-soname,${TARGET_LIB}.${VER_MJR} -o $@ $^ ++ $(CC) ${LDFLAGS} -shared -Wl,-soname,${TARGET_LIB}.${VER_MJR} -o $@ $^ + + $(SRCS:.c=.d):%.d:%.c + $(CC) $(CFLAGS) -MM $< >$@ +-- +2.7.4 + diff --git a/meta-stx/recipes-core/stx-metal/stx-metal.bb b/meta-stx/recipes-core/stx-metal/stx-metal.bb index c7c4042..1442196 100644 --- a/meta-stx/recipes-core/stx-metal/stx-metal.bb +++ b/meta-stx/recipes-core/stx-metal/stx-metal.bb @@ -38,15 +38,17 @@ LIC_FILES_CHKSUM = " \ SRC_URI = "git://opendev.org/starlingx/metal.git;protocol=${PROTOCOL};rev=${SRCREV};branch=${BRANCH} \ - file://0001-mtce-compute-dont-install-empty-directory-unless-nee.patch \ - file://0001-mtce-control-dont-install-empty-directory-unless-nee.patch \ - file://0001-mtce-storage-dont-install-empty-directory-unless-nee.patch \ - file://0001-Use-snprintf-to-avoid-overflowing-amon.tx_buf.patch \ - file://0001-Use-LDFLAGS-when-linking-and-pass-flags-down-to-subm.patch \ - file://0001-stx-metal-remove-argparse-requirement-from-inventory.patch \ - file://stx-warrior-adjust-paths.patch \ - file://pmon_send_pulse.patch \ - " + file://0001-mtce-compute-dont-install-empty-directory-unless-nee.patch \ + file://0002-mtce-control-dont-install-empty-directory-unless-nee.patch \ + file://0003-mtce-storage-dont-install-empty-directory-unless-nee.patch \ + file://0004-Use-snprintf-to-avoid-overflowing-amon.tx_buf.patch \ + file://0005-Use-LDFLAGS-when-linking-and-pass-flags-down-to-subm.patch \ + file://0006-stx-metal-remove-argparse-requirement-from-inventory.patch \ + file://0007-mtce-do-not-use-which-to-check-CC.patch \ + file://0008-stx-warrior-adjust-paths.patch \ + file://0009-pmon_send_pulse.patch \ + file://0010-libamon-add-shared-option.patch \ + " inherit setuptools systemd -- 2.16.6