From 0e2f1f830f6b2b5140b290665a2b9aeb16e1fe91 Mon Sep 17 00:00:00 2001 From: Franz Flasch Date: Sat, 16 Nov 2024 11:47:09 +0100 Subject: [PATCH] CPP: enable c++ compiler by default --- configs/target_config.sh | 10 +++++----- configs/targets/cortex-m0.sh | 1 - configs/targets/cortex-m3.sh | 1 - configs/targets/cortex-m4.sh | 1 - configs/targets/riscv32-baremetal.sh | 1 - configs/targets/riscv64-baremetal.sh | 1 - 6 files changed, 5 insertions(+), 10 deletions(-) diff --git a/configs/target_config.sh b/configs/target_config.sh index 56406a0..47a9a57 100644 --- a/configs/target_config.sh +++ b/configs/target_config.sh @@ -33,11 +33,11 @@ function setup_default_config() # If you want to enable c++ please specify: #local enable_languages="c,c++" - local enable_languages="c" - local fake_cpp="" + local enable_languages="c,c++" + local CPP_COMPILER_NAME="${TARGET}-g++" if [[ ${enable_languages} = "c" ]]; then - fake_cpp="fake" + CPP_COMPILER_NAME="false" fi # According to the gcc docs bootstrap is only enabled for native builds by default. @@ -54,7 +54,7 @@ function setup_default_config() ) # Notes: - # Add CC and a fake CXX to circumvent an issue in glibc in case of a c only build: + # In case of a c only build, we need to specify "CXX=false" otherwise the build won't work. # https://sourceware.org/bugzilla/show_bug.cgi?id=24183 # # CFLAGS: It seems there is an issue when building glibc with GCC-11, so we add @@ -68,7 +68,7 @@ function setup_default_config() "CFLAGS='-g -O2 \ -Wno-error=stringop-overread'" "CC=${TARGET}-gcc" - "CXX=${TARGET}${fake_cpp}-g++" + "CXX=${CPP_COMPILER_NAME}" "--host=${TARGET}" "--prefix=${INSTALL}/${TARGET}" "--with-headers=${INSTALL}/${TARGET}/include" diff --git a/configs/targets/cortex-m0.sh b/configs/targets/cortex-m0.sh index 41b5a79..a12295a 100644 --- a/configs/targets/cortex-m0.sh +++ b/configs/targets/cortex-m0.sh @@ -88,7 +88,6 @@ function config_cortex-m0() { "--disable-shared" "--with-float=soft" "--disable-multilib" - "--enable-languages=c,c++" ) GDB_CONFIGURATION=( diff --git a/configs/targets/cortex-m3.sh b/configs/targets/cortex-m3.sh index 10149f1..b179c80 100644 --- a/configs/targets/cortex-m3.sh +++ b/configs/targets/cortex-m3.sh @@ -88,7 +88,6 @@ function config_cortex-m3() { "--disable-shared" "--with-float=soft" "--disable-multilib" - "--enable-languages=c,c++" ) GDB_CONFIGURATION=( diff --git a/configs/targets/cortex-m4.sh b/configs/targets/cortex-m4.sh index 6f3f416..1a41bee 100644 --- a/configs/targets/cortex-m4.sh +++ b/configs/targets/cortex-m4.sh @@ -88,7 +88,6 @@ function config_cortex-m4() { "--disable-shared" "--with-float=hard" "--disable-multilib" - "--enable-languages=c,c++" ) GDB_CONFIGURATION=( diff --git a/configs/targets/riscv32-baremetal.sh b/configs/targets/riscv32-baremetal.sh index 77e1170..1d1ae71 100644 --- a/configs/targets/riscv32-baremetal.sh +++ b/configs/targets/riscv32-baremetal.sh @@ -63,7 +63,6 @@ function config_riscv32-baremetal() { "--with-newlib" "--disable-shared" "--disable-multilib" - "--enable-languages=c,c++" ) GDB_CONFIGURATION=( diff --git a/configs/targets/riscv64-baremetal.sh b/configs/targets/riscv64-baremetal.sh index e507ecf..1f8dcf3 100644 --- a/configs/targets/riscv64-baremetal.sh +++ b/configs/targets/riscv64-baremetal.sh @@ -71,7 +71,6 @@ function config_riscv64-baremetal() { "--with-newlib" "--disable-shared" "--disable-multilib" - "--enable-languages=c,c++" ) GDB_CONFIGURATION=(