Hi,
I downloaded gcc-arm-11.2-2022.02-x86_64-arm-none-eabi.tar.xz from https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/downloads.
Unpacked the tar into my home folder. When I then run
```
p@bp-legion:~/Downloads/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi/bin$ ./arm-none-eabi-gdb --version./arm-none-eabi-gdb: error while loading shared libraries: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory
I got this AFTER being forced to `ln`
- /usr/lib/x86_64-linux-gnu/libncursesw.so.6
- /usr/lib/x86_64-linux-gnu/libtinfo.so.6
I didn't graduate on linux, did I miss "the easy way" to get the arm toolchain working on my ubuntu installation?
I can't imagine that I am the first to install the arm toolchain on a fresh installed ubuntu 22.04 environment......
Hey Bass
Yes, this is a PITA. Been fighting with this myself yesterday. I'm on Debian bullseye.
The crusty arm gcc toolchain demands ancient Python 3.6 - I guess at least for GDB to work.
I'm sure you've noticed as I have, that the python3.6 package is no longer available in your current distro's repos, as its really old.
I also installed gcc-arm-11.2-2022.02-x86_64-arm-none-eabi and tried arm-none-eabi-gdb --version with the same result - missing libpython3.6m.so.1.0.
Not sure why you had to symlink libncursesw and libtinfo, so I can't comment on that. If possible, see if those libs are available in your package manager, and then remove your symlinks and rather install them from the repo. In the Debian bullseye repos, I can see packages for libtinfo5, libtinfo6, libncursesw5, libncursesw6. I have all of them installed...
At first I hoped the backwards compatibility of Python might work, and tried to symlink it in place - https://askubuntu.com/questions/1404248/how-to-install-libpython3-6m-so-1-0-on-ubuntu-20-04 but that didn't work, I think I got some error about data type sizes being incorrect or something...
If you are on Ubuntu, you might wanna try the deadsnakes PPA route for installing Python 3.6: https://askubuntu.com/a/710865
Before you can use "add-apt-repository" you probably have to install the "software-properties-common" package from your package manager first...
I could not get that working on Debian however - must be some Ubuntu special thing.
If that doesn't work - next step is to get the python3.6 source code, and compile it from scratch. This is a big task, but it worked for me. I'll share the important notes here:
First, read this readme file:https://github.com/deadsnakes/python3.6/blob/ubuntu/xenial/README.rst
Then read this thread: https://www.reddit.com/r/learnpython/comments/m7nkyc/how_long_should_make_test_take_when_building/
Then read the article referenced in above link, lost to 404, but fished out of the internet archive: https://web.archive.org/web/20210411205652/https://thinkbot.de/en/howto/how-to-build-python3-on-debian-buster/
Get the source code:
git clone github.com/.../python3.6.git
cd python3.6
Make sure you install the build-time dependencies:
sudo apt install zlib1g-dev libc6-dev libexpat1-dev libssl-dev libbz2-dev \ libffi-dev libdb-dev liblzma-dev libncurses-dev \ libncursesw5-dev libsqlite3-dev libreadline-dev uuid-dev \ libgdbm-dev tk-dev libbluetooth-dev build-essential
sudo apt install zlib1g-dev libc6-dev libexpat1-dev libssl-dev libbz2-dev \
libffi-dev libdb-dev liblzma-dev libncurses-dev \
libncursesw5-dev libsqlite3-dev libreadline-dev uuid-dev \
libgdbm-dev tk-dev libbluetooth-dev build-essential
In addition to those, I also installed these, and their linked dependencies:
libgdbm-devlibqdbm-devlibgdbm-compat-devlibtk8.6libtcl8.6tcllibtcl-devtk8.6-dev
libgdbm-dev
libqdbm-dev
libgdbm-compat-dev
libtk8.6
libtcl8.6
tcllib
tcl-dev
tk8.6-dev
Next, you need to follow that configuration line from the guide on the internet archive (link above), but it needs some changes:
1) You need to remove the --enable-optimizations option, as that makes your build take fooooor ever (and likely get stuck, if you read around the net...)
2) The actual libpython3.6m.so.1.0 file we're after will not get built by default - you have to specifically request it.
So - taking those 2 points in mind, the next step is to run configure:
CXX="/usr/bin/g++" ./configure --prefix=/usr/local \ --with-system-expat \ --with-system-ffi \ --with-ensurepip=install \ --enable-shared
CXX="/usr/bin/g++" ./configure --prefix=/usr/local \
--with-system-expat \
--with-system-ffi \
--with-ensurepip=install \
--enable-shared
That --enable-shared option will build the lib!
After configure completes, you can run make:
make
If something screws up, you can reset with make clean and redo the above config and make steps.
make clean
As you run make, towards the end of all the printout, you might see a message like this:
The necessary bits to build these optional modules were not found:_bz2 _curses _curses_panel _dbm _gdbm _lzma _sqlite3 _ssl _tkinter readline To find the necessary bits, look in setup.py in detect_modules() for the module's name.
The necessary bits to build these optional modules were not found:
_bz2 _curses _curses_panel
_dbm _gdbm _lzma
_sqlite3 _ssl _tkinter
readline
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
That shows you any missing dependencies. If you spot any, you will need to review steps above of installing build-time dependencies first, and then retry.
After make is done, and you have no missing dependencies, then you can install python3.6:
sudo make altinstall
Make sure you use altinstall and not just install, as you may mess up your system.
Now, that installs python3.6 into /usr/local/bin and /usr/local/lib - which I think is correct, for a non-distro python like this, but it arm-dgb will still not work.
You now need to symlink that lib into place:
sudo ln -s /usr/local/lib/libpython3.6m.so.1.0 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
And THEN, your ARM-flavour GCC-GDB will work!:
~/gcc-arm/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi/bin$ ./arm-none-eabi-gdb --versionGNU gdb (GNU Toolchain for the Arm Architecture 11.2-2022.02 (arm-11.14)) 11.2.90.20220202-gitCopyright (C) 2022 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later <gnu.org/.../gpl.html>This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law.
~/gcc-arm/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi/bin$ ./arm-none-eabi-gdb --version
GNU gdb (GNU Toolchain for the Arm Architecture 11.2-2022.02 (arm-11.14)) 11.2.90.20220202-git
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <gnu.org/.../gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
In my case, I'm trying to get a bootloader flashed to a nRF52840, using the bluepill method: https://github.com/joric/nrfmicro/wiki/Bootloader
With the above steps, I can now get GDB to see the bluepill board with blackmagic firmware on it:
~/gcc-arm/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi/bin$ ./arm-none-eabi-gdb --batch -ex "target extended-remote /dev/ttyACM0" -ex "monitor"Black Magic Probe (Firmware v1.6.1-382-gf10ccfd-dirty) (Hardware Version 0)Copyright (C) 2015 Black Sphere Technologies Ltd.License GPLv3+: GNU GPL version 3 or later <gnu.org/.../gpl.html>
~/gcc-arm/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi/bin$ ./arm-none-eabi-gdb --batch -ex "target extended-remote /dev/ttyACM0" -ex "monitor"
Black Magic Probe (Firmware v1.6.1-382-gf10ccfd-dirty) (Hardware Version 0)
Copyright (C) 2015 Black Sphere Technologies Ltd.
Have not progressed any further, but this is progress. Finally.
I hope this helps.
Hi,I am facing the same problem. I try to solve the problem using libpython3.8 and creating a symbolic link as shown below
sudo ln -s /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
I got the following messages
arm-none-eabi-gdb --versionarm-none-eabi-gdb: Symbol `PyBool_Type' has different size in shared object, consider re-linkingarm-none-eabi-gdb: Symbol `PySlice_Type' has different size in shared object, consider re-linkingarm-none-eabi-gdb: Symbol `PyFloat_Type' has different size in shared object, consider re-linkingGNU gdb (GNU Toolchain for the Arm Architecture 11.2-2022.02 (arm-11.14)) 11.2.90.20220202-gitCopyright (C) 2022 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later <gnu.org/.../gpl.html>This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law.
I have no idea how to solve this... may be we need to rebuild the toolchain using lipython3.8.
Hi danieloak, I got to the same point as you above (has different size in shared object). I just posted a reply to Bass (above), with the steps I took to get it working. My post is stuck in manual-review currently - maybe it will be public soon. Hope it can help you :)
(hmmm, I wonder if this reply to you will also be stuck in manual-review)
Hi Bogomips,
Let's wait them post your reply.
Thanks
Looks like its available now.
For your ncursesw issues, maybe see this post: www.reddit.com/.../
Further, I don't know if this is needed or not, but you might wanna make that python3.6 build your temporary "system" python. Not sure the best way to do this - I would normally just symlink /usr/bin/python, to the python I want, like /usr/local/bin/python3.6 (and revert it after I'm done)Under windows, if you install gcc-arm-11.2-2022.02-mingw-w64-i686-arm-none-eabi.exe, the install is missing the gccvar.bat file (and Python 2.7 dependency?!?!?)You can get the file from here: https://github.com/metalcode-eu/windows-arm-none-eabi/blob/410f43590f1edd7392fe02442ff51a7e433b36ae/bin/gccvar.batAnd manually add in the python env like this:
set PYTHONHOME=c:\Python27
set PYTHONPATH=c:\Python27\Lib
set PATH=%PYTHONHOME%;%PATH%
I don't think there is an equivalent gccvar.bat for the Linux install, nor if the PYTHONHOME / PYTHONPATH work under Linux - but that might be something to explore if needed.
Also why does the windows build of gcc-arm-11.2-2022 need Python 2.7, and the Linux one need Python 3.6?
Also why is the bat file missing in the windows install?
Also why does gdb need python, but the rest of the toolchain seems fine?
jeeesh... the hoops we have to jump through.
Arm Community Please tell us when it is planned to be fixed?
Thank you for pointing out the issues around python incompatibility.
For Ubuntu 20.04, Python 3.6 could be installed through the PPA route as mentioned in https://bugs.linaro.org/show_bug.cgi?id=5842#c1, however, this might not work for Ubuntu 22.04.
For the next release, we are working on updating the version of Python that is used in GDB, so that there will be better compatibility for the newer linux distros. Following on from that, we do want to take a look at other approaches, such as the two binary approach or static linking approach, to improve on the compatibility.
So the trick is that everyone got a Python on the system. Please note that you can easily download sources and build Python 3.6 with shared library Arm GDB requires.
Please see below. What is skipped in my answer and already covered in answer below is that you need GCC toolchain to compiler and build Python.
> I didn't graduate on linux, did I miss "the easy way" to get the arm toolchain working on my ubuntu installation?
It is understandable that this "missing dependency" can be an obstacle for a user who is used to "out of the box experience".
Short answer already posted below:
$ PREFIX=/tmp/tt/python3.6$ wget www.python.org/.../Python-3.6.14.tgz$ tar xf www.python.org/.../Python-3.6.14.tgz$ mkdir -p $PREFIX && cd $PREFIX$ ../path/to/Python-3.6.14/configure --prefix=$PREFIX --enable-shared$ make -j16$ make install -j16
# We can see that we've produced shared library (.so file successfully):
$ find . -name libpython3.6m.so.1.0./libpython3.6m.so.1.0./lib/libpython3.6m.so.1.0
# Trick is to tell GDB where to look for shared libs with LD_LIBRARY_PATH environment variable.
$ LD_LIBRARY_PATH=/tmp/tt/python3.6/lib ./bin/arm-none-eabi-gdb --versionGNU gdb (GNU Toolchain for the Arm Architecture 11.2-2022.02 (arm-11.14)) 11.2.90.20220202-git
Below example shows how to install Python 3.6 locally without sudo access to your machine.
kind regards, P. Wirkus
Hi all, I had the same issue here, I'm using Ubuntu 22.04 and I can't download python3.6. I solved this by using a Docker Container with Ubuntu 20.04 inside, so I installed python3.6 in there and ran GDB inside of it. It worked without problems so far.
Remember that every distribution has its policy about what Python version to install as their system-wide default. For example, for Debian 11 (stable), the current version is Python 3.9, not 3.8, as required by arm-toolchain release 11.3 or Python 3.6 of release 11.2. Any Python version you choose to release your executables would be equally arbitrary and conflicting unless you target a particular Linux distribution/version.
I believe doing another duplicated, complete Python installation to use gdb when someone does not need Python support in gdb makes no sense. Therefore, looking forward, I think the best solution is:
1) Two executables, arm-none-gdb and arm-none-gdb-py, as in arm-toolchain release 10.2) Statically linked Python on gdb-py, whatever version you choose.
Currently, the only way to use the arm-toolchain without worrying about Python versions and embarking on tedious workarounds is to use arm-none-gdb (without Pyhton support) in arm-toolchain release 10.
For the typical end user, it may be more convenient to check their Linux distribution for the package "gcc-arm-none-eabi". For example, Debian testing and Ubuntu 22 already have arm-toolchian release 10 in its package managers.