From cdbba6ac4bf40d64641b7afea2c79d39dee22ee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Wed, 1 Jul 2020 09:58:25 +0200 Subject: [PATCH 1/3] agent: Make LIBC configurable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the default LIBC used to build the agent is "musl". However, "musl" is not preset in a big portion of the distros *and* "gnu" libc just works as expected. Knowing that, let's add the option to the one building the project to simply do `make LIBC=gnu` instead of expected the person to go through the Makefile and replace musl by gnu there. Fixes: #369 Signed-off-by: Fabiano FidĂȘncio --- src/agent/Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/agent/Makefile b/src/agent/Makefile index 79fd92707b..7a43d77b51 100644 --- a/src/agent/Makefile +++ b/src/agent/Makefile @@ -31,7 +31,15 @@ ifdef proto endif ARCH = $(shell uname -m) -LIBC = musl +LIBC ?= musl +ifneq ($(LIBC),musl) + ifeq ($(LIBC),gnu) + override LIBC = gnu + else + $(error "ERROR: A non supported LIBC value was passed. Supported values are musl and gnu") + endif +endif + TRIPLE = $(ARCH)-unknown-linux-$(LIBC) TARGET_PATH = target/$(TRIPLE)/$(BUILD_TYPE)/$(TARGET) From f404f4d959aabfbd84553cb0b5aa448212587540 Mon Sep 17 00:00:00 2001 From: Abhishek Dasgupta Date: Thu, 9 Jul 2020 03:20:33 -0400 Subject: [PATCH 2/3] Modified Makefile to pick up correct architecture name for ppc64le. Makefile is determining the architecture by running uname command which gives ppc64le as output. But rust toolchain target is available with the name powerpc64le for ppc64le arch. So this change took care of that. Signed-off-by: Abhishek Dasgupta --- src/agent/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/agent/Makefile b/src/agent/Makefile index 7a43d77b51..9a53d5182d 100644 --- a/src/agent/Makefile +++ b/src/agent/Makefile @@ -40,6 +40,10 @@ ifneq ($(LIBC),musl) endif endif +ifeq ($(ARCH), ppc64le) + override ARCH = powerpc64le +endif + TRIPLE = $(ARCH)-unknown-linux-$(LIBC) TARGET_PATH = target/$(TRIPLE)/$(BUILD_TYPE)/$(TARGET) From ae83c96da9040edc7b19a204d6080b550b3e0d12 Mon Sep 17 00:00:00 2001 From: Abhishek Dasgupta Date: Wed, 8 Jul 2020 07:19:10 -0400 Subject: [PATCH 3/3] Modifie to proper CPU architecture name for ppc64le. Rust core::arch understand ppc64le as powerpc64 architecture instead of powerpc64le architecture. Signed-off-by: Abhishek Dasgupta --- src/agent/src/linux_abi.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/agent/src/linux_abi.rs b/src/agent/src/linux_abi.rs index f0cdc7a302..b41fcf1ba9 100644 --- a/src/agent/src/linux_abi.rs +++ b/src/agent/src/linux_abi.rs @@ -10,7 +10,7 @@ pub const SYSFS_DIR: &str = "/sys"; pub const SYSFS_PCI_BUS_PREFIX: &str = "/sys/bus/pci/devices"; pub const SYSFS_PCI_BUS_RESCAN_FILE: &str = "/sys/bus/pci/rescan"; #[cfg(any( - target_arch = "powerpc64le", + target_arch = "powerpc64", target_arch = "s390x", target_arch = "x86_64", target_arch = "x86"