Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
broken emerge again(solved)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1331
Location: sweden

PostPosted: Sat Jul 13, 2024 6:26 pm    Post subject: broken emerge again(solved) Reply with quote

hi .

after failing update emerge broke and i need help . at the moment i am at : https://wiki.gentoo.org/wiki/Project:Portage/Fixing_broken_portage
but still no go . here is the output :

Code:

myt30 /tmp/portage # bin/emerge --info
Traceback (most recent call last):
  File "/tmp/portage/bin/emerge", line 51, in <module>
    from _emerge.main import emerge_main
  File "/tmp/portage/lib/_emerge/main.py", line 24, in <module>
    from portage.sync import _SUBMODULE_PATH_MAP
  File "/tmp/portage/lib/portage/sync/__init__.py", line 9, in <module>
    from portage.sync.controller import SyncManager
  File "/tmp/portage/lib/portage/sync/controller.py", line 21, in <module>
    from portage.package.ebuild.doebuild import _check_temp_dir
  File "/tmp/portage/lib/portage/package/ebuild/doebuild.py", line 115, in <module>
    from portage.util.compression_probe import _compressors
  File "/tmp/portage/lib/portage/util/compression_probe.py", line 4, in <module>
    import ctypes
  File "/usr/lib/python3.12/ctypes/__init__.py", line 8, in <module>
    from _ctypes import Union, Structure, Array
ImportError: /usr/lib/python3.12/lib-dynload/_ctypes.cpython-312-arm-linux-gnueabihf.so: undefined symbol: ffi_type_longdouble, version LIBFFI_BASE_8.0
myt30 /tmp/portage
 #


regards hedmo


Last edited by hedmo on Mon Jul 15, 2024 5:33 am; edited 1 time in total
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 357

PostPosted: Sat Jul 13, 2024 6:55 pm    Post subject: Reply with quote

From the error, it looks like it is your python that is broken, rather than portage. To confirm, try:
Code:
$ python3.12 -c 'print(__import__("_ctypes").__file__)'
$ nm -CD `!!` | grep ffi_type_longdouble


and post the output.

The first command should output /usr/lib/python3.12/lib-dynload/_ctypes.cpython-312-arm-linux-gnueabihf.so.
The second command should output U ffi_type_longdouble@LIBFFI_BASE_8.0.

If the second command outputs nothing, you need a working python, rather than a working portage.
Back to top
View user's profile Send private message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1331
Location: sweden

PostPosted: Sat Jul 13, 2024 7:05 pm    Post subject: Reply with quote

bstaletic wrote:
From the error, it looks like it is your python that is broken, rather than portage. To confirm, try:
Code:
$ python3.12 -c 'print(__import__("_ctypes").__file__)'
$ nm -CD `!!` | grep ffi_type_longdouble


and post the output.

The first command should output /usr/lib/python3.12/lib-dynload/_ctypes.cpython-312-arm-linux-gnueabihf.so.
The second command should output U ffi_type_longdouble@LIBFFI_BASE_8.0.

If the second command outputs nothing, you need a working python, rather than a working portage.


bstaletic

yes i think it is a broken python but the same time emerge is still broken. here is the output of the commands :

Code:

 myt30 /tmp/portage # python3.12 -c 'print(__import__("_ctypes").__file__)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: /usr/lib/python3.12/lib-dynload/_ctypes.cpython-312-arm-linux-gnueabihf.so: undefined symbol: ffi_type_longdouble, version LIBFFI_BASE_8.0
myt30 /tmp/portage # nm -CD `!!` | grep ffi_type_longdouble
nm -CD `python3.12 -c 'print(__import__("_ctypes").__file__)'` | grep ffi_type_longdouble
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: /usr/lib/python3.12/lib-dynload/_ctypes.cpython-312-arm-linux-gnueabihf.so: undefined symbol: ffi_type_longdouble, version LIBFFI_BASE_8.0
nm: 'a.out': No such file
myt30 /tmp/portage #


regards hedmo
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 357

PostPosted: Sat Jul 13, 2024 7:14 pm    Post subject: Reply with quote

Okay, let's avoid using python...

Code:
nm -CD /usr/lib/python3.12/lib-dynload/_ctypes.cpython-312-arm-linux-gnueabihf.so | grep longdouble

That should output
Code:
U ffi_type_longdouble@LIBFFI_BASE_8.0
, which is the symbol that your python is failing to find.
The U symbol type stands for "undefined" - it needs to be resolved by one of the dependencies.
Code:
ldd '/usr/lib/python3.12/lib-dynload/_ctypes.cpython-312-x86_64-linux-gnu.so'

That will output the dependencies of the `_ctypes` module. Something like this:
Code:
        linux-vdso.so.1 (0x00007ffdc11bf000)
        libffi.so.8 => /usr/lib64/libffi.so.8 (0x00007f028f70b000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f028f52c000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f028f748000)

You can see that libffi.so.8, which looks interesting.
Code:
nm -CD /usr/lib64/libffi.so.8 | grep longdouble

That should output something like
Code:
000000000000bae0 D ffi_type_complex_longdouble@@LIBFFI_COMPLEX_8.0
0000000000009000 R ffi_type_longdouble@@LIBFFI_BASE_8.0


The second line is the symbol that python is looking for. The D stands for "initialized data section".

Post all outputs and let's see where your stuff differs from mine.
Back to top
View user's profile Send private message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1331
Location: sweden

PostPosted: Sat Jul 13, 2024 7:20 pm    Post subject: Reply with quote

bstaletic

the second commad fails . here is the outputs :

Code:

myt30 /tmp/portage # nm -CD /usr/lib/python3.12/lib-dynload/_ctypes.cpython-312-arm-linux-gnueabihf.so | grep longdouble
         U ffi_type_longdouble@LIBFFI_BASE_8.0
myt30 /tmp/portage # ldd '/usr/lib/python3.12/lib-dynload/_ctypes.cpython-312-x86_64-linux-gnu.so'
ldd: /usr/lib/python3.12/lib-dynload/_ctypes.cpython-312-x86_64-linux-gnu.so: No such file or directory
myt30 /tmp/portage # nm -CD /usr/lib64/libffi.so.8 | grep longdouble
nm: '/usr/lib64/libffi.so.8': No such file
myt30 /tmp/portage #


regards hedmo
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 357

PostPosted: Sat Jul 13, 2024 7:23 pm    Post subject: Reply with quote

Ah, it failed because you're on an ARM system and your _ctypes has a different suffix than my amd64 one.

Here's the correct path: /usr/lib/python3.12/lib-dynload/_ctypes.cpython-312-arm-linux-gnueabihf.so

Please repeat the steps with the correct path.
Back to top
View user's profile Send private message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1331
Location: sweden

PostPosted: Sat Jul 13, 2024 7:39 pm    Post subject: Reply with quote

bstaletic

the second commad gives :

Code:

myt30 /tmp/portage # ldd '/usr/lib/python3.12/lib-dynload/_ctypes.cpython-312-arm-linux-gnueabihf.so'
        linux-vdso.so.1 (0xbeff6000)
        libffi.so.8 => /usr/lib/libffi.so.8 (0xb6efb000)
        libc.so.6 => /lib/libc.so.6 (0xb6d88000)
        /lib/ld-linux-armhf.so.3 (0xb6f3d000)
        libgcc_s.so.1 => /usr/lib/gcc/armv7a-unknown-linux-gnueabihf/14/libgcc_s.so.1 (0xb6d7c000)
myt30 /tmp/portage #
 


but the third command gives me nothing . i think the path is :

Code:

myt30 /tmp/portage # nm -CD /usr/lib/libffi.so.8 | grep longdouble
myt30 /tmp/portage #


because of :

Code:

myt30 /tmp/portage # ls /usr
armv7a-hardfloat-linux-gnueabi  bin    include  libexec  portage  share  tmp
armv7a-unknown-linux-gnueabihf  false  lib      local    sbin     src
myt30 /tmp/portage #


regards hedmo
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 357

PostPosted: Sat Jul 13, 2024 7:57 pm    Post subject: Reply with quote

Well... either your libffi is broken, or your python is broken.

Do other things that depend on libffi work? You can get a list of things depending on libffi with this:
Code:
grep -F libffi.so.8 /var/db/pkg/*/*/NEEDED


Have you compiled python yourself, or did you use a binhost? If you don't remember, look in /var/db/pkg/dev-lang/python-3.12.*, for files BUILD_TIME and BINPKGMD5.
Former indicates you have compiled it and latter that you have installed the package from a bihost.
Have you compiled libffi yourself?

Either way, I would try building python manually, somewhere, then putting that in my PATH and its libpython in my LD_LIBRARY_PATH. Then, with that python, I'd try to import _ctypes. That should work.
If it does, we can figure out how to repair python without touching portage.

Also... post the output of the grep command from the start of this post.
Back to top
View user's profile Send private message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1331
Location: sweden

PostPosted: Sun Jul 14, 2024 8:14 am    Post subject: Reply with quote

bstaletic

thanks for helping me yesterday. i had a broken python . i solved it by using two gentoo wiki :



i followed the Handbook:AMD64 like i was on a livecd but added two command before chrooting :
Code:

# mkdir /mnt/gentoo/broken
mount -o bind / /mnt/gentoo/broken

now i was in a chrooted environment with working python , emerge and my broken system at /broken :). time to build a binary package ...
i followed Raspberry_Pi/Installation at section : 'Compiling using chroot' but change the commands to this :
Code:

# quickpkg python
# cd /broken
# ROOT=$PWD/ emerge --usepkgonly --oneshot --nodeps --jobs=1 --quiet-build=n python

and now i have installed a working python on my broken system :) . time to check :

Code:

 # emerge --info
Portage 3.0.65 (python 3.12.3-final-0, default/linux/arm/23.0/split-usr/armv7a_hf/desktop/plasma, gcc-13, glibc-2.39-r9, 6.9.0+ armv7l)
=================================================================
...
#


best regards hedmo
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum