Re: python pip install does not work on FreeBSD 13.2

From: Charlie Li <vishwin_at_freebsd.org>
Date: Mon, 15 May 2023 13:35:53 UTC
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.
>>
>>              cc: error: linker command failed with exit code 1 (use -v to
>> see invocation)
>>              error: command '/usr/bin/cc' failed with exit code 1
>>              [end of output]
>>
>>          note: This error originates from a subprocess, and is likely not
>> a problem with pip.
>>          ERROR: Failed building wheel for cffi
>>        Failed to build cffi
>>        ERROR: Could not build wheels for cffi, which is required to
>> install pyproject.toml-based projects
>>        [end of output]
>>
>>    note: This error originates from a subprocess, and is likely not a
>> problem with pip.
>> error: subprocess-exited-with-error
>>
>> The strange thing is building these (py-cffi, py-bcrypt, py-psycopg)
>> builds fine in Poudriere on 13.2, can be installed on machine in
>> questiong (by pkg install py39-cffi), but cannot be installed by pip
>> install.
>>
>>
>> This deployment process was working for many years for many versions of
>> python and FreeBSD, but not now.
>>
>> 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?
> 
> 
/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.

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.

-- 
Charlie Li
…nope, still don't have an exit line.