Re: python pip install does not work on FreeBSD 13.2

From: Yuri <yuri_at_aetern.org>
Date: Mon, 15 May 2023 16:06:11 UTC
Miroslav Lachman wrote:
> On 15/05/2023 15:35, Charlie Li wrote:
>> Yuri wrote:
>>> Miroslav Lachman wrote:
>>>>            cc -pthread -shared -L/usr/local/lib
>>>> -fstack-protector-strong
>>>> build/temp.freebsd-13.2-RELEASE-amd64-cpython-39/c/_cffi_backend.o
>>>> -L/usr/local/lib -L/usr/local/lib -lffi -o
>>>> build/lib.freebsd-13.2-RELEASE-amd64-cpython-39/_cffi_backend.cpython-39.so
>>>>            /usr/bin/ld: BFD 2.17.50 [FreeBSD] 2007-07-03 internal
>>>> error,
>>>> aborting at
>>>> /usr/src/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/reloc.c line 445 in unsigned int bfd_get_reloc_size(reloc_howto_type *)
>>>>
>>>>              /usr/bin/ld: Please report this bug.
> 
> [..]
> 
>>>> Does anybody know what can cause this problem on FreeBSD 13.2?
>>>
>>> Looks like in-base binutils (gnu ld included) were removed even before
>>> 13.0, so the one you have is likely a leftover.  And the question is --
>>> do you have WITHOUT_LLD, WITHOUT_LLD_IS_LD, or similar options specified
>>> in src.conf?
> 
> No, only WITHOUT_KERNEL_SYMBOLS=yes
> And only KERNCONF=GENERIC in make.conf, nothing else.
> 
>> /usr/bin/ld is a symlink to ld.lld by default, you should not have
>> ld.bfd since binutils was removed from base prior to 13.
>>
>> This is giving unclean world/userland, poudriere jails perform a full
>> installworld/delete-old{,-libs} so if you did your pip install
>> procedures in there (as a test) you shouldn't have issues either.
>> Always make sure your kernel and userland are in sync.
> 
> Kernel and userland are in sync:
> 
> # freebsd-version -kru
> 13.2-RELEASE
> 13.2-RELEASE
> 13.2-RELEASE
> 
> make delete-old and make delete-old-libs was run after make
> installworld, many files were deleted but is still there
> 
> # ll /usr/bin/ld
> -r-xr-xr-x  1 root  wheel   1.6M Jul 13  2020 /usr/bin/ld*
> 
> I checked all other upgraded machines and all of them have this
> /usr/bin/ld dated back to Jul 13 2020.
> All machines were upgraded from 11.4 to 12.x years ago and from 12.3 to
> 13.2 few weaks ago.

That's strange, looking at the git history, even 11.0 shipped
/usr/bin/ld as a symlink to /usr/bin/ld.bfd, is it possible it was
modified locally for some reason?

git show origin/releng/11.0:gnu/usr.bin/binutils/ld/Makefile

> So is there some bug in "make delete-old"?

No, delete-old should not delete /usr/bin/ld as it still exists, it's
only supposed to delete /usr/bin/ld.bfd (the gnu one).

> Should I delete /usb/bin/ls on all machines?
> 
>> Slightly unrelated, but if you are running pip against the normally
>> pkg(8)-managed site-packages (and not elsewhere like a virtual
>> environment), this will soon not be allowed with our Python ports.
> 
> We run pip install only in venv. We don't mix global packages from pkg
> and pip.