Build RStudio from source on PowerPC Mac (10.5–10.6): help needed

Need help to build RStudio from source on PowerMac G5 running 10.6 PPC (or 10.5.8).
I have been able to compile base R 4.1.1 on this set-up, but I need RStudio too (and then Stan – for Bayesian modelling).

Below is the portion of output:

cmake .. -DRSTUDIO_TARGET=Desktop -DRSTUDIO_PACKAGE_BUILD=1
-- The C compiler identification is GNU 4.2.1
-- The CXX compiler identification is GNU 4.2.1
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building RStudio 2021.10.999-dev+999
-- Machine architecture: Power Macintosh
-- CMake build type: Debug
-- Using RStudio tools root: RSTUDIO_TOOLS_ROOT-NOTFOUND
-- Using Homebrew: HOMEBREW_PREFIX-NOTFOUND
-- Configured to build GWT
-- Using ant: /usr/bin/ant
-- Configured to install GWT
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Failed
CMake Error at src/cpp/CMakeLists.txt:64 (message):
The compiler /usr/bin/c++ has no C++11 support. Please use a different C++
compiler.

This does not help:

cmake .. -DRSTUDIO_TARGET=Desktop -DRSTUDIO_PACKAGE_BUILD=1 -DCMAKE_C_COMPILER='gcc-7'

Same error in result.
What to try?

As of now, gcc4.2 and gcc7 work.
gcc10–11 and clang do not.

I used MacPorts 2.7.1 for everything up to base R.