Problem with esp32 debug for Ubuntu. (undefined symbol: _Py_ZeroStruct)

Hi all,

I have Expressif ESP Debug board and ESP32 Dev Module.

I just installed VS Code and Platform IO.

  1. First error.
    undefinedpiogdb: error while loading shared libraries: libncurses.so.5: cannot open
    shared object file: No such file or directory
    undefinedpiogdb: error while loading shared libraries: libtinfo.so.5 : cannot open
    shared object file: No such file or directory

I link some version 6 to version 5 files.

lrwxrwxrwx  1 root root       43 May 11 16:51 libncurses.so.5 -> /usr/lib/x86_64-linux-gnu/libncurses.so.6.2
lrwxrwxrwx  1 root root       41 May 11 16:54 libtinfo.so.5 -> /usr/lib/x86_64-linux-gnu/libtinfo.so.6.2
  1. I get another error when the first two errors are gone.
    undefinedpiogdb: symbol lookup error: piogdb: undefined symbol: _Py_ZeroStruct

Then, I installed libncurses5-dev.

sudo apt-get install libncurses5-dev libncursesw5-dev

It did not help.

Thanks for any suggestion on how to fix this error. Thank you!
Michael

  1. Platform.ini file
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
upload_port = /dev/ttyUSB0
monitor_port = /dev/ttyUSB0
monitor_speed = 9600
debug_tool = esp-prog
debug_init_break = tbreak setup
  1. Debug Console Window
Preparing firmware for debugging...
Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 1.12.1 > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 3.10004.200129 (1.0.4) 
 - tool-esptoolpy 1.20600.0 (2.6.0) 
 - toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 26 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Retrieving maximum program size .pio/build/esp32dev/firmware.elf
Checking size .pio/build/esp32dev/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.7% (used 15436 bytes from 327680 bytes)
Flash: [==        ]  16.5% (used 216777 bytes from 1310720 bytes)
========================= [SUCCESS] Took 3.81 seconds =========================
undefinedpiogdb: symbol lookup error: piogdb: undefined symbol: _Py_ZeroStruct

Did you remove your old symlinks thereafter?

What version of Python do you have installed?

Which version of Ubuntu are you running?

Do you have Anaconda Python installed on the system?

Thank you for helping me. Here are the answers to your questions.

Did you remove your old symlinks thereafter? I removed them today. It doesn’t help.
What version of Python do you have installed? Python 2.7.18rc1 /user/bin/python
Which version of Ubuntu are you running? Ubuntu 20.04 LTS (Just installed from scratch a week ago.)
Do you have Anaconda Python installed on the system? No.

I have also installed Platform IO and set up the debug mode on my Windows 10 PC. It works flawlessly. So, the hardware and software should be working. It may be just some setup issue. I would love to have it running under Ubuntu!

Below shows the details on how I removed the symlink and tried to install version 5.

Yesterday, I created these 3 symlinks for the errors displayed by Platform IO.
sudo ln -s /usr/lib/x86_64-linux-gnu/libncurses.so.6.2 /usr/lib/x86_64-linux-gnu/libncurses.so.5
sudo ln -s /usr/lib/x86_64-linux-gnu/libtinfo.so.6.2 /usr/lib/x86_64-linux-gnu/libtinfo.so.5
sudo ln -s /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0 /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0

Today, I removed these 3 symlinks.
sudo rm libncurses.so.5
sudo rm libtinfo.so.5
sudo rm libpython2.7.so.1.0

I get the same error regarding version 5 again. I have version 6 installed.
undefinedpiogdb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory (taken Platfrom IO Debug Console Window)

I tried to install version 5.
michael@michael-Inspiron-5551:/usr/lib/x86_64-linux-gnu$ sudo apt-get install libncurses5-dev libncursesw5-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
libncurses5-dev is already the newest version (6.2-0ubuntu2).
libncursesw5-dev is already the newest version (6.2-0ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 42 not upgraded.
michael@michael-Inspiron-5551:/usr/lib/x86_64-linux-gnu$

michael@michael-Inspiron-5551:/usr/lib/x86_64-linux-gnu$ ls -ltr libncurses.so*
-rw-r–r-- 1 root root 162024 Feb 25 23:14 libncurses.so.6.2
-rw-r–r-- 1 root root 31 Feb 25 23:14 libncurses.so
lrwxrwxrwx 1 root root 17 May 11 14:16 libncurses.so.6 -> libncurses.so.6.2
michael@michael-Inspiron-5551:/usr/lib/x86_64-linux-gnu$

Version 6.2 is installed. It doesn’t make the errors go away.

Python2 has been deprecated for ages with PlatformIO use. But it also shouldn’t be used here anyways. You also have Python3 of version 3.7.x? (Python 3.8 seems to have problems).

Also make sure that the command

$ cat  $(which piodebuggdb) 
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys

from platformio.__main__ import debug_gdb_main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(debug_gdb_main())

outputs a shebang for python3.

I see. I begin to understand PlatformIO. PlatformIO is written completely in Python language. It relies on Python Interpreter and libraries to work correctly. I need help to run your suggested command and Python code.

cat $(wchich piodebuggdb)

The system executes this commamd, but it does not return. I waited for a long time and had to kill it with control-C. Where should I run this command?

python main.py

raceback (most recent call last):
File “platformIOdebug.py”, line 6, in
from platformio.main import debug_gdb_main
ImportError: No module named platformio.main

It seems that I don’t have platformio module. I am confused that the module should be installed since I already have Platform IO installed. Can you help me on this? Do I need to install python3.7 first for my Linux system?

Thank you,
Michael

Indeed, see GitHub - platformio/platformio-core: Your Gateway to Embedded Software Development Excellence 👽.

That might just indicate that the PIO tools aren’t callable from your CLI because they aren’t in the PATH. The VSCode extension installs PIO in some other directory that’s not in your PATH. This is probably completely separate from your original problem - If you want, you can use the installer script (or sudo -H pip3 install platformio) to install it and then switch the VSCode PIO extension settings to not use the built-in core

What problem are you stuck at now? The ncurses error is gone when you install ncurses6 and symlink it to the ncurses5 names?

After all, the ESP32 debug command should start the xtensa gdb. Are there any errors when directly starting

~/.platformio/packages/toolchain-xtensa/bin/xtensa-lx106-elf-gdb

on the commandline?

Thank you for your reply again. I got the error with ncurses5 back from I deleted the symlink. The ncurses5 installation did nothing because I already have ncurses6.2 installed. I am back to the original issue. I remember I also get an error message about not finding libpython2.7.

I am wondering if I installed VS code correctly. I installed through the graphical snap store. I did see a download package you can use to install VS code. I guess that my problem is not related to VS code but Platfrom IO. Is that correct?

I will try to install PlatfromIO by PIP3. I will check whether I have Python3.7 installed or not. I will let you know how it goes.

Thank you for your patience and knowledge!!!
Michael

I am able to move along with your suggestions. I have completed some steps, but I am unable to get the most important command to run.

I installed Python 3.7 --> python3.7 is the command to invoke.
I installed pip3
I installed Platorm IO with sudo -H pip3 install platformio command
I changed the setting to not use the built in core.

I could not get this command to run. I can’t find the gdb file. I don’t know where platformio is installed.
~/.platformio/packages/toolchain-xtensa/bin/xtensa-lx106-elf-gdb

I need some help to test whether I can errors when directly starting the debug command directly.
Michael

This will only be there when the toolchain is installed. Make sure to first create some random ESP32 project and compile it, that will cause the toolchain to be compiled. And ~/ your home folder, aka /home/<user>/.platformio/... etc.

You can also do that from the cmd line:

mkdir test_prj
cd test_prj
pio init -b esp32dev
pio run 

(will not compile without source files but will download the toolchain).

Hi Max,

Thank you for your instructions. I have successfully built a simple LED blink project and uploaded iinto my ESP32 Dev board using the command lines.

Create New Project

mkdir test_prj
cd test_prj
pio init -b esp32dev
cp main.cpp /src
pio run 

Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.7% (used 15348 bytes from 327680 bytes)
Flash: [==        ]  16.1% (used 210925 bytes from 1310720 bytes)
esptool.py v2.6
===================================== [SUCCESS] Took 19.05 seconds
pio run --target upload

---------------------------------------------------------------------------------------------------------
Writing at 0x00024000... (85 %)
Writing at 0x00028000... (100 %)
Leaving...
Hard resetting via RTS pin...
====================================== [SUCCESS] Took 7.92 seconds 

[LED is blinking!]

Test GDB file

michael@michael-Inspiron-5551:~/.platformio/packages/toolchain-xtensa32/bin$ ls *gdb
xtensa-esp32-elf-gdb  

michael@michael-Inspiron-5551:~/.platformio/packages/toolchain-xtensa32/bin$ ./xtensa-esp32-elf-gdb

/xtensa-esp32-elf-gdb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

michael@michael-Inspiron-5551:~/test_prj$ ~/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb
/home/michael/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

It turns out that the path and gdb file names have been changed. I am able to find the gdb file and run it. I get the same libncurses.so.5 error.

So, it fails to run outside VS Code Editor.

Michael

The upload method used in PIO / VSCode was the serial bootloader by default, and that doesn’t involve GDB, so there’s no difference in behaviour out- or inside VSCode.

The FAQ suggests replacing binaries which I don’t think is really good. I don’t get why Ubuntu provides libncurses5 (and libtinfo5, libncursesw5) when all they do is install the libncurses6 version of it. That defeats the purposes of having these packets… I’ll try in a VM to see what’s going on there.

Thank you.

I am studying Libncurses.so.5 because I don’t even know what it is for and what it does.

I found this link that someone has successfully installed Libncurses5 on Mint Linux. So, I was hopeful that the solution would work on Ubuntu. So far, it does not wrok on Ubuntu. I am surprised why the GDB tool is not flexible enough to use the latest version 6.

At the same time, I am very happy that I am very close to getting Platform IO tools to work on Ubuntu. It can build, monitor, upload via \TTY\ USB0 and upload via OTA method (ip address). It will be perfect if GDB works. GDB is very important to have.

Thank you for all your help.
Michael

Tech Explorer!

Indeed Ubuntu 20 support seems to lacking / hacky right now. I installed a fresh Ubuntu 20.04 LTS in a VM. Even got an install error in VSCode which was solvable though. The problem with the xtensa-esp32-elf-gdb is however reproducable:

max@max-VirtualBox:~/.platformio/packages/toolchain-xtensa32/bin$ ldd xtensa-esp32-elf-gdb 
	linux-vdso.so.1 (0x00007ffdc2af0000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fed2a94f000)
	libncurses.so.5 => not found
	libtinfo.so.5 => not found
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fed2a800000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fed2a7dd000)
	libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fed2a7d8000)
	libpython2.7.so.1.0 => not found
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fed2a5e4000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fed2a968000)

So it’s missing libncurses.so.5, libtinfo.so.5 and libpython2.7.so.1.0.

With the default ncurses state

$ ls -la /usr/lib/x86_64-linux-gnu/libncurses*
lrwxrwxrwx 1 root root     17 Mai 22 00:02 /usr/lib/x86_64-linux-gnu/libncurses.so.6 -> libncurses.so.6.2
-rw-r--r-- 1 root root 162024 Feb 26 08:14 /usr/lib/x86_64-linux-gnu/libncurses.so.6.2
lrwxrwxrwx 1 root root     18 Mai 22 00:02 /usr/lib/x86_64-linux-gnu/libncursesw.so.6 -> libncursesw.so.6.2
-rw-r--r-- 1 root root 231504 Feb 26 08:14 /usr/lib/x86_64-linux-gnu/libncursesw.so.6.2

I did the following:

sudo apt install libncurses5 libtinfo5 libncursesw5 python2.7 libpython2.7

Which fixes all library errors in ldd for me:

max@max-VirtualBox:~/.platformio/packages/toolchain-xtensa32/bin$ ldd xtensa-esp32-elf-gdb 
	linux-vdso.so.1 (0x00007ffc35fb0000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7d04d52000)
	libncurses.so.5 => /lib/x86_64-linux-gnu/libncurses.so.5 (0x00007f7d04d2c000)
	libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f7d04cfe000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7d04baf000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7d04b8c000)
	libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f7d04b87000)
	libpython2.7.so.1.0 => /lib/x86_64-linux-gnu/libpython2.7.so.1.0 (0x00007f7d04819000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7d04627000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f7d04d6b000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f7d0460b000)

And GDB starts up:

max@max-VirtualBox:~/.platformio/packages/toolchain-xtensa32/bin$ ./xtensa-esp32-elf-gdb 
GNU gdb (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) 

Now the question is: Why in the world doesn’t this work for you when you do the same thing?

Can you:

  • remove all previous symlink hacks regarding ncurses5
  • the output of ldd ~/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb
  • the output of sudo apt install libncurses5 libtinfo5 libncursesw5 python2.7 libpython2.7
  • again the output of the ldd command
1 Like

Hi Max,

Thank you so much for all your great effort. I am able to get the same result as you do. GDB can run from the command line. Now, I go back to VS Code and run the debugger within VS Code. Those old errors do not appear anymore. I am getting closer now.

Now, GDB can go further. It stopped when it failed to find my ESP debugger board (/tty/USB1 or /tty/USB2) with a different type of errors.

Checking size .pio/build/esp32dev/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.7% (used 15436 bytes from 327680 bytes)
Flash: [==        ]  16.5% (used 216777 bytes from 1310720 bytes)
========================= [SUCCESS] Took 3.03 seconds =========================
Reading symbols from /home/michael/Documents/PlatformIO/Projects/Serial_Monitor_test/.pio/build/esp32dev/firmware.elf...
done.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = esp-prog
PlatformIO: Initializing remote target...
Open On-Chip Debugger  v0.10.0-esp32-20190708 (2019-07-08-11:03)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 20000 kHz
Info : Configured 2 cores
esp32 interrupt mask on
Info : tcl server disabled
Info : telnet server disabled
**Error: libusb_open() failed with LIBUSB_ERROR_ACCESS**
**Error: no device found**
**Error: unable to open ftdi device with vid 0403, pid 6010, description '*', serial '*' at bus location '*'**

Warn : Flash driver of esp32.flash does not support free_driver_priv()
Warn : Flash driver of irom does not support free_driver_priv()
Warn : Flash driver of drom does not support free_driver_priv()
.pioinit:11: Error in sourced command file:

My platform.ini file:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
upload_port = /dev/ttyUSB0
monitor_port = /dev/ttyUSB0
monitor_speed = 9600
debug_tool = esp-prog
debug_init_break = tbreak setup

===========================================================================

Here is the log for installing the library per your instructions.

michael@michael-Inspiron-5551:/usr/lib/x86_64-linux-gnu$ ls *.5*
libasan.so.5                libgs.so.9.50                        libply.so.5.0.0
libasan.so.5.0.0            libhogweed.so.5                      libply-splash-core.so.5
libatasmart.so.4.0.5        libhogweed.so.5.0                    libply-splash-core.so.5.0.0
libavahi-common.so.3.5.3    libhx509.so.5                        libply-splash-graphics.so.5
libcanberra.so.0.2.5        libhx509.so.5.0.0                    libply-splash-graphics.so.5.0.0
libcmis-0.5.so.5            libibus-1.0.so.5                     libpsl.so.5
libcmis-0.5.so.5.0.0        libibus-1.0.so.5.0.522               libpsl.so.5.3.2
libcmis-c-0.5.so.5          libjavascriptcoregtk-4.0.so.18.16.5  libpulse-mainloop-glib.so.0.0.5
libcmis-c-0.5.so.5.0.0      libkmod.so.2.3.5                     libqmi-glib.so.5
libcolordprivate.so.2.0.5   liblzma.so.5                         libqmi-glib.so.5.6.0
libcolord.so.2.0.5          liblzma.so.5.2.4                     libsensors.so.5
libcolorhug.so.2.0.5        libmm-glib.so.0.5.0                  libsensors.so.5.0.0
libcryptsetup.so.12.5.0     libnautilus-extension.so.1.5.0       libsmbclient.so.0.5.0
libdaemon.so.0.5.0          libnewt.so.0.52                      libspeexdsp.so.1.5.0
libdatrie.so.1.3.5          libnewt.so.0.52.21                   libspeex.so.1.5.0
libfftw3f_omp.so.3.5.8      libperl.so.5.30                      libsuitesparseconfig.so.5
libfftw3f.so.3.5.8          libperl.so.5.30.0                    libsuitesparseconfig.so.5.7.1
libfftw3f_threads.so.3.5.8  libpipeline.so.1.5.2                 libteamdctl.so.0.1.5
libgcrypt.so.20.2.5         libply-boot-client.so.5              libtiff.so.5
libgdata.so.22.5.1          libply-boot-client.so.5.0.0          libtiff.so.5.5.0
libgd.so.3.0.5              libply.so.5                          libxatracker.so.2.5.0
michael@michael-Inspiron-5551:/usr/lib/x86_64-linux-gnu$ ls *.6*
libapparmor.so.1.6.1        libicuio.so.66                  libSM.so.6
libapt-pkg.so.6.0           libicuio.so.66.1                libSM.so.6.0.1
libapt-pkg.so.6.0.0         libicutest.so.66                libspeechd.so.2.6.0
libatkmm-1.6.so.1           libicutest.so.66.1              libsqlite3.so.0.8.6
libatkmm-1.6.so.1.1.0       libicutu.so.66                  libstdc++.so.6
libcamel-1.2.so.62          libicutu.so.66.1                libstdc++.so.6.0.28
libcamel-1.2.so.62.0.0      libicuuc.so.66                  libtasn1.so.6
libcbor.so.0.6              libicuuc.so.66.1                libtasn1.so.6.6.0
libcbor.so.0.6.0            libidn2.so.0.3.6                libtic.so.6
libcdr-0.1.so.1.0.6         libidn.so.11.6.16               libtic.so.6.2
libcolamd.so.2.9.6          libimobiledevice.so.6           libtinfo.so.6
libc.so.6                   libimobiledevice.so.6.0.0       libtinfo.so.6.2
libcurl-gnutls.so.4.6.0     libkpathsea.so.6                libuchardet.so.0.0.6
libcurl.so.4.6.0            libkpathsea.so.6.3.1            libudev.so.1.6.17
libdjvulibre.so.21.6.0      libksba.so.8.11.6               libusbmuxd.so.6
libedit.so.2.0.63           liblirc_client.so.0.6.0         libusbmuxd.so.6.0.0
libexpat.so.1.6.11          libmenu.so.6                    libvpx.so.6
libexpatw.so.1.6.11         libmenu.so.6.2                  libvpx.so.6.2
libform.so.6                libmenuw.so.6                   libvpx.so.6.2.0
libform.so.6.2              libmenuw.so.6.2                 libvte-2.91.so.0.6000.1
libformw.so.6               libmozjs-68.so.68               libwacom.so.2.6.1
libformw.so.6.2             libmozjs-68.so.68.6.0           libwebp.so.6
libfreetype.so.6            libmpfr.so.6                    libwebp.so.6.0.2
libfreetype.so.6.17.1       libmpfr.so.6.0.2                libwrap.so.0.7.6
libgdbm.so.6                libm.so.6                       libX11.so.6
libgdbm.so.6.0.0            libncurses.so.6                 libX11.so.6.3.0
libgee-0.8.so.2.6.1         libncurses.so.6.2               libXau.so.6
libgio-2.0.so.0.6400.2      libncursesw.so.6                libXau.so.6.0.0
libglib-2.0.so.0.6400.2     libncursesw.so.6.2              libXdmcp.so.6
libgmodule-2.0.so.0.6400.2  libpanel.so.6                   libXdmcp.so.6.0.0
libgobject-2.0.so.0.6400.2  libpanel.so.6.2                 libXext.so.6
libgpgmepp.so.6             libpanelw.so.6                  libXext.so.6.4.0
libgpgmepp.so.6.10.0        libpanelw.so.6.2                libXi.so.6
libgphoto2.so.6             libpci.so.3.6.4                 libXi.so.6.1.0
libgphoto2.so.6.1.0         libqmi-glib.so.5.6.0            libXmu.so.6
libgthread-2.0.so.0.6400.2  librygel-core-2.6.so.2          libXmu.so.6.2.0
libhpmud.so.0.0.6           librygel-core-2.6.so.2.0.4      libXt.so.6
libICE.so.6                 librygel-db-2.6.so.2            libXt.so.6.0.0
libICE.so.6.3.0             librygel-db-2.6.so.2.0.4        libXtst.so.6
libicudata.so.66            librygel-renderer-2.6.so.2      libXtst.so.6.1.0
libicudata.so.66.1          librygel-renderer-2.6.so.2.0.4  libyaml-0.so.2.0.6
libicui18n.so.66            librygel-server-2.6.so.2
libicui18n.so.66.1          librygel-server-2.6.so.2.0.4

rygel-2.6:
engines  plugins
michael@michael-Inspiron-5551:/usr/lib/x86_64-linux-gnu$ ldd ~/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb
	linux-vdso.so.1 (0x00007ffec31fe000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb674584000)
	libncurses.so.5 => not found
	libtinfo.so.5 => not found
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb674435000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb674412000)
	libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fb67440d000)
	libpython2.7.so.1.0 => not found
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb674219000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fb67459d000)
michael@michael-Inspiron-5551:/usr/lib/x86_64-linux-gnu$ sudo apt install libncurses5 libtinfo5 libncursesw5 python2.7 libpython2.7
[sudo] password for michael: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python2.7 is already the newest version (2.7.18~rc1-2).
python2.7 set to manually installed.
The following packages were automatically installed and are no longer required:
  linux-headers-5.4.0-26 linux-headers-5.4.0-26-generic linux-image-5.4.0-26-generic
  linux-modules-5.4.0-26-generic linux-modules-extra-5.4.0-26-generic
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  libncurses5 libncursesw5 libpython2.7 libtinfo5
0 upgraded, 4 newly installed, 0 to remove and 68 not upgraded.
Need to get 1,334 kB of archives.
After this operation, 4,746 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 libtinfo5 amd64 6.2-0ubuntu2 [83.0 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 libncurses5 amd64 6.2-0ubuntu2 [96.9 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 libncursesw5 amd64 6.2-0ubuntu2 [119 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 libpython2.7 amd64 2.7.18~rc1-2 [1,036 kB]
Fetched 1,334 kB in 1s (1,449 kB/s)     
Selecting previously unselected package libtinfo5:amd64.
(Reading database ... 223266 files and directories currently installed.)
Preparing to unpack .../libtinfo5_6.2-0ubuntu2_amd64.deb ...
Unpacking libtinfo5:amd64 (6.2-0ubuntu2) ...
Selecting previously unselected package libncurses5:amd64.
Preparing to unpack .../libncurses5_6.2-0ubuntu2_amd64.deb ...
Unpacking libncurses5:amd64 (6.2-0ubuntu2) ...
Selecting previously unselected package libncursesw5:amd64.
Preparing to unpack .../libncursesw5_6.2-0ubuntu2_amd64.deb ...
Unpacking libncursesw5:amd64 (6.2-0ubuntu2) ...
Selecting previously unselected package libpython2.7:amd64.
Preparing to unpack .../libpython2.7_2.7.18~rc1-2_amd64.deb ...
Unpacking libpython2.7:amd64 (2.7.18~rc1-2) ...
Setting up libpython2.7:amd64 (2.7.18~rc1-2) ...
Setting up libtinfo5:amd64 (6.2-0ubuntu2) ...
Setting up libncurses5:amd64 (6.2-0ubuntu2) ...
Setting up libncursesw5:amd64 (6.2-0ubuntu2) ...
Processing triggers for libc-bin (2.31-0ubuntu9) ...
michael@michael-Inspiron-5551:/usr/lib/x86_64-linux-gnu$ ldd ~/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb
	linux-vdso.so.1 (0x00007ffcc8967000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f006fa89000)
	libncurses.so.5 => /lib/x86_64-linux-gnu/libncurses.so.5 (0x00007f006fa63000)
	libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f006fa35000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f006f8e6000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f006f8c3000)
	libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f006f8be000)
	libpython2.7.so.1.0 => /lib/x86_64-linux-gnu/libpython2.7.so.1.0 (0x00007f006f550000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f006f35e000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f006faa2000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f006f342000)
michael@michael-Inspiron-5551:/usr/lib/x86_64-linux-gnu$ cd ~/.platformio/packages/toolchain-xtensa32/bin
michael@michael-Inspiron-5551:~/.platformio/packages/toolchain-xtensa32/bin$ ls
xtensa-esp32-elf-addr2line     xtensa-esp32-elf-gcc         xtensa-esp32-elf-ld.bfd
xtensa-esp32-elf-ar            xtensa-esp32-elf-gcc-5.2.0   xtensa-esp32-elf-nm
xtensa-esp32-elf-as            xtensa-esp32-elf-gcc-ar      xtensa-esp32-elf-objcopy
xtensa-esp32-elf-c++           xtensa-esp32-elf-gcc-nm      xtensa-esp32-elf-objdump
xtensa-esp32-elf-cc            xtensa-esp32-elf-gcc-ranlib  xtensa-esp32-elf-ranlib
xtensa-esp32-elf-c++filt       xtensa-esp32-elf-gcov        xtensa-esp32-elf-readelf
xtensa-esp32-elf-cpp           xtensa-esp32-elf-gcov-tool   xtensa-esp32-elf-size
xtensa-esp32-elf-ct-ng.config  xtensa-esp32-elf-gdb         xtensa-esp32-elf-strings
xtensa-esp32-elf-elfedit       xtensa-esp32-elf-gprof       xtensa-esp32-elf-strip
xtensa-esp32-elf-g++           xtensa-esp32-elf-ld
michael@michael-Inspiron-5551:~/.platformio/packages/toolchain-xtensa32/bin$ ./xtensa-esp32-elf-gdb
GNU gdb (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb)
1 Like

Hi Max,

Thank you for your awesome help on the _Py_ZeroStruc and lib ver5 errors. Now, the new problem with the driver not found deserves to have a new post on the forum. I am making a new post for the new error now. Other people will know that I am having a different problem.

I have marked your suggestion as the solution. So, you are credited for finding the solution!!!

Best regards,
Michael

1 Like

It seems latest ubuntu is using ncurses6 and apt-get installs ncurses6 even if ncurses5 is meant to be installed. Try this.

sudo add-apt-repository universe
sudo apt-get install libncurses5
sudo apt-get install libncursessw5

I checked libncurses5 are installed as below.

lrwxrwxrwx 1 root root 17 2월 26 16:14 libncurses.so.5 -> libncurses.so.5.9
-rw-r–r-- 1 root root 149736 2월 26 16:14 libncurses.so.5.9
lrwxrwxrwx 1 root root 17 7월 31 23:09 libncurses.so.6 -> libncurses.so.6.2
-rw-r–r-- 1 root root 162024 2월 26 16:14 libncurses.so.6.2
lrwxrwxrwx 1 root root 18 2월 26 16:14 libncursesw.so.5 -> libncursesw.so.5.9
-rw-r–r-- 1 root root 198736 2월 26 16:14 libncursesw.so.5.9
lrwxrwxrwx 1 root root 18 7월 31 23:09 libncursesw.so.6 -> libncursesw.so.6.2
-rw-r–r-- 1 root root 231504 2월 26 16:14 libncursesw.so.6.2

My problem is I still see error for libncursesw.so.5 is missing for PIO debug.

Hi Jmin,

Yeah. It is frustrating to see that problem again.

Max and I have spent much time to install the debugger. We finally got to run. Unfortunately, I have learned that the debugger is very unstable with Linux. I went back to do all my debugging on Window 10 platform only.

I think that the PIO team needs to be informed about the issue. Hope they can fix the underlying issues.

I suggest running the debugger on other platforms (like Window 10) for your projects if you can.

Best,
Michael

lsb_release -a output please?

libncursesw.so.5 seems to be there on your computer though… is it also for the xtensa32 gdb debugger?

Hi Max,

I was telling Jmin that the debugger for esp32 has been unstable lately. Hope you find something new with Jimin. I would be happy to show you the error messages (when I run the debugger) if you’d like to know.

Thank you for your frequent help on this forum!

Best,
Michael

Hi Max,

I actually use Mint 20 as below. When I checked ubuntu, ubuntu 18 was using version 6.

|Distributor ID:|Linuxmint||—|---|
|Description:|Linux Mint 20|
|Release:|20|
|Codename:|ulyana|

Yeah… libncurses.so.5 is there but I see such error. I’m trying to debug a risc-v board from sipeed.