From 6ec0c3b844075fcc100371b99ab305f2a6e1e295 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Fri, 23 Dec 2022 15:45:11 +0100 Subject: [PATCH] rework RHEL cross compilation --- configure/os/CONFIG.Common.RHEL7-x86_64 | 4 +++ configure/os/CONFIG.Common.RHEL8-x86_64 | 16 ++++++++++++ configure/os/CONFIG.Common.eldk53-ppc4xxFP | 3 +-- .../os/CONFIG.Common.fslqoriq20-e6500_64 | 8 +----- configure/os/CONFIG.Common.nilrt7-armv7a | 6 ++--- configure/os/CONFIG.Common.yocto21-aarch64 | 5 +--- configure/os/CONFIG.Common.yocto40-aarch64 | 5 ++-- configure/os/CONFIG.Cross_64.RHEL7-x86_64 | 21 ---------------- configure/os/CONFIG.RHEL8-x86_64.RHEL7-x86_64 | 25 ++++++++++++++++--- configure/os/CONFIG.RHEL8-x86_64.RHEL8-x86_64 | 14 ----------- configure/os/CONFIG_SITE.Common.linuxCommon | 5 ++++ 11 files changed, 54 insertions(+), 58 deletions(-) delete mode 100644 configure/os/CONFIG.Cross_64.RHEL7-x86_64 diff --git a/configure/os/CONFIG.Common.RHEL7-x86_64 b/configure/os/CONFIG.Common.RHEL7-x86_64 index 757bcb323..9c5538727 100644 --- a/configure/os/CONFIG.Common.RHEL7-x86_64 +++ b/configure/os/CONFIG.Common.RHEL7-x86_64 @@ -1,2 +1,6 @@ # Include definitions common to linux pentium targets include $(CONFIG)/os/CONFIG.Common.linux-x86_64 + +TOOLSET_LOCATION = /opt/rh +#TOOLSET = devtoolset-11 +STD_CXXFLAGS = $(if $(TOOLSET),-std=c++17,-std=c++11) diff --git a/configure/os/CONFIG.Common.RHEL8-x86_64 b/configure/os/CONFIG.Common.RHEL8-x86_64 index 757bcb323..c5e8ee757 100644 --- a/configure/os/CONFIG.Common.RHEL8-x86_64 +++ b/configure/os/CONFIG.Common.RHEL8-x86_64 @@ -1,2 +1,18 @@ # Include definitions common to linux pentium targets include $(CONFIG)/os/CONFIG.Common.linux-x86_64 + +TOOLSET_LOCATION = /opt/rh +#TOOLSET = gcc-toolset-12 +#STD_CXXFLAGS = -std=c++17 + +# Fix bug in gcc-toolset-11 calling the old assembler +ifneq ($(filter %-11,$(TOOLSET)),) +TARGET_CPPFLAGS += $(TOOLSET_DIR:%=-B$(SYSROOT)%/bin) +TARGET_LDFLAGS += $(TOOLSET_DIR:%=-B$(SYSROOT)%/bin) +endif + +ifneq (($(TOOLSET)),) +# Perl requests (native) annobin incompatible with the annobin from any TOOLSET +# Disable Perl specific CFLAGS +override Cap5_CFLAGS= +endif diff --git a/configure/os/CONFIG.Common.eldk53-ppc4xxFP b/configure/os/CONFIG.Common.eldk53-ppc4xxFP index 554b9d918..b6253e6c0 100644 --- a/configure/os/CONFIG.Common.eldk53-ppc4xxFP +++ b/configure/os/CONFIG.Common.eldk53-ppc4xxFP @@ -14,8 +14,7 @@ GNU_DIR = $(SDKTARGETSYSROOT)/$(SDK_HOST_ARCH)/usr GNU_BIN = $(GNU_DIR)/bin/$(GNU_ARCH) GNU_TARGET_INCLUDE_DIR = GNU_TARGET=powerpc-linux +SYSROOT = $(SDKTARGETSYSROOT)/$(GNU_ARCH) ARCH_DEP_CPPFLAGS = -m32 -mcpu=440fp -mhard-float -ARCH_DEP_CPPFLAGS += --sysroot=$(SDKTARGETSYSROOT)/$(GNU_ARCH) -ARCH_DEP_LDFLAGS = --sysroot=$(SDKTARGETSYSROOT)/$(GNU_ARCH) AS=$(GNU_BIN)/$(GNU_TARGET)-as diff --git a/configure/os/CONFIG.Common.fslqoriq20-e6500_64 b/configure/os/CONFIG.Common.fslqoriq20-e6500_64 index 0128312ce..2e23a3e99 100644 --- a/configure/os/CONFIG.Common.fslqoriq20-e6500_64 +++ b/configure/os/CONFIG.Common.fslqoriq20-e6500_64 @@ -10,14 +10,8 @@ SDK_DIR = /opt/fsl-qoriq/2.0 SDK_HOST_ARCH = $(GNU_HOST_ARCH_64)-$(SDK)-$(GNU_HOST_OS) SDK_TARGET = ppc64e6500-fsl-linux GNU_TARGET = powerpc64-fsl-linux -SDKTARGETSYSROOT = $(SDK_DIR)/sysroots/$(SDK_TARGET) +SYSROOT = $(SDK_DIR)/sysroots/$(SDK_TARGET) GNU_DIR = $(SDK_DIR)/sysroots/$(SDK_HOST_ARCH)/usr GNU_BIN = $(GNU_DIR)/bin/$(GNU_TARGET) -ARCH_DEP_CPPFLAGS = --sysroot=$(SDKTARGETSYSROOT) ARCH_DEP_CFLAGS = -mcpu=e6500 -m64 -mhard-float -ARCH_DEP_LDFLAGS = --sysroot=$(SDKTARGETSYSROOT) - -# warning -O2 and higher are broken! -#OPT_CFLAGS_YES = -O1 -#OPT_CXXFLAGS_YES = -O1 diff --git a/configure/os/CONFIG.Common.nilrt7-armv7a b/configure/os/CONFIG.Common.nilrt7-armv7a index 1457097ff..7e60676e2 100644 --- a/configure/os/CONFIG.Common.nilrt7-armv7a +++ b/configure/os/CONFIG.Common.nilrt7-armv7a @@ -10,9 +10,7 @@ GNU_TARGET = arm-linux-gnu SYSROOT = /opt/LabVIEW-RT-19.5.1/arm/sysroots/armv7a-vfp-neon-nilrt-linux-gnueabi ARCH_DEP_CPPFLAGS += -march=armv7-a -mthumb-interwork -mfloat-abi=softfp -mfpu=neon -ARCH_DEP_CPPFLAGS += --sysroot=$(SYSROOT) -ARCH_DEP_CPPFLAGS += -I$(SYSROOT)/usr/include/c++/4.7.2/arm-nilrt-linux-gnueabi/ -ARCH_DEP_CPPFLAGS += -I$(SYSROOT)/usr/include/c++/4.7.2/ -ARCH_DEP_LDFLAGS += --sysroot=$(SYSROOT) +ARCH_DEP_CXXFLAGS += -I$(SYSROOT)/usr/include/c++/4.7.2/arm-nilrt-linux-gnueabi/ +ARCH_DEP_CXXFLAGS += -I$(SYSROOT)/usr/include/c++/4.7.2/ COMMANDLINE_LIBRARY = READLINE_NCURSES diff --git a/configure/os/CONFIG.Common.yocto21-aarch64 b/configure/os/CONFIG.Common.yocto21-aarch64 index 3cc1fe1dc..5220ed9bc 100644 --- a/configure/os/CONFIG.Common.yocto21-aarch64 +++ b/configure/os/CONFIG.Common.yocto21-aarch64 @@ -10,9 +10,6 @@ SDK_DIR = /opt/petalinux-gfa/2018.1 SDK_HOST_ARCH = $(GNU_HOST_ARCH_64)-$(SDK)-$(GNU_HOST_OS) SDK_TARGET = aarch64-xilinx-linux GNU_TARGET = $(SDK_TARGET) -SDKTARGETSYSROOT = $(SDK_DIR)/sysroots/$(SDK_TARGET) +SYSROOT = $(SDK_DIR)/sysroots/$(SDK_TARGET) GNU_DIR = $(SDK_DIR)/sysroots/$(SDK_HOST_ARCH)/usr GNU_BIN = $(GNU_DIR)/bin/$(GNU_TARGET) - -ARCH_DEP_CPPFLAGS = --sysroot=$(SDKTARGETSYSROOT) -ARCH_DEP_LDFLAGS = --sysroot=$(SDKTARGETSYSROOT) diff --git a/configure/os/CONFIG.Common.yocto40-aarch64 b/configure/os/CONFIG.Common.yocto40-aarch64 index b1fa0c600..81c889c68 100644 --- a/configure/os/CONFIG.Common.yocto40-aarch64 +++ b/configure/os/CONFIG.Common.yocto40-aarch64 @@ -10,11 +10,10 @@ SDK_DIR = /opt/yocto40-aarch64 SDK_HOST_ARCH = $(GNU_HOST_ARCH_64)-$(SDK)-$(GNU_HOST_OS) SDK_TARGET = cortexa53-poky-linux GNU_TARGET = aarch64-poky-linux -SDKTARGETSYSROOT = $(SDK_DIR)/sysroots/$(SDK_TARGET) +SYSROOT = $(SDK_DIR)/sysroots/$(SDK_TARGET) GNU_DIR = $(SDK_DIR)/sysroots/$(SDK_HOST_ARCH)/usr GNU_BIN = $(GNU_DIR)/bin/$(GNU_TARGET) -ARCH_DEP_CPPFLAGS = --sysroot=$(SDKTARGETSYSROOT) -mcpu=cortex-a53 -march=armv8-a+crc -ARCH_DEP_LDFLAGS = --sysroot=$(SDKTARGETSYSROOT) +ARCH_DEP_CPPFLAGS = -mcpu=cortex-a53 -march=armv8-a+crc STD_CXXFLAGS = -std=c++23 diff --git a/configure/os/CONFIG.Cross_64.RHEL7-x86_64 b/configure/os/CONFIG.Cross_64.RHEL7-x86_64 deleted file mode 100644 index 75e4038d1..000000000 --- a/configure/os/CONFIG.Cross_64.RHEL7-x86_64 +++ /dev/null @@ -1,21 +0,0 @@ -# "cross compile" for RHEL7-x86_64 on other 64 bit Linux version -# Expects RHEL7 RPMs c++ and readline-devel installed in $(SYSROOT) -# This can be installed on RHEL7 with: -# yum install --installroot=$(SYSROOT) -# (Assuming $(SYSROOT) is on a shared network volume.) -# Optionally use a newer toolset (installed on $(SYSROOT)). - -include $(CONFIG)/os/CONFIG.linux-x86.linux-x86 - -SYSROOT = /opt/RHEL7 -TOOLSET_LOCATION = /opt/rh - -# Do NOT set GNU_BIN (or else ...)! -TOOLSET_DIR = $(TOOLSET:%=$(TOOLSET_LOCATION)/%/root) -CC = $(SYSROOT)$(TOOLSET_DIR)/bin/gcc -CCC = $(SYSROOT)$(TOOLSET_DIR)/bin/g++ -# Set LD_LIBRARY_PATH and BFLAG only with TOOLSET -LD_LIBRARY_PATH = $(if $(TOOLSET),$(SYSROOT)$(TOOLSET_DIR)/lib64) -BFLAG = $(if $(TOOLSET),-B$(SYSROOT)$(TOOLSET_DIR)/bin) -TARGET_CPPFLAGS += --sysroot=$(SYSROOT) $(BFLAG) -TARGET_LDFLAGS += --sysroot=$(SYSROOT) $(BFLAG) diff --git a/configure/os/CONFIG.RHEL8-x86_64.RHEL7-x86_64 b/configure/os/CONFIG.RHEL8-x86_64.RHEL7-x86_64 index b5222b603..8571d0e68 100644 --- a/configure/os/CONFIG.RHEL8-x86_64.RHEL7-x86_64 +++ b/configure/os/CONFIG.RHEL8-x86_64.RHEL7-x86_64 @@ -1,4 +1,23 @@ -include $(CONFIG)/os/CONFIG.Cross_64.RHEL7-x86_64 +# Include common linux definitions +include $(CONFIG)/os/CONFIG.linux-x86.linux-x86 -#TOOLSET = devtoolset-11 -#STD_CXXFLAGS = -std=c++17 +# "Cross compile" for RHEL7-x86_64 +# Expects RHEL7 RPMs c++ and readline-devel installed +# in $(SYSROOT) +# This can be installed on RHEL7 with: +# yum install --installroot=$(SYSROOT) +# (Assuming $(SYSROOT) is on a shared network volume.) +# Optionally use a newer TOOLSET (installed on $(SYSROOT)). + +SYSROOT = /opt/RHEL7 +GNU_DIR = $(SYSROOT)$(TOOLSET_DIR) + +# "Cross" TOOLSET progs need to find their libraries +LD_LIBRARY_PATH = $(TOOLSET_DIR:%=$(SYSROOT)%/usr/$$LIB) + +# These programs have library problems when using them +# from SYSROOT but without TOOLSET. +# But provinding LD_LIBRARY PATH crashes other progams. +# Our host versions work just fine. +AR = ar -rc +RANLIB = ranlib diff --git a/configure/os/CONFIG.RHEL8-x86_64.RHEL8-x86_64 b/configure/os/CONFIG.RHEL8-x86_64.RHEL8-x86_64 index fb55d4981..2bf7aace1 100644 --- a/configure/os/CONFIG.RHEL8-x86_64.RHEL8-x86_64 +++ b/configure/os/CONFIG.RHEL8-x86_64.RHEL8-x86_64 @@ -1,16 +1,2 @@ # Include common linux definitions include $(CONFIG)/os/CONFIG.linux-x86.linux-x86 - -TOOLSET = gcc-toolset-11 -TOOLSET_LOCATION = /opt/rh -TOOLSET_DIR = $(TOOLSET:%=$(TOOLSET_LOCATION)/%/root) -GNU_BIN = $(TOOLSET_DIR)/bin - -# Fix bug in gcc-toolset-11 calling the old assembler -# Also gcc-toolset-11 requires gcc-toolset-11-annobin-plugin-gcc -# while the others only need gcc-toolset-*-toolchain -ifneq ($(filter %-11,$(TOOLSET)),) -PATH:=$(GNU_BIN):$(PATH) -endif - -STD_CXXFLAGS = -std=c++17 diff --git a/configure/os/CONFIG_SITE.Common.linuxCommon b/configure/os/CONFIG_SITE.Common.linuxCommon index 1932ae7e6..2b7e5642b 100644 --- a/configure/os/CONFIG_SITE.Common.linuxCommon +++ b/configure/os/CONFIG_SITE.Common.linuxCommon @@ -13,6 +13,11 @@ CODE_CPPFLAGS += -fno-strict-aliasing USR_CXXFLAGS += $(STD_CXXFLAGS) STD_CXXFLAGS = -std=c++11 +TOOLSET_DIR = $(TOOLSET:%=$(TOOLSET_LOCATION)/%/root) +GNU_DIR = $(TOOLSET_DIR) +TARGET_CPPFLAGS += $(SYSROOT:%=--sysroot=%) +TARGET_LDFLAGS += $(SYSROOT:%=--sysroot=%) + ifeq ($(filter SL% RHEL%,$(T_A)),) VALID_BUILDS = Ioc Command endif