This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

gcc-arm-11.2-2022.02-x86_64-arm-none-eabi gdb FAILS on ubuntu

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......

Parents
  • 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

    In addition to those, I also installed these, and their linked dependencies:

    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

    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.

    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.

    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 --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>

    Have not progressed any further, but this is progress. Finally.

    I hope this helps.

Reply
  • 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

    In addition to those, I also installed these, and their linked dependencies:

    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

    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.

    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.

    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 --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>

    Have not progressed any further, but this is progress. Finally.

    I hope this helps.

Children