debugging on ubuntu linux -- how to compile/install python2.7 properly
Posted: Tue Nov 14, 2023 12:07 am
I'm a beginner, but I thought I would share this in case it helps anyone else that is searching for this info --
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:
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
(I can't do --enable-optimizations because it fails with an error for some reason when it is doing the tests)
(-j8 for an 8-core machine)
--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.
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.