Raspberry Pi 4 And C++ 17

Home » General » Raspberry Pi 4 And C++ 17
General 11 Comments

Hi,

I have a program I want to run on a Raspberry PI 4 that was written on an x86_64 architecture.  So I downloaded the Raspberry PI image of CentOS 7 and now I’m on armv7hl.  Unfortunately, there doesn’t appear to be any devtools for arm at all.  Is there an easy(ish) way to get c++ 17
this architecture?

Thank you!


Will

11 thoughts on - Raspberry Pi 4 And C++ 17

  • Hi,

    I sure did try that.  I also tried to install devtools (no luck there).

    [root@localhost source]# yum list installed binutils* gcc-c++* libc-devel*
    Installed Packages binutils.armv7hl
    2.27-44.base.el7_9.1                                     @updates gcc-c++.armv7hl 4.8.5-44.el7                                            
    @base

    And:

    [root@localhost source]# gcc -v –help 2>/dev/null| grep ‘\-std=c++’
      -ansi                       A synonym for -std=c89 (for C) or
    -std=c++98 (for
      -std=c++03                  Conform to the ISO 1998 C++ standard revised by
      -std=c++0x                  Deprecated in favor of -std=c++11
      -std=c++11                  Conform to the ISO 2011 C++ standard
      -std=c++1y                  Conform to the ISO 201y(7?) C++ draft standard
      -std=c++98                  Conform to the ISO 1998 C++ standard revised by

    So looks like gcc-c++ 4.8.5-44 only gets me to C++11.  Almost there. 
    For some reason I decided to use std::filesystem a bunch of places and it looks like it is only supported in C++17.

  • –I’d suggest checking Software Collections or COPR for newer devtools built for CentOS 7. They’d install to /opt and you’d use the scripts to set your path to use the alternate tools.

  • Am 25.04.22 um 23:07 schrieb Kenneth Porter:

    yum –enablerepo=extras install CentOS-release-scl CentOS-release-scl-rh

    # yum list all |egrep “d.*gcc-c++”|column -t devtoolset-10-gcc-c++.x86_64 10.2.1-11.2.el7 CentOS-sclo-rh devtoolset-11-gcc-c++.x86_64 11.2.1-1.2.el7 CentOS-sclo-rh devtoolset-3-gcc-c++.x86_64 4.9.2-6.el7 CentOS-vault-sclo-rh devtoolset-4-gcc-c++.x86_64 5.3.1-6.1.el7 CentOS-vault-sclo-rh devtoolset-6-gcc-c++.x86_64 6.3.1-3.1.el7 CentOS-vault-sclo-rh devtoolset-7-gcc-c++.x86_64 7.3.1-5.16.el7 CentOS-sclo-rh devtoolset-8-gcc-c++.x86_64 8.3.1-3.2.el7 CentOS-sclo-rh devtoolset-9-gcc-c++.x86_64 9.3.1-2.2.el7 CentOS-sclo-rh


    Leon

  • Hi,

    I think things are different because I’m on a Raspberry PI using armv7hl instead of x86_64.

    [root@localhost ~]# yum –enablerepo=extras install CentOS-release-scl CentOS-release-scl-rh Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile
     * base: mirror.chpc.utah.edu
     * CentOS-kernel: http://ftp.osuosl.org
     * extras: mirror.vacares.com
     * updates: mirror.vacares.com No package CentOS-release-scl available. No package CentOS-release-scl-rh available. Error: Nothing to do
    [root@localhost ~]# yum list all |egrep “d.*gcc-c++”|column -t

    Doesn’t look like that will work here.  I did do that on my main machine that is x86_64.  Devtools is installed there and working fine.  I even scripted the install.  Just doesn’t work on the Raspberry PI version. 
    For instance, this is what I get from my main x86_64 dev box:

    [root@home:~]# yum list all |egrep “d.*gcc-c++”|column -t devtoolset-8-gcc-c++.x86_64   8.3.1-3.2.el7    @CentOS-sclo-rh devtoolset-10-gcc-c++.x86_64  10.2.1-11.2.el7  CentOS-sclo-rh devtoolset-11-gcc-c++.x86_64  11.2.1-1.2.el7   CentOS-sclo-rh devtoolset-7-gcc-c++.x86_64   7.3.1-5.16.el7   CentOS-sclo-rh devtoolset-9-gcc-c++.x86_64   9.3.1-2.2.el7    CentOS-sclo-rh

    I think I found a custom built devtoolset-8 for armv7hl.  Just haven’t gotten it to work yet.  :(


    Will

    CentOS mailing list CentOS@CentOS.org https://lists.CentOS.org/mailman/listinfo/CentOS

  • Have you built RPMs from their source SRPMs before? I’d suggest getting one of the SRPMs from SCL and building it on the Pi. You’ll probably have to incrementally build the whole tool chain, just as those in scl were built.

    It’s possible you could get the person who built the scl versions for x86_64 to add armv7hl to their list of build architectures and it would build and appear automatically. (I’m not familiar enough with the process to know just how automated that is.)

  • Am 25.04.22 um 23:30 schrieb Will:

    Ups, u are right. My fingers typed faster then my brain :-)

  • Will,

    Have you tried building on the current 64 bit Raspberry PI Linux?
    My most recent install is running on an 8GB Pi 4+ in an Argon One M.2
    case with 1TB SSD drive in a headless configuration. I’ve built over 300 packages from sources for amavisd through zlib on the Pi. These are all packages I’ve been using for decades going back to Caldera Linux and most recently CentOS.

    I’ve had to install quite a few development packages using apt-get on the Pi. I could provide a complete list of installed packages that could be used to quickly use apt-get install to pull in the packages needed.

    # dpkg-query -f ‘${binary:Package}\n’ -W | sort > packages_list.txt
    # comm -13 packages_list.txt mypackagelist > newpackages
    # apt-get update
    # apt-get install `cat newpackages`

    Bill

  • Hello Will,

    maybe package manager like spack[1] or guix[2] might help.

    [1] https://spack.readthedocs.io/en/latest/index.html
    [2] https://guix.gnu.org/

    best, Juraj

    —–Original Message—–
    From: Will
    Reply-To: CentOS mailing list
    To: CentOS@CentOS.org Subject: [CentOS] Raspberry Pi 4 and C++ 17
    Date: Mon, 25 Apr 2022 14:41:18 -0400

    Hi,

    I have a program I want to run on a Raspberry PI 4 that was written on an x86_64 architecture.  So I downloaded the Raspberry PI image of CentOS 7 and now I’m on armv7hl.  Unfortunately, there doesn’t appear to be any devtools for arm at all.  Is there an easy(ish) way to get c++
    17
    this architecture?

    Thank you!


    Will

  • Rocky Linux 8 has gcc-toolset-11 for aarch64 with an rpi-installible image. That has support for C++ 17.

    Peter