esp-idf: v4.4 on Raspberry Pi 4 ... "gcc is not able to compile a simple test program." (IDFGH-6180)
Hi.
If I do this everything works exactly as expected:
# Install IDF
export IDF_TOOLS_PATH=/home/esp/tools/
mkdir /home/esp/idf
cd /home/esp/idf
git clone -b v4.3.1 --recursive https://github.com/espressif/esp-idf.git .
./install.sh
# Pull fix for broken CA file
cd /home/esp/idf/components/mbedtls/esp_crt_bundle
mv cacrt_all.pem cacrt_all.pem.orig
wget https://raw.githubusercontent.com/electrocucaracha/esp-idf/4e45f13e2df72a4cb4dc875942e95775198db85c/components/mbedtls/esp_crt_bundle/cacrt_all.pem
# Compile 'blink'
cp -pr /home/esp/idf/examples/get-started/blink /home/esp/blink/
cd /home/esp/blink
. /home/esp/idf/export.sh
idf.py set-target esp32s2
idf.py build
However, the author of TinyUSB (@hathach) has told me that TinyUSB does not (and will not in the forseeable future) do what I need, so I need to use v4.4 of the IDF.
If I erase everything (and clear the environment) …and repeat all the above steps using -b release/v4.4
, the set-target
command fails with:
~/blink $ idf.py set-target esp32s2
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Build directory '/home/esp/blink/build' not found. Nothing to clean.
Executing action: set-target
Set Target to: esp32s2, new sdkconfig created. Existing sdkconfig renamed to sdkconfig.old.
Running cmake in directory /home/esp/blink/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32s2 -DCCACHE_ENABLE=0 /home/esp/blink"...
-- Found Git: /usr/bin/git (found version "2.20.1")
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc
-- Check for working C compiler: /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc
-- Check for working C compiler: /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc -- broken
CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"/home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/esp/blink/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/ninja cmTC_a0212 && [1/2] Building C object CMakeFiles/cmTC_a0212.dir/testCCompiler.c.obj
[2/2] Linking C executable cmTC_a0212
FAILED: cmTC_a0212
: && /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc -mlongcalls CMakeFiles/cmTC_a0212.dir/testCCompiler.c.obj -o cmTC_a0212 && :
/home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../libexec/gcc/xtensa-esp32s2-elf/8.4.0/liblto_plugin.so: error loading plugin: /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../libexec/gcc/xtensa-esp32s2-elf/8.4.0/liblto_plugin.so: cannot open shared object file: No such file or directory
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
/home/esp/idf/tools/cmake/project.cmake:290 (__project)
CMakeLists.txt:8 (project)
-- Configuring incomplete, errors occurred!
See also "/home/esp/blink/build/CMakeFiles/CMakeOutput.log".
See also "/home/esp/blink/build/CMakeFiles/CMakeError.log".
cmake failed with exit code 1
The directory /home/esp/blink/build/CMakeFiles/CMakeTmp
DOES exist:
~/blink $ ls -ald /home/esp/blink/build/CMakeFiles/CMakeTmp
drwxr-xr-x 2 esp esp 4096 Nov 8 21:27 /home/esp/blink/build/CMakeFiles/CMakeTmp
And so does /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../libexec/gcc/xtensa-esp32s2-elf/8.4.0/liblto_plugin.so
:
~/blink $ ls -al /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../libexec/gcc/xtensa-esp32s2-elf/8.4.0/liblto_plugin.so*
lrwxrwxrwx 1 esp esp 22 Nov 8 21:25 /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../libexec/gcc/xtensa-esp32s2-elf/8.4.0/liblto_plugin.so -> liblto_plugin.so.0.0.0
lrwxrwxrwx 1 esp esp 22 Nov 8 21:25 /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../libexec/gcc/xtensa-esp32s2-elf/8.4.0/liblto_plugin.so.0 -> liblto_plugin.so.0.0.0
-rwxr-xr-x 1 esp esp 71508 Oct 15 07:35 /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../libexec/gcc/xtensa-esp32s2-elf/8.4.0/liblto_plugin.so.0.0.0
The log files don’t give me any further clues:
~/blink $ cat build/CMakeFiles/CMakeError.log
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc
Build flags: -mlongcalls
Id flags:
The output was:
1
/home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../libexec/gcc/xtensa-esp32s2-elf/8.4.0/liblto_plugin.so: error loading plugin: /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../libexec/gcc/xtensa-esp32s2-elf/8.4.0/liblto_plugin.so: cannot open shared object file: No such file or directory
collect2: error: ld returned 1 exit status
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-g++
Build flags: -mlongcalls
Id flags:
The output was:
1
/home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../libexec/gcc/xtensa-esp32s2-elf/8.4.0/liblto_plugin.so: error loading plugin: /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../libexec/gcc/xtensa-esp32s2-elf/8.4.0/liblto_plugin.so: cannot open shared object file: No such file or directory
collect2: error: ld returned 1 exit status
Determining if the C compiler works failed with the following output:
Change Dir: /home/esp/blink/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/ninja cmTC_a0212 && [1/2] Building C object CMakeFiles/cmTC_a0212.dir/testCCompiler.c.obj
[2/2] Linking C executable cmTC_a0212
FAILED: cmTC_a0212
: && /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc -mlongcalls CMakeFiles/cmTC_a0212.dir/testCCompiler.c.obj -o cmTC_a0212 && :
/home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../libexec/gcc/xtensa-esp32s2-elf/8.4.0/liblto_plugin.so: error loading plugin: /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../libexec/gcc/xtensa-esp32s2-elf/8.4.0/liblto_plugin.so: cannot open shared object file: No such file or directory
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
~/blink $ cat build/CMakeFiles/CMakeOutput.log
The target system is: Generic - -
The host system is: Linux - 5.10.63-v7l+ - armv7l
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc
Build flags: -mlongcalls
Id flags: -c
The output was:
0
Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.o"
The C compiler identification is GNU, found in "/home/esp/blink/build/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.o"
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: /home/esp/tools/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-g++
Build flags: -mlongcalls
Id flags: -c
The output was:
0
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.o"
The CXX compiler identification is GNU, found in "/home/esp/blink/build/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.o"
Checking whether the ASM compiler is GNU using "--version" matched "(GNU assembler)|(GCC)|(Free Software Foundation)":
xtensa-esp32s2-elf-gcc (crosstool-NG esp-2021r2) 8.4.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The same error happens if I use master
or 4.4-dev
branches, or if I use git
to switch branches from 4.3.1
(as per the official docs) …IE. 4.3.1
is the only version I can get to work - and I need v4.4 for the native USB support!
I’m out of ideas! Can anybody help please?
Thanks, BC
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 33 (3 by maintainers)
Commits related to this issue
- tools: Update 2022r1 toolchain, GCC 11.2.0, Newlib 4.1.0 Closes https://github.com/espressif/esp-idf/issues/7282 Closes https://github.com/espressif/esp-idf/issues/7857 Closes https://git... — committed to espressif/esp-idf by antmak 2 years ago
- tools: Update GCC toolchain to esp-2021r2-patch4 version. Includes GCC 8.4.0, Newlib 3.3.0 Closes https://github.com/espressif/esp-idf/issues/7857 Closes https://github.com/espressif/esp-idf/issues/6... — committed to espressif/esp-idf by antmak 2 years ago
all, the fix for this issue should be available in master soon, i will keep an eye on updates, and post more information soon
My heart goes out to all those waiting for this issue to be fixed. I have shed many a tear and wept daily since discovering this unfortunate problem. This issue is the source of persistent pain and great suffering and it will be a day of great joy and celebration when the issue is resolved.
All the weeping due to this unfortunate issue resulted me having a chronic dehydration condition. However, what I have discovered is that ESP-IDF v4.4 and gcc do appear to work as expected for the ESP32 on a Raspberry Pi 4 if the 64-bit version of Raspberry Pi OS is used. Up until now I had been using the 32-bit version of Raspberry Pi OS as the 64-bit version was still in beta. This is no longer the case and the first non-beta 64-bit version of Raspberry Pi OS was released recently so I gave it a try.
Raspberry Pi OS 64-bit is being used:
ESP-IDF v4.4 is being used:
idf.py build
functions as expected indicating that gcc can compile successfully:idf.py -p /dev/ttyUSB0 flash
functions as expected:idf.py -p /dev/ttyUSB0 monitor
functions as expected:So I am now happy 😄
I guess it’s only the 32-bit Xtensa compilers that are broken the 64-bit compilers appear to work.
Hey @0xjakob, Do you have any update on this issue? Cheers, BC
Hi @RSC-Games ! The new toolchain with ARM*@linux fixes will come to master branch already on these days. Also the fixes will be ported to v4.4, but I’m not sure about ETA
Thank you. After 3 years of waiting, it is good to know that Espressif are “on their way” to releasing a devkit which will unlock the USB features of the chip, and there is “a chance” that it will work 😃
Thank @fivdi, for cheering and guiding us through these dark times. The latest version also works on my Pi after moving to the 64-bit Raspberry PI OS.
However, many of us cannot ditch the 32-bit OS and reinstall everything, at least until their next holiday. Some even have to stay 32-bit for compatibility. I hope that this issue will not be closed until addressed.
I confirm that v4.3.1 (esp-2021r1-8.4.0) works on a Raspberry Pi 3 running Debian 11 (bullseye), while v4.3.2 (stable, uses esp-2021r2-8.4.0) doesn’t work and yields the same issue as above.
Edit: there is no file named liblto_plugin.so in ~/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0. This file seems to be a new dependency in esp-2021r2-8.4.0 (which has liblto_plugin.so but still doesn’t work.)