-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
tools/docker: Add libpython2.7 in order to satisfy GDB dependencies (IDFGH-3925) #5817
tools/docker: Add libpython2.7 in order to satisfy GDB dependencies (IDFGH-3925) #5817
Conversation
It was not possible to run xtensa-esp32-elf-gdb from container due to missing libpython2.7 library. In order to satisfy Python dependencies for IDF tools it was required to change resolver behavior otherwise pip did not installed proper version of gdbgui which caused failure when initializing IDF.
Here is PoC from console: martin@K1-T520 /tmp ()$ docker run -it espressif/idf bash
Adding ESP-IDF tools to PATH...
Using Python interpreter in /opt/esp/python_env/idf4.3_py3.6_env/bin/python
Checking if Python packages are up to date...
Python requirements from /opt/esp/idf/requirements.txt are satisfied.
Added the following directories to PATH:
/opt/esp/idf/components/esptool_py/esptool
/opt/esp/idf/components/espcoredump
/opt/esp/idf/components/partition_table
/opt/esp/idf/components/app_update
/opt/esp/tools/xtensa-esp32-elf/esp-2020r2-8.2.0/xtensa-esp32-elf/bin
/opt/esp/tools/xtensa-esp32s2-elf/esp-2020r2-8.2.0/xtensa-esp32s2-elf/bin
/opt/esp/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin
/opt/esp/tools/esp32s2ulp-elf/2.28.51-esp-20191205/esp32s2ulp-elf-binutils/bin
/opt/esp/tools/cmake/3.16.4/bin
/opt/esp/tools/openocd-esp32/v0.10.0-esp32-20200709/openocd-esp32/bin
/opt/esp/python_env/idf4.3_py3.6_env/bin
/opt/esp/idf/tools
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:
idf.py build
root@fcca0b7f662b:/# xtensa-esp32-elf-gdb
xtensa-esp32-elf-gdb: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
root@fcca0b7f662b:/#
root@fcca0b7f662b:/#
root@fcca0b7f662b:/#
root@fcca0b7f662b:/# apt update
Get:1 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [13.5 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1344 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB]
Get:8 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [1050 kB]
Get:9 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [186 kB]
Get:10 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [123 kB]
Get:11 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [27.4 kB]
Get:12 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1421 kB]
Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [1359 kB]
Get:14 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [8432 B]
Get:15 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [8286 B]
Get:16 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [9834 B]
Get:17 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [891 kB]
Get:18 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [102 kB]
Fetched 18.4 MB in 3s (5667 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
5 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@fcca0b7f662b:/#
root@fcca0b7f662b:/#
root@fcca0b7f662b:/#
root@fcca0b7f662b:/#
root@fcca0b7f662b:/# apt install libpython2.7
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libpython2.7-minimal libpython2.7-stdlib
The following NEW packages will be installed:
libpython2.7 libpython2.7-minimal libpython2.7-stdlib
0 upgraded, 3 newly installed, 0 to remove and 5 not upgraded.
Need to get 3304 kB of archives.
After this operation, 15.4 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython2.7-minimal amd64 2.7.17-1~18.04ubuntu1.1 [335 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython2.7-stdlib amd64 2.7.17-1~18.04ubuntu1.1 [1915 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython2.7 amd64 2.7.17-1~18.04ubuntu1.1 [1053 kB]
Fetched 3304 kB in 0s (7170 kB/s)
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 3.)
debconf: falling back to frontend: Readline
Selecting previously unselected package libpython2.7-minimal:amd64.
(Reading database ... 17222 files and directories currently installed.)
Preparing to unpack .../libpython2.7-minimal_2.7.17-1~18.04ubuntu1.1_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.17-1~18.04ubuntu1.1) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../libpython2.7-stdlib_2.7.17-1~18.04ubuntu1.1_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.17-1~18.04ubuntu1.1) ...
Selecting previously unselected package libpython2.7:amd64.
Preparing to unpack .../libpython2.7_2.7.17-1~18.04ubuntu1.1_amd64.deb ...
Unpacking libpython2.7:amd64 (2.7.17-1~18.04ubuntu1.1) ...
Setting up libpython2.7-minimal:amd64 (2.7.17-1~18.04ubuntu1.1) ...
Setting up libpython2.7-stdlib:amd64 (2.7.17-1~18.04ubuntu1.1) ...
Setting up libpython2.7:amd64 (2.7.17-1~18.04ubuntu1.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.2) ...
root@fcca0b7f662b:/#
root@fcca0b7f662b:/#
root@fcca0b7f662b:/#
root@fcca0b7f662b:/#
root@fcca0b7f662b:/#
root@fcca0b7f662b:/# xtensa-esp32-elf-gdb
GNU gdb (crosstool-NG esp-2020r2) 8.1.0.20180627-git
Copyright (C) 2018 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) q
root@fcca0b7f662b:/#
root@fcca0b7f662b:/# exit
exit
martin@K1-T520 /tmp ()$ I also tried my own image, but there is chicken and egg issue with |
Thanks for your contribution. |
tools/idf_tools.py
Outdated
# Need to update resolver otherwise gdbgui dependency is not possible | ||
# satisfy | ||
run_args = [virtualenv_python, '-m', 'pip', 'install', | ||
'--no-warn-script-location', '--use-feature=2020-resolver'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will be resolved by pinning the correct pygdmi version (fix to be merged shortly).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, got it. I reverted change in idf_tools.py
(Linking #5284) Thanks for the PR, @MartinStej. We can merge the change to the Dockerfile. I would ask you to remove the idf_tools.py change from that commit since the gdbgui issue will be fixed in a different way (by updating requirements.txt). Another option we need to investigate is using Python 3 when building xtensa-esp32*-elf-gdb. |
The gdbgui issue will be solved separately
Thanks! I have squashed the two commits, removed the mention of gdbgui from the commit message and put this into the internal merge queue. This PR will be updated once the change is merged and deployed to Github. |
Cherry-picked in be0372b, thanks again for contributing. |
"Another option we need to investigate is using Python 3 when building xtensa-esp32*-elf-gdb." --> is there a timeline for this? I ran into the same issue under Fedora 33 which has not Python 2 installed anymore by default. |
@loeriver Building GDB with Python 3 support runs into the ABI compatibility problem. Python 3.x libraries for different values of x are not compatible (unless the module is built with
The last option seems (to me) the most practical, but it is hard to fit it into crosstool-NG build process. For the time being I would suggest to either build xtensa-esp32-elf-gdb using crosstool-NG locally (this will pick up whichever version of Python you have installed), or to install libpython2.7 from package manager or another source. |
It was not possible to run xtensa-esp32-elf-gdb from container due to
missing libpython2.7 library.
In order to satisfy Python dependencies for IDF tools it was required to
change resolver behavior otherwise pip did not installed proper version
of gdbgui which caused failure when initializing IDF.