Error compiling examples on Raspbian OS

jhubbardsf
Posts: 21
Joined: Wed Oct 30, 2019 5:17 am

Error compiling examples on Raspbian OS

Postby jhubbardsf » Sun Nov 17, 2019 11:02 pm

I need the esp_prov.py tool to help debug and test my BLE provisioning configuration. Because it doesn't work on OSX I thought my best option was dual booting my Macbook with Ubuntu. While I got that working, it's not ideal for my workflow to have to switch to Ubuntu when testing one small section of the code. So I decided to try to configure my raspberry pi 3 b+ as a dev environment.

I got everything installed (I have the exact commands I ran after flashing if they'd be helpful). esp_prov.py tool works great but I'd also like to be able to build the device images and flash it. Then I could remotely build and flash my device without needing to carry it around. If there's a better workflow I'm open to hearing it, but right now I'm trying to debug this:

pi@yeetbox-dev:~/esp/provisioning_examples/manager $ idf.py menuconfig
Executing action: menuconfig
Running cmake in directory /home/pi/esp/provisioning_examples/manager/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 --warn-uninitialized -DCCACHE_ENABLE=0 /home/pi/esp/provisioning_examples/manager"...
Warn about uninitialized values.
-- Found Git: /usr/bin/git (found version "2.20.1")
-- IDF_TARGET not set, using default target: esp32
-- The C compiler identification is unknown
-- The CXX compiler identification is GNU 8.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/pi/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /home/pi/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /home/pi/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -- broken
CMake Error at /usr/share/cmake-3.13/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler

"/home/pi/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /home/pi/esp/provisioning_examples/manager/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/ninja" "cmTC_84c7d"
[1/2] Building C object CMakeFiles/cmTC_84c7d.dir/testCCompiler.c.obj
FAILED: CMakeFiles/cmTC_84c7d.dir/testCCompiler.c.obj
/home/pi/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -mlongcalls -Wno-frame-address -o CMakeFiles/cmTC_84c7d.dir/testCCompiler.c.obj -c testCCompiler.c
xtensa-esp32-elf-gcc: internal compiler error: Segmentation fault signal terminated program cc1
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
ninja: build stopped: subcommand failed.




CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
/home/pi/esp/esp-idf/tools/cmake/project.cmake:269 (__project)
CMakeLists.txt:7 (project)


-- Configuring incomplete, errors occurred!
See also "/home/pi/esp/provisioning_examples/manager/build/CMakeFiles/CMakeOutput.log".
See also "/home/pi/esp/provisioning_examples/manager/build/CMakeFiles/CMakeError.log".
cmake failed with exit code 1

I've attached the two log files. I'm trying to get this working but I figured someone else might have already come across this (more eyes on a problem the faster it gets solved). So if anyone can help me I'd appreciate it. Thanks.

Edit 1: Looking at "ninja: error: loading 'build.ninja': No such file or directory" it seems obvious it's ninja. When running "/usr/bin/ninja cmTC_84c7d" I get "ninja: error: loading 'build.ninja': No such file or directory." So I'm going to see if that's the right area to look in.

Edit 2: These are the packages installed on the raspbian OS in alphabetical order (otherwise fresh install): bison ccache cmake curl flex git gperf libffi-dev libncurses-dev libssl-dev ninja-build python python-click python-cryptography python-future python-pip python-pyelftools python-pyparsing python-serial python-setuptools vim wget
Attachments
CMakeOutput.log
(975 Bytes) Downloaded 461 times
CMakeError.log
(4.92 KiB) Downloaded 464 times

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Error compiling examples on Raspbian OS

Postby WiFive » Sun Nov 17, 2019 11:28 pm

Are you sure you have the linux-armel tools installed? What does

Code: Select all

file xtensa-esp32-elf-gcc
say

jhubbardsf
Posts: 21
Joined: Wed Oct 30, 2019 5:17 am

Re: Error compiling examples on Raspbian OS

Postby jhubbardsf » Sun Nov 17, 2019 11:48 pm

Code: Select all

xtensa-esp32-elf-gcc: cannot open `xtensa-esp32-elf-gcc' (No such file or directory)
So I checked ~/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin and sure enough it's there.

Code: Select all

file ~/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
That outputs

Code: Select all

/home/pi/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, for GNU/Linux 3.2.0, BuildID[sha1]=73c5a495ed0b07b76586389b4a57ba8ae5fd9053, stripped
I've run ~/esp/esp-idf/export.sh and even "export PATH=$PATH:/home/pi/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin". Whereis can find it so I guess file doesn't look in path. But it is there.

Edit 1: Just to update on everything being done to debug it. I had thought it was a ninja issue so I removed the ninja-build installed from apt. Downloads the ninja git repo to ~/, run a ./configure.py --bootstrap and then export PATH=$PATH:/home/pi/ninja. Exact same error. I'm sure that was a deadend from the start. I'm new to this kind of programming so reading the debug statements is a little harder for me right now.

jhubbardsf
Posts: 21
Joined: Wed Oct 30, 2019 5:17 am

Re: Error compiling examples on Raspbian OS

Postby jhubbardsf » Mon Nov 18, 2019 2:17 am

Update: Started from scratch and edited my notes a little and I moved past the last error (not positive what fixed it this time, I did a few changes - probably should have done them one by one to help people). But I'm still getting an error.

Now menuconfig works but "idf.py app" results in this

Code: Select all

pi@raspberrypi:~/esp/hello_world$ idf.py app
Executing action: app
Running ninja in directory /home/pi/esp/hello_world/build
Executing "ninja app"...
[5/842] Building C object esp-idf/driver/CMakeFiles/__idf_driver.dir/gpio.c.obj
FAILED: esp-idf/driver/CMakeFiles/__idf_driver.dir/gpio.c.obj
/home/pi/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc  -Iconfig -I/home/pi/esp/esp-idf/components/driver/include -I/home/pi/esp/esp-idf/components/driver/include/driver -I/home/pi/esp/esp-idf/components/newlib/platform_include -I/home/pi/esp/esp-idf/components/freertos/include -I/home/pi/esp/esp-idf/components/heap/include -I/home/pi/esp/esp-idf/components/log/include -I/home/pi/esp/esp-idf/components/soc/esp32/include -I/home/pi/esp/esp-idf/components/soc/include -I/home/pi/esp/esp-idf/components/esp_rom/include -I/home/pi/esp/esp-idf/components/esp_common/include -I/home/pi/esp/esp-idf/components/xtensa/include -I/home/pi/esp/esp-idf/components/xtensa/esp32/include -I/home/pi/esp/esp-idf/components/esp32/include -I/home/pi/esp/esp-idf/components/esp_ringbuf/include -I/home/pi/esp/esp-idf/components/esp_event/include -I/home/pi/esp/esp-idf/components/tcpip_adapter/include -I/home/pi/esp/esp-idf/components/lwip/include/apps -I/home/pi/esp/esp-idf/components/lwip/include/apps/sntp -I/home/pi/esp/esp-idf/components/lwip/lwip/src/include -I/home/pi/esp/esp-idf/components/lwip/port/esp32/include -I/home/pi/esp/esp-idf/components/lwip/port/esp32/include/arch -I/home/pi/esp/esp-idf/components/vfs/include -I/home/pi/esp/esp-idf/components/esp_wifi/include -I/home/pi/esp/esp-idf/components/esp_wifi/esp32/include -I/home/pi/esp/esp-idf/components/esp_eth/include -I/home/pi/esp/esp-idf/components/efuse/include -I/home/pi/esp/esp-idf/components/efuse/esp32/include -I/home/pi/esp/esp-idf/components/app_trace/include -mlongcalls -Wno-frame-address   -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -nostdlib -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -Og -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v4.1-dev-997-gd57890cdf-dirty\" -DGCC_NOT_5_2_0 -DESP_PLATFORM -MD -MT esp-idf/driver/CMakeFiles/__idf_driver.dir/gpio.c.obj -MF esp-idf/driver/CMakeFiles/__idf_driver.dir/gpio.c.obj.d -o esp-idf/driver/CMakeFiles/__idf_driver.dir/gpio.c.obj   -c /home/pi/esp/esp-idf/components/driver/gpio.c
xtensa-esp32-elf-gcc: internal compiler error: Segmentation fault signal terminated program cc1
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
[10/842] Building C object esp-idf/esp_ringbuf/CMakeFiles/__idf_esp_ringbuf.dir/ringbuf.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1


jhubbardsf
Posts: 21
Joined: Wed Oct 30, 2019 5:17 am

Re: Error compiling examples on Raspbian OS

Postby jhubbardsf » Mon Nov 18, 2019 4:34 am

That looks like a promising lead. I'll test it out and report back. Thank you.

Claus-8745
Posts: 1
Joined: Thu Dec 26, 2019 8:18 pm

Re: Error compiling examples on Raspbian OS

Postby Claus-8745 » Thu Dec 26, 2019 8:29 pm

I am just deploying the esp32 IDF in my RPi4 Buster environment. I am also experiencing this segmentation error.

With regard to the link https://stackoverflow.com/questions/482 ... spberry-pi

... somebody knows, where the "make -j4" is hidden in the esp32 IDF template files ?

Any hint is appreciated.

Thanks in advance!

RobLatour
Posts: 12
Joined: Mon Dec 30, 2019 4:23 am

Re: Error compiling examples on Raspbian OS

Postby RobLatour » Mon Dec 30, 2019 4:28 am

I found a solution to this on github at https://github.com/esphome/issues/issues/677 , which was to update the raspberry pi's firmware

sudo rpi-update and a reboot the system

This resolved the problem for me.

But a couple days later I did a
sudo apt-get update
sudo apg-get upgrade

and the problem has returned :-(

Who is online

Users browsing this forum: No registered users and 295 guests