Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp32: Undocumented dependency of libpython2 #39212

Closed
adalava opened this issue Oct 6, 2021 · 7 comments
Closed

esp32: Undocumented dependency of libpython2 #39212

adalava opened this issue Oct 6, 2021 · 7 comments
Assignees
Labels
area: Build System bug The issue is a bug, or the PR is fixing a bug platform: ESP32 Espressif ESP32 priority: low Low impact/importance bug Stale

Comments

@adalava
Copy link
Contributor

adalava commented Oct 6, 2021

The following error message is seen when building esp32 on a system without python2 installed:

/home/alfredoj/.espressif/tools/zephyr/xtensa-esp32-elf/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
I think it's undocumented dependency, but depends on python3 instead would be nice, if possible.

Fix/workaround: sudo apt install libpython2.7

To Reproduce

  1. Fresh install Ubuntu 20.04
  2. Install zephyr
  3. Install espressif tools https://docs.zephyrproject.org/latest/boards/xtensa/esp32/doc/index.html
  4. Run: west build -b esp32 samples/hello_world

Expected behavior
Run without errors. The gdb console should appear when executing /home/alfredoj/.espressif/tools/zephyr/xtensa-esp32-elf/bin/xtensa-esp32-elf-gdb

Impact
gdb debugger not working.
Environment (please complete the following information):

  • OS: Ubuntu 20.04
  • Toolchain: espressif
  • 4dedae5
@adalava adalava added the bug The issue is a bug, or the PR is fixing a bug label Oct 6, 2021
@b0661
Copy link
Collaborator

b0661 commented Oct 6, 2021

Adding -DPYTHON=${PYTHON_EXECUTABLE} before here

-DPYTHON_DEPS_CHECKED=1
made it work in my Ubuntu 20.04 environment.

There is no real dependency on Python2. It perfectly works with Python3.

@sylvioalves sylvioalves self-assigned this Oct 7, 2021
@carlescufi
Copy link
Member

That's a bit strange, maybe you need something like this somewhere else?
#38749

@sylvioalves
Copy link
Collaborator

sylvioalves commented Oct 7, 2021

@adalava, it is not clear to me yet whether this error occurs during west build or when executing xtensa-esp32-elf-gdb manually. What is the correct case?
In case you are debugging it manually, would you try this? #38557
After flashing, just run west debug and it shall run gdb.

@adalava
Copy link
Contributor Author

adalava commented Oct 7, 2021

@adalava, it is not clear to me yet whether this error occurs during west build or when executing xtensa-esp32-elf-gdb manually. What is the correct case? In case you are debugging it manually, would you try this? #38557 After flashing, just run west debug and it shall run gdb.

Hi @sylvioalves, the error occurs on both cases (west build and executing xtensa-esp32-elf-gdb manually). On west build it's seen during first build (cmake step, I remove the build folder to reproduce again), but build continues normally. I don't think #38557 is related to this specific problem since the libpython2.7.so.1.0 library is missing on the system and gdb binary isn't being loaded.

If you look at binary, it's linked against libpython2.7.so.1, so I'm guessing your machine has at least libpython2 installed. Here's the ldd output:

# removed libpython2 with: sudo apt remove libpython2.7

$ ldd /home/alfredoj/.espressif/tools/zephyr/xtensa-esp32-elf/bin/xtensa-esp32-elf-gdb
	linux-vdso.so.1 (0x00007ffcec9a7000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9a275be000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9a2759b000)
	libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f9a27596000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9a27447000)
	libpython2.7.so.1.0 => not found
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9a27255000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f9a275da000)

@sylvioalves
Copy link
Collaborator

sylvioalves commented Oct 7, 2021

I have the same env as you (no python 2.7 related tools):

sylvio@pc:~/projects/espressif/zephyr/zephyr$ ldd ~/.espressif/tools/zephyr/xtensa-esp32-elf/bin/xtensa-esp32-elf-gdb
	linux-vdso.so.1 (0x00007ffcba97a000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe55b621000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe55b5fe000)
	libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fe55b5f9000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe55b4aa000)
	libpython2.7.so.1.0 => not found
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe55b2b8000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fe55b647000)

but no issues when building. So I am wondering what would be the diff right now.

Editing: west build works fine. GDB debugging fails due to missing 2.7. I'll document and/or update the toolchain.

@adalava
Copy link
Contributor Author

adalava commented Oct 7, 2021

Thanks!
You can see the error message during west build bellow, right after "-- Found toolchain:", but yes, the build works fine.

$ rm -rf build/
$ west build -b esp32 samples/hello_world
-- west build: generating a build system
Including boilerplate (Zephyr base): /home/alfredoj/zephyrproject/zephyr/cmake/app/boilerplate.cmake
-- Application: /home/alfredoj/zephyrproject/zephyr/samples/hello_world
-- Zephyr version: 2.7.99 (/home/alfredoj/zephyrproject/zephyr), build: v2.7.0-rc3-315-g4dedae5861a9
-- Found Python3: /usr/bin/python3.8 (found suitable exact version "3.8.10") found components: Interpreter 
-- Found west (found suitable version "0.11.1", minimum required is "0.7.1")
-- Board: esp32
-- Cache files will be written to: /home/alfredoj/.cache/zephyr
-- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
-- Found BOARD.dts: /home/alfredoj/zephyrproject/zephyr/boards/xtensa/esp32/esp32.dts
-- Generated zephyr.dts: /home/alfredoj/zephyrproject/zephyr/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /home/alfredoj/zephyrproject/zephyr/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: /home/alfredoj/zephyrproject/zephyr/build/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: /home/alfredoj/zephyrproject/zephyr/build/zephyr/dts.cmake
Parsing /home/alfredoj/zephyrproject/zephyr/Kconfig
Loaded configuration '/home/alfredoj/zephyrproject/zephyr/boards/xtensa/esp32/esp32_defconfig'
Merged configuration '/home/alfredoj/zephyrproject/zephyr/samples/hello_world/prj.conf'
Configuration saved to '/home/alfredoj/zephyrproject/zephyr/build/zephyr/.config'
Kconfig header saved to '/home/alfredoj/zephyrproject/zephyr/build/zephyr/include/generated/autoconf.h'
-- Found toolchain: espressif (/home/alfredoj/.espressif/tools/zephyr)
/home/alfredoj/.espressif/tools/zephyr/xtensa-esp32-elf/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
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/alfredoj/.espressif/tools/zephyr/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Configuring done
-- Generating done
-- Build files have been written to: /home/alfredoj/zephyrproject/zephyr/build
-- west build: building application
[1/154] Preparing syscall dependency handling
..
..
..
..

esptool.py v3.1-dev
Merged 5 ELF sections

@galak galak added the priority: low Low impact/importance bug label Oct 7, 2021
@github-actions
Copy link

github-actions bot commented Dec 7, 2021

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System bug The issue is a bug, or the PR is fixing a bug platform: ESP32 Espressif ESP32 priority: low Low impact/importance bug Stale
Projects
None yet
Development

No branches or pull requests

5 participants