linuxubuntugccbuildpowerpc

cannot execute ‘cc1plus’: execvp: No such file or directory


I can't build a cpp file by using the powerpc64-linux-gnu-gcc-10 build command. I get the error powerpc64-linux-gnu-gcc-10: fatal error: cannot execute ‘cc1plus’: execvp: No such file or directory.

$ sudo apt-get install gcc-10-powerpc64-linux-gnu build-essential
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  binutils-powerpc64-linux-gnu cpp-10-powerpc64-linux-gnu g++ g++-9 gcc gcc-10-cross-base-ports gcc-10-powerpc64-linux-gnu-base libasan6-ppc64-cross libatomic1-ppc64-cross libc6-dev-ppc64-cross libc6-ppc64-cross
  libgcc-10-dev-ppc64-cross libgcc-s1-ppc64-cross libgomp1-ppc64-cross libitm1-ppc64-cross liblsan0-ppc64-cross libstdc++-9-dev libstdc++6-ppc64-cross libtsan0-ppc64-cross libubsan1-ppc64-cross
  linux-libc-dev-ppc64-cross
Suggested packages:
  binutils-doc gcc-10-locales g++-multilib g++-9-multilib gcc-9-doc gcc-multilib autoconf automake libtool flex bison gdb gcc-doc gcc-10-multilib-powerpc64-linux-gnu gcc-10-doc libstdc++-9-doc
The following NEW packages will be installed:
  binutils-powerpc64-linux-gnu build-essential cpp-10-powerpc64-linux-gnu g++ g++-9 gcc gcc-10-cross-base-ports gcc-10-powerpc64-linux-gnu gcc-10-powerpc64-linux-gnu-base libasan6-ppc64-cross libatomic1-ppc64-cross
  libc6-dev-ppc64-cross libc6-ppc64-cross libgcc-10-dev-ppc64-cross libgcc-s1-ppc64-cross libgomp1-ppc64-cross libitm1-ppc64-cross liblsan0-ppc64-cross libstdc++-9-dev libstdc++6-ppc64-cross libtsan0-ppc64-cross       
  libubsan1-ppc64-cross linux-libc-dev-ppc64-cross
0 upgraded, 23 newly installed, 0 to remove and 0 not upgraded.
Need to get 36.9 MB/47.0 MB of archives.
After this operation, 185 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 gcc-10-powerpc64-linux-gnu-base amd64 10.3.0-1ubuntu1~20.04cross1 [20.4 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 cpp-10-powerpc64-linux-gnu amd64 10.3.0-1ubuntu1~20.04cross1 [7431 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 gcc-10-cross-base-ports all 10.3.0-1ubuntu1~20.04cross1 [15.3 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 binutils-powerpc64-linux-gnu amd64 2.34-6ubuntu1.3 [2233 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/universe amd64 libc6-ppc64-cross all 2.31-0ubuntu7cross1 [1259 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 libgcc-s1-ppc64-cross all 10.3.0-1ubuntu1~20.04cross1 [30.8 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 libgomp1-ppc64-cross all 10.3.0-1ubuntu1~20.04cross1 [105 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 libitm1-ppc64-cross all 10.3.0-1ubuntu1~20.04cross1 [29.1 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 libatomic1-ppc64-cross all 10.3.0-1ubuntu1~20.04cross1 [10.3 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 libasan6-ppc64-cross all 10.3.0-1ubuntu1~20.04cross1 [2029 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 liblsan0-ppc64-cross all 10.3.0-1ubuntu1~20.04cross1 [827 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 libtsan0-ppc64-cross all 10.3.0-1ubuntu1~20.04cross1 [1959 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 libstdc++6-ppc64-cross all 10.3.0-1ubuntu1~20.04cross1 [507 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 libubsan1-ppc64-cross all 10.3.0-1ubuntu1~20.04cross1 [780 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 libgcc-10-dev-ppc64-cross all 10.3.0-1ubuntu1~20.04cross1 [1080 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 gcc-10-powerpc64-linux-gnu amd64 10.3.0-1ubuntu1~20.04cross1 [15.2 MB]
Get:17 http://archive.ubuntu.com/ubuntu focal/universe amd64 linux-libc-dev-ppc64-cross all 5.4.0-21.25cross1 [1064 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal/universe amd64 libc6-dev-ppc64-cross all 2.31-0ubuntu7cross1 [2337 kB]
Fetched 36.9 MB in 4s (9039 kB/s)
Selecting previously unselected package gcc.
(Reading database ... 37236 files and directories currently installed.)
Preparing to unpack .../00-gcc_4%3a9.3.0-1ubuntu2_amd64.deb ...
Unpacking gcc (4:9.3.0-1ubuntu2) ...
Selecting previously unselected package libstdc++-9-dev:amd64.
Preparing to unpack .../01-libstdc++-9-dev_9.4.0-1ubuntu1~20.04.1_amd64.deb ...
Unpacking libstdc++-9-dev:amd64 (9.4.0-1ubuntu1~20.04.1) ...
Selecting previously unselected package g++-9.
Preparing to unpack .../02-g++-9_9.4.0-1ubuntu1~20.04.1_amd64.deb ...
Unpacking g++-9 (9.4.0-1ubuntu1~20.04.1) ...
Selecting previously unselected package g++.
Preparing to unpack .../03-g++_4%3a9.3.0-1ubuntu2_amd64.deb ...
Unpacking g++ (4:9.3.0-1ubuntu2) ...
Selecting previously unselected package build-essential.
Preparing to unpack .../04-build-essential_12.8ubuntu1.1_amd64.deb ...
Unpacking build-essential (12.8ubuntu1.1) ...
Selecting previously unselected package gcc-10-powerpc64-linux-gnu-base:amd64.
Preparing to unpack .../05-gcc-10-powerpc64-linux-gnu-base_10.3.0-1ubuntu1~20.04cross1_amd64.deb ...
Unpacking gcc-10-powerpc64-linux-gnu-base:amd64 (10.3.0-1ubuntu1~20.04cross1) ...
Selecting previously unselected package cpp-10-powerpc64-linux-gnu.
Preparing to unpack .../06-cpp-10-powerpc64-linux-gnu_10.3.0-1ubuntu1~20.04cross1_amd64.deb ...
Unpacking cpp-10-powerpc64-linux-gnu (10.3.0-1ubuntu1~20.04cross1) ...
Selecting previously unselected package gcc-10-cross-base-ports.
Preparing to unpack .../07-gcc-10-cross-base-ports_10.3.0-1ubuntu1~20.04cross1_all.deb ...
Unpacking gcc-10-cross-base-ports (10.3.0-1ubuntu1~20.04cross1) ...
Selecting previously unselected package binutils-powerpc64-linux-gnu.
Preparing to unpack .../08-binutils-powerpc64-linux-gnu_2.34-6ubuntu1.3_amd64.deb ...
Unpacking binutils-powerpc64-linux-gnu (2.34-6ubuntu1.3) ...
Selecting previously unselected package libc6-ppc64-cross.
Preparing to unpack .../09-libc6-ppc64-cross_2.31-0ubuntu7cross1_all.deb ...
Unpacking libc6-ppc64-cross (2.31-0ubuntu7cross1) ...
Selecting previously unselected package libgcc-s1-ppc64-cross.
Preparing to unpack .../10-libgcc-s1-ppc64-cross_10.3.0-1ubuntu1~20.04cross1_all.deb ...
Unpacking libgcc-s1-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Selecting previously unselected package libgomp1-ppc64-cross.
Preparing to unpack .../11-libgomp1-ppc64-cross_10.3.0-1ubuntu1~20.04cross1_all.deb ...
Unpacking libgomp1-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Selecting previously unselected package libitm1-ppc64-cross.
Preparing to unpack .../12-libitm1-ppc64-cross_10.3.0-1ubuntu1~20.04cross1_all.deb ...
Unpacking libitm1-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Selecting previously unselected package libatomic1-ppc64-cross.
Preparing to unpack .../13-libatomic1-ppc64-cross_10.3.0-1ubuntu1~20.04cross1_all.deb ...
Unpacking libatomic1-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Selecting previously unselected package libasan6-ppc64-cross.
Preparing to unpack .../14-libasan6-ppc64-cross_10.3.0-1ubuntu1~20.04cross1_all.deb ...
Unpacking libasan6-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Selecting previously unselected package liblsan0-ppc64-cross.
Preparing to unpack .../15-liblsan0-ppc64-cross_10.3.0-1ubuntu1~20.04cross1_all.deb ...
Unpacking liblsan0-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Selecting previously unselected package libtsan0-ppc64-cross.
Preparing to unpack .../16-libtsan0-ppc64-cross_10.3.0-1ubuntu1~20.04cross1_all.deb ...
Unpacking libtsan0-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Selecting previously unselected package libstdc++6-ppc64-cross.
Preparing to unpack .../17-libstdc++6-ppc64-cross_10.3.0-1ubuntu1~20.04cross1_all.deb ...
Unpacking libstdc++6-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Selecting previously unselected package libubsan1-ppc64-cross.
Preparing to unpack .../18-libubsan1-ppc64-cross_10.3.0-1ubuntu1~20.04cross1_all.deb ...
Unpacking libubsan1-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Selecting previously unselected package libgcc-10-dev-ppc64-cross.
Preparing to unpack .../19-libgcc-10-dev-ppc64-cross_10.3.0-1ubuntu1~20.04cross1_all.deb ...
Unpacking libgcc-10-dev-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Selecting previously unselected package gcc-10-powerpc64-linux-gnu.
Preparing to unpack .../20-gcc-10-powerpc64-linux-gnu_10.3.0-1ubuntu1~20.04cross1_amd64.deb ...
Unpacking gcc-10-powerpc64-linux-gnu (10.3.0-1ubuntu1~20.04cross1) ...
Unpacking linux-libc-dev-ppc64-cross (5.4.0-21.25cross1) ...
Selecting previously unselected package libc6-dev-ppc64-cross.
Preparing to unpack .../22-libc6-dev-ppc64-cross_2.31-0ubuntu7cross1_all.deb ...
Unpacking libc6-dev-ppc64-cross (2.31-0ubuntu7cross1) ...
Setting up gcc-10-cross-base-ports (10.3.0-1ubuntu1~20.04cross1) ...
Setting up linux-libc-dev-ppc64-cross (5.4.0-21.25cross1) ...
Setting up libstdc++-9-dev:amd64 (9.4.0-1ubuntu1~20.04.1) ...
Setting up gcc (4:9.3.0-1ubuntu2) ...
Setting up libc6-ppc64-cross (2.31-0ubuntu7cross1) ...
Setting up binutils-powerpc64-linux-gnu (2.34-6ubuntu1.3) ...
Setting up g++-9 (9.4.0-1ubuntu1~20.04.1) ...
Setting up g++ (4:9.3.0-1ubuntu2) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
Setting up gcc-10-powerpc64-linux-gnu-base:amd64 (10.3.0-1ubuntu1~20.04cross1) ...
Setting up libgomp1-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Setting up libatomic1-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Setting up build-essential (12.8ubuntu1.1) ...
Setting up libc6-dev-ppc64-cross (2.31-0ubuntu7cross1) ...
Setting up libitm1-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Setting up libgcc-s1-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Setting up cpp-10-powerpc64-linux-gnu (10.3.0-1ubuntu1~20.04cross1) ...
Setting up libtsan0-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Setting up libasan6-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Setting up liblsan0-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Setting up libstdc++6-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Setting up libubsan1-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...    
Setting up libgcc-10-dev-ppc64-cross (10.3.0-1ubuntu1~20.04cross1) ...
Setting up gcc-10-powerpc64-linux-gnu (10.3.0-1ubuntu1~20.04cross1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
/sbin/ldconfig.real: /usr/lib/wsl/lib/libcuda.so.1 is not a symbolic link

$ cd /home/user/Project

$ powerpc64-linux-gnu-gcc-10 -static -o test.bin test.cpp
powerpc64-linux-gnu-gcc-10: fatal error: cannot execute ‘cc1plus’: execvp: No such file or directory
compilation terminated.

$ whereis cc1plus
cc1plus:

I tried to install gcc and g++ packages, with no success.

UPDATE :

Ok I managed to build by using g++ instead of gcc :

$ sudo apt install g++-10-powerpc64-linux-gnu qemu-user

$ powerpc64-linux-gnu-g++-10 -o test.bin test.cpp

$ export QEMU_LD_PREFIX=/usr/powerpc64-linux-gnu/

$ qemu-ppc64 ./test.bin

Solution

  • (Sorry for not commenting first, not enough rep)

    The Ubuntu package search indicates that cc1plus for gcc10 on powerpc64 is provided by the package g++-10-powerpc64-linux-gnu.

    Check if the package is installed and try again:
    sudo apt install g++-10-powerpc64-linux-gnu