debugging on ubuntu linux -- how to compile/install python2.7 properly

qubdtq
Posts: 12
Joined: Thu Sep 21, 2023 3:41 am

debugging on ubuntu linux -- how to compile/install python2.7 properly

Postby qubdtq » 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:
/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
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.

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
(I can't do --enable-optimizations because it fails with an error for some reason when it is doing the tests)

Code: Select all

make -j8
sudo make -j8 altinstall
(-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.

herbiejay
Posts: 1
Joined: Tue Oct 29, 2024 9:02 pm

Re: debugging on ubuntu linux -- how to compile/install python2.7 properly

Postby herbiejay » Tue Oct 29, 2024 9:07 pm

After trying to sort this out for way too long in Ubuntu 24.04, using VS Code, I was able to get debugging functioning with an esp32-s3 by installing the libpython3-all-dev and libpython3-all-dbg packages.

qubdtq
Posts: 12
Joined: Thu Sep 21, 2023 3:41 am

Re: debugging on ubuntu linux -- how to compile/install python2.7 properly

Postby qubdtq » Wed Oct 30, 2024 2:51 am

Nice -- were you having the same issue as described above? Did you try the above solution? (Your method is obviously superior; just curious.)

Who is online

Users browsing this forum: jsmith56x, sterisa and 297 guests