Re: python pip install does not work on FreeBSD 13.2

From: Yuri <>
Date: Mon, 15 May 2023 13:00:18 UTC
Miroslav Lachman wrote:
> I upgraded one of our development machines to FreeBSD 13.2 amd64 and
> Python 3.11, then our developers team tried to re-deploy application for
> uwsgi in virtualenv. The part where pip install -r requirements.txt
> should install dependencies always fails with the same error no matter
> what we tried to workaround it. If it failed on building cffi and I
> copied it from else where, then it failed with the same error on next
> module bcrypt and so on.
> I thought it is caused by Python 3.11 so I downgraded it to default
> Python 3.9 but the error is still the same
>           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/
>           /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
> I tried to find something on the internet about this issue but the
> closest was on some Linux forum with the answer "ld BFD 2.17 is too old,
> you need to upgrade it"
> It is clear that ld on FreeBSD is from 2007 but I cannot tell if it is
> the root cause of this issue or if it is more related to newer clang /
> llvm on FreeBSD 13.2 or to something else.
> 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?