I could not start the debugger for my ESP32 board (ESP32-DevKitC-VIE) in VSCode/Platform IO -- I got an error in the debug console. If I directly run ~/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gdb, I get an error saying that python2.7.so.1.0 can not be found:
Apparently this is because python2.7 is required, but it is not installed. There are no python2 packages in the Ubuntu repositories anymore, so the standard advice of "apt-get install python2.7-dev" does not work./home/myusername/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gdb: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
After hours of working on this, I came to this procedure:
- download .tgz from https://www.python.org/downloads/release/python-2718/
- untar, enter python directory
Code: Select all
./configure --enable-shared --enable-unicode=ucs4
Code: Select all
make -j8
sudo make -j8 altinstall
--enable-unicode is necessary to prevent the error "symbol lookup error: /home/myusername/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gdb: undefined symbol: PyUnicodeUCS4_FromEncodedObject"
--enable-optimizations is usually recommended, but the tests that it triggers would cause the make to hang forever with an error.
After doing that, the xtensa-esp32-elf-gdb command runs OK. I'm not 100% sure this is all proper and that there will be no problems, but it seems OK so far.