enable cross compilation for RHEL7-x86_64 and nilrt7-armv7a on RHEL8 (using mounted SYSROOT at /opt/RHEL7)

This commit is contained in:
2022-06-10 13:54:00 +02:00
parent 1bfe3dec3c
commit 2d597a68b9
5 changed files with 29 additions and 4 deletions

View File

@@ -0,0 +1,21 @@
# "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) <packages>
# (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)

View File

@@ -0,0 +1,4 @@
include $(CONFIG)/os/CONFIG.Cross_64.RHEL7-x86_64
#TOOLSET = devtoolset-11
#STD_CXXFLAGS = -std=c++17

View File

@@ -4,5 +4,5 @@ include $(CONFIG)/os/CONFIG.linux-x86.linux-x86
# Use gcc 11 from gcc-toolset-11
GNU_BIN = /opt/rh/gcc-toolset-11/root/usr/bin
# Fix bug in gcc-toolset-11 calling the old assembler
TARGET_CFLAGS = -B$(GNU_BIN)
TARGET_CFLAGS += -B$(GNU_BIN)
STD_CXXFLAGS = -std=c++17

View File

@@ -0,0 +1 @@
GNU_BIN=/opt/RHEL7/bin

View File

@@ -4,9 +4,8 @@ include $(CONFIG)/os/CONFIG_SITE.linux-x86_64.Common
CROSS_COMPILER_TARGET_ARCHS += RHEL8-x86_64-clang
# Build for old RHEL7 64 bit
#CROSS_COMPILER_TARGET_ARCHS += RHEL7-x86_64
CROSS_COMPILER_TARGET_ARCHS += RHEL7-x86_64
# NI Linux Real-Time 7.x
# requires RPM gcc-c++-arm-linux-gnu
# not available yet for RHEL8
#CROSS_COMPILER_TARGET_ARCHS += nilrt7-armv7a
CROSS_COMPILER_TARGET_ARCHS += nilrt7-armv7a