Can't find avr-g++ in toolchain-atmelavr

Hi, I recently installed platformio-core using the get-platformio.py script on linux. I have been trying to build a project (empty void setup and loop) for an uno. However, the command ‘pio run’ has been giving this error:

sh: line 1: /home/alan/.platformio/packages/toolchain-atmelavr/bin/avr-g++: No such file or directory
*** [.pio/build/uno/src/main.cpp.o] Error 127

here is my platformio.ini file:

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:uno]
platform = atmelavr
board = uno
framework = arduino

src/main.cpp:

#include <Arduino.h>

void setup()
{
}

void loop()
{
}

here’s the file structure:

.
|-- include
|   `-- README
|-- lib
|   `-- README
|-- platformio.ini
|-- src
|   `-- main.cpp
`-- test
    `-- README

the full error:

Processing uno (platform: atmelavr; board: uno; framework: arduino)
--------------------------------------------------------------------------------
Tool Manager: Installing platformio/tool-scons @ ~4.40502.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: tool-scons@4.40502.0 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR (4.2.0) > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (avr-stub) External (avr-stub, simavr)
PACKAGES: 
 - framework-arduino-avr @ 5.1.0 
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 5 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/uno/src/main.cpp.o
sh: line 1: /home/alan/.platformio/packages/toolchain-atmelavr/bin/avr-g++: No such file or directory
*** [.pio/build/uno/src/main.cpp.o] Error 127
========================== [FAILED] Took 6.33 seconds ==========================

I have reinstalled platformio core several times, and have deleted the ~/.platformio directory, but the error persists. If I look in the toolchain directory, avr-g++ is clearly in there:

~/.platformio/packages/toolchain-atmelavr/bin$ ls
avr-addr2line  avr-elfedit    avr-gcc-ranlib  avr-ld       avr-ranlib
avr-ar         avr-g++        avr-gcov        avr-ld.bfd   avr-readelf
avr-as         avr-gcc        avr-gcov-dump   avr-man      avr-size
avr-c++        avr-gcc-7.3.0  avr-gcov-tool   avr-nm       avr-strings
avr-c++filt    avr-gcc-ar     avr-gdb         avr-objcopy  avr-strip
avr-cpp        avr-gcc-nm     avr-gprof       avr-objdump

$pio system info:

--------------------------  --------------------------------------
PlatformIO Core             6.1.7
Python                      3.10.7-final.0
System Type                 linux_x86_64
Platform                    Linux-6.0.10-gnu-x86_64-with-glibc2.35
File System Encoding        utf-8
Locale Encoding             UTF-8
PlatformIO Core Directory   /home/alan/.platformio
PlatformIO Core Executable  platformio
Python Executable           /home/alan/.platformio/penv/bin/python
Global Libraries            0
Development Platforms       1
Tools & Toolchains          3
--------------------------  --------------------------------------

Does anyone have any idea how this could be fixed?

This error can also happen when there’s a binary incompatibility between the prebuild binaries and your Linux system, specifically the “interpreter” for the ELF file, which should be the Linux loader program, ld.so, may have the wrong path.

Please run and post the output of

~/.platformio/packages/toolchain-atmelavr/bin/avr-g++ --version
readelf -l ~/.platformio/packages/toolchain-atmelavr/bin/avr-g++

returns:

bash: /home/alan/.platformio/packages/toolchain-atmelavr/bin/avr-g++: No such file or directory

which seems strange because $ls shows it in the list of files.

returns:

Elf file type is EXEC (Executable file)
Entry point 0x403c18
There are 9 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0x0000000000400040 0x0000000000400040
                 0x00000000000001f8 0x00000000000001f8  R E    0x8
  INTERP         0x0000000000000238 0x0000000000400238 0x0000000000400238
                 0x000000000000001c 0x000000000000001c  R      0x1
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
  LOAD           0x0000000000000000 0x0000000000400000 0x0000000000400000
                 0x00000000000e56c8 0x00000000000e56c8  R E    0x200000
  LOAD           0x00000000000e6000 0x00000000006e6000 0x00000000006e6000
                 0x00000000000022a8 0x0000000000016fa8  RW     0x200000
  DYNAMIC        0x00000000000e6f58 0x00000000006e6f58 0x00000000006e6f58
                 0x0000000000000200 0x0000000000000200  RW     0x8
  NOTE           0x0000000000000254 0x0000000000400254 0x0000000000400254
                 0x0000000000000044 0x0000000000000044  R      0x4
  TLS            0x00000000000e6000 0x00000000006e6000 0x00000000006e6000
                 0x0000000000000000 0x0000000000000010  R      0x8
  GNU_EH_FRAME   0x00000000000d4734 0x00000000004d4734 0x00000000004d4734
                 0x0000000000002c34 0x0000000000002c34  R      0x4
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0x8

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.ABI-tag .note.gnu.build-id .hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame .gcc_except_table 
   03     .init_array .fini_array .jcr .data.rel.ro .dynamic .got .got.plt .data .bss 
   04     .dynamic 
   05     .note.ABI-tag .note.gnu.build-id 
   06     .tbss 
   07     .eh_frame_hdr 
   08 

Okay. So does that path exist? Or, what else exists in /lib64 that sounds like the loader (ld)`?

bash: cd: /lib64: No such file or directory

…then what’s the interpreter of the programs in this system then? What’s readelf -l $(which cat)?

Elf file type is EXEC (Executable file)
Entry point 0x402e70
There are 13 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0x0000000000400040 0x0000000000400040
                 0x00000000000002d8 0x00000000000002d8  R      0x8
  INTERP         0x0000000000000318 0x0000000000400318 0x0000000000400318
                 0x0000000000000050 0x0000000000000050  R      0x1
      [Requesting program interpreter: /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/ld-linux-x86-64.so.2]
  LOAD           0x0000000000000000 0x0000000000400000 0x0000000000400000
                 0x0000000000001488 0x0000000000001488  R      0x1000
  LOAD           0x0000000000002000 0x0000000000402000 0x0000000000402000
                 0x00000000000041c9 0x00000000000041c9  R E    0x1000
  LOAD           0x0000000000007000 0x0000000000407000 0x0000000000407000
                 0x0000000000002be0 0x0000000000002be0  R      0x1000
  LOAD           0x0000000000009df0 0x000000000040adf0 0x000000000040adf0
                 0x0000000000000464 0x0000000000000608  RW     0x1000
  DYNAMIC        0x0000000000009e00 0x000000000040ae00 0x000000000040ae00
                 0x00000000000001f0 0x00000000000001f0  RW     0x8
  NOTE           0x0000000000000368 0x0000000000400368 0x0000000000400368
                 0x0000000000000040 0x0000000000000040  R      0x8
  NOTE           0x00000000000003a8 0x00000000004003a8 0x00000000004003a8
                 0x0000000000000020 0x0000000000000020  R      0x4
  GNU_PROPERTY   0x0000000000000368 0x0000000000400368 0x0000000000400368
                 0x0000000000000040 0x0000000000000040  R      0x8
  GNU_EH_FRAME   0x0000000000008bd0 0x0000000000408bd0 0x0000000000408bd0
                 0x00000000000002dc 0x00000000000002dc  R      0x4
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0x10
  GNU_RELRO      0x0000000000009df0 0x000000000040adf0 0x000000000040adf0
                 0x0000000000000210 0x0000000000000210  R      0x1

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.gnu.property .note.ABI-tag .hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt 
   03     .init .plt .text .fini 
   04     .rodata .eh_frame_hdr .eh_frame 
   05     .init_array .fini_array .dynamic .got .got.plt .data .bss 
   06     .dynamic 
   07     .note.gnu.property 
   08     .note.ABI-tag 
   09     .note.gnu.property 
   10     .eh_frame_hdr 
   11     
   12     .init_array .fini_array .dynamic .got

I forgot to mention, I am using Guix System distro. Could that be messing it up?

What in the world is even that.

Yeah unless you create a symlink /lib64/ld-linux-x86-64.so.2 -> /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/ld-linux-x86-64.so.2, none of the precompiled binaries are going to work I think.

And here I was thinking the number of people who use that was 0. Isn’t it still unfinished?

based on the number of guides/tutorials other than the official manual, you’re probably right.

I’ll try that. thanks for all your time.