LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-25-2023, 04:22 AM   #1
colinh2
Member
 
Registered: Dec 2015
Posts: 54

Rep: Reputation: Disabled
Can’t run ARM’s gdb (Python problem?)


I didn’t find an SBo for a recent aarch64-binutils etc. so I’ve downloaded ARM’s precompiled utils for Aarch64 cross-development on Linux-x86_64.

Binutils and gcc run fine, but gdb exits immediately:

Code:
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to …
…
sys.executable = ‘/usr/local/bld-tools/bld-virtual-env/bin/python’
…
sys.path = [
   ‘/usr/lib/python38.zip’,
…
I have Slackware 15.0 installed, so Python 3.9 is in /lib64.

Is there some way to convince gdb to use the installed Python? Setting $PYTHONHOME didn’t help.
 
Old 04-25-2023, 08:02 AM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,146
Blog Entries: 6

Rep: Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834
https://www.gnu.org/software/gdb/

Quote:
I have Slackware 15.0 installed, so Python 3.9 is in /lib64.
Your python executable is in /libx64?
Code:
whereis python
You did not post much info. Do you have a working python install? What do you get from python entered into a terminal?

Looks like gdb depend on:
glibc ncurses libncursesw.so=6-64 gcc-libs expat xz mpfr
source-highlight gdb-common=xx readline libreadline.so=xx
guile python libelf

What is the entire error when trying to run gdb?

Quote:
so I’ve downloaded ARM’s precompiled utils for Aarch64 cross-development on Linux-x86_64.
You put ARM executables onto a x86_64 machine?

You need to give a lot more info. The basic fix for this is to use your pacakge manager to install software. So that all depends will be resolved. If gdb is not in your repo, then you may need to build it against your machines libraries, then install it with your package manager. It's not clear what you are doing though.
 
Old 04-25-2023, 09:27 AM   #3
colinh2
Member
 
Registered: Dec 2015
Posts: 54

Original Poster
Rep: Reputation: Disabled
Ah, sorry I was so unclear -- I didn't have internet access on my laptop, so I posted the question from my phone.

Quote:
You put ARM executables onto a x86_64 machine?
The GNU programs (e.g. aarch64-none-elf-as, aarch64-none-elf-gdb etc.) are for cross-development; they run on x86_64 but generate code for bare-metal Aarch64.

Quote:
Your python executable is in /libx64?
Oops. No. The executable is in /usr/bin. Python's libraries (or modules, whatever they're called) are in /usr/lib64/python3.9.

Quote:
What is the entire error when trying to run gdb?
Code:
$ aarch64-none-elf-gdb
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '/usr/local/bld-tools/bld-tools-virtual-env/bin/python'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/usr/local/bld-tools/bld-tools-virtual-env/bin/python'
  sys.base_prefix = '/usr'
  sys.base_exec_prefix = '/usr'
  sys.executable = '/usr/local/bld-tools/bld-tools-virtual-env/bin/python'
  sys.prefix = '/usr'
  sys.exec_prefix = '/usr'
  sys.path = [
    '/usr/lib/python38.zip',
    '/usr/lib/python3.8',
    '/usr/lib/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f22b466ec00 (most recent call first):
<no Python frame>
I have a fresh install of Slackware 15.0. I then just removed the kde stuff (with 'slackpkg remove kde').

Quote:
The basic fix for this is to use your pacakge manager to install software. So that all depends will be resolved. If gdb is not in your repo, then you may need to build it against your machines libraries, then install it with your package manager.
Yes, I'd have preferred to install using sbopkg. SBo only contains:

arm-binutils 2.35
arm-gcc 10.2.0
arm-gdb 10.1.

(ie. older versions, generating code for arm32).

The Arm GNU toolchain (https://developer.arm.com/downloads/...hain-downloads) (12.2.Rel1 from 22.12.2022) has

aarch64-none-elf-as 2.39
aarch64-none-elf-gcc 12.2.1
aarch64-none-elf-gdb 12

I wanted to avoid building the entire GNU toolchain, as I seem to remember it being fairly involved.

I just read the Release Notes:

Quote:
These toolchains are built on
and for RHEL7 on x86_64, and
will likely also be useable on
OS versions:

- RHEL8
- Ubuntu 18.04 or later

...

Known Dependencies

GDB's Python support on Linux hosts requires installation of Python3.8, Python3.8-dev or libpython3.8.
I was hoping it would be something trivial. If it's not, I'll try compiling everything myself. Python 3.9 isn't good enough if it wants Python 3.8 ?

Last edited by colinh2; 04-25-2023 at 09:45 AM.
 
Old 04-25-2023, 10:02 AM   #4
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,146
Blog Entries: 6

Rep: Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834
Couple of thoughts.

Can your machine find python and friends? Does python run from the terminal?
Code:
python
Python 3.x.x (main, apr xx 2023, 17:35:49) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import encodings
>>>
And all of your python matches?
Does python give you python 2 or 3? Slack still uses python2. Also, you have a valid python path specified? Is that where gdb is looking for it?
Code:
python --version
Code:
python -c "import sys; print('\n'.join(sys.path))"
You can append to your python path if you have something in a weird location.
Code:
>>> import sys
>>> print(sys.path)
['', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/usr/lib/python3.10/site-packages']
>>> sys.path.append('/home/fred/flintstone')
>>> print(sys.path)
['', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/usr/lib/python3.10/site-packages', '/home/fred/flintstone']
If all of that is correct. You may have mismatched stuff. The gdb that you have doesn't like the python depends that it is looking for.
 
Old 04-25-2023, 10:07 AM   #5
colinh2
Member
 
Registered: Dec 2015
Posts: 54

Original Poster
Rep: Reputation: Disabled
Thanks for the help, teckk.

I've just downloaded and installed python-3.8.16 (from python.org).

Now, aarch64-none-elf-gdb runs ok.

Seems excessive to have to have every version of python installed though...

Last edited by colinh2; 04-25-2023 at 10:12 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
zypper install gdb, does not install the latest version of GDB Aquarius_Girl SUSE / openSUSE 4 12-30-2010 03:00 AM
LXer: Python Python Python (aka Python 3) LXer Syndicated Linux News 0 08-05-2009 08:30 PM
normal gdb and spec gdb for kgdb Igor007 Programming 1 09-23-2005 04:15 PM
normal gdb and spec gdb for kgdb Igor007 Linux - Newbie 1 09-23-2005 01:41 PM
gdb .. looking for 32 bit gdb.. for ia64 suse.. nkshirsagar SUSE / openSUSE 0 12-09-2004 03:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration