Bug 256141

Summary: lang/python3*: Remove LIBFFI option for python* versions which unbundled libffi (Fails to install without LIBFFI)
Product: Ports & Packages Reporter: Marián Černý <majo-bugs.freebsd.org>
Component: Individual Port(s)Assignee: Dmitry Marakasov <amdmi3>
Status: Closed FIXED    
Severity: Affects Some People CC: amdmi3, jcfyecrayz, python, wen
Priority: --- Keywords: easy
Version: LatestFlags: koobs: maintainer-feedback+
koobs: merge-quarterly+
Hardware: amd64   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=244782
Attachments:
Description Flags
Patch koobs: maintainer-approval+

Description Marián Černý 2021-05-25 07:19:15 UTC
When building lang/python38 without LIBFFI option (Use libffi from ports instead of bundled version) it fails to install:

    ===>  Installing for python38-3.8.10
    ===>  Checking if python38 is already installed
    ===>   Registering installation for python38-3.8.10
    pkg-static: Unable to access file /tmp/portbuild/usr/ports/lang/python38/work/stage/usr/local/lib/python3.8/lib-dynload/_ctypes.cpython-38.so:No such file or directory
    *** Error code 1

The error is probably a result of the previous build error (fatal error: 'ffi.h' file not found):

    building '_ctypes' extension
    cc -fPIC -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -O2 -pipe -march=sandybridge -fstack-protector-strong -fno-strict-aliasing -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -I./Include/internal -I./Include -I. -I/usr/local/include -I/tmp/portbuild/usr/ports/lang/python38/work/Python-3.8.10/Include -I/tmp/portbuild/usr/ports/lang/python38/work/Python-3.8.10 -c /tmp/portbuild/usr/ports/lang/python38/work/Python-3.8.10/Modules/_ctypes/_ctypes.c -o build/temp.freebsd-12.2-RELEASE-p6-amd64-3.8/tmp/portbuild/usr/ports/lang/python38/work/Python-3.8.10/Modules/_ctypes/_ctypes.o
/tmp/portbuild/usr/ports/lang/python38/work/Python-3.8.10/Modules/_ctypes/_ctypes.c:107:10: fatal error: 'ffi.h' file not found
    #include <ffi.h>
             ^~~~~~~
    1 error generated.
    
    Python build finished successfully!

I am using FreeBSD 12.2 on amd64:

    # uname -a
    FreeBSD portbuild 12.2-RELEASE-p6 FreeBSD 12.2-RELEASE-p6 GENERIC  amd64
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2021-05-26 00:51:33 UTC
Had a couple of reports of this issue. Python unbundled libffi, necessitating depending on libffi for those versions onward.

The LIBFFI option should be removed across all lang/python* ports where this is the case, as it is no longer optional
Comment 2 Dmitry Marakasov freebsd_committer freebsd_triage 2021-06-04 14:25:28 UTC
Created attachment 225547 [details]
Patch

Proposed patch
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2021-06-04 23:46:14 UTC
Thank you Dmitry
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2021-06-04 23:46:42 UTC
Comment on attachment 225547 [details]
Patch

Reviewed by: koobs (python)
Approved by: koobs (python)
MFH: 2020Q2 (bugfix)
Comment 5 John Hein 2021-06-08 15:15:32 UTC
Historical note: see bug 244782.  The LIBFFI option should probably have been removed from python38 when the change from that bug was committed.
Comment 6 Kubilay Kocak freebsd_committer freebsd_triage 2021-06-09 00:59:13 UTC
(In reply to John Hein from comment #5)

Yep.
Comment 7 Wen Heping freebsd_committer freebsd_triage 2021-06-10 02:02:42 UTC
I suggest we shall commit the patch for python39 first,
then ask for a exp-run for a full test of python38.
Comment 8 Kubilay Kocak freebsd_committer freebsd_triage 2021-06-10 02:46:48 UTC
(In reply to Wen Heping from comment #7)

This doesn't need an exp-run, the builds fail when disabling the LIBFFI option, because its not longer bundled. The only possible successful build is with system (ports) libffi, which is what it defaults to now.
Comment 9 commit-hook freebsd_committer freebsd_triage 2021-06-10 17:13:16 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=64be746e535b0ca620460c95a819b81ac2159d01

commit 64be746e535b0ca620460c95a819b81ac2159d01
Author:     Dmitry Marakasov <amdmi3@FreeBSD.org>
AuthorDate: 2021-06-04 14:18:37 +0000
Commit:     Dmitry Marakasov <amdmi3@FreeBSD.org>
CommitDate: 2021-06-10 17:09:54 +0000

    lang/python3[89]: remove LIBFFI option

    Python now requires libffi from ports and does not build with LIBFFI
    disabled, so remove the option.

    PR:             256141
    Reported by:    majo-bugs.freebsd.org@cerny.sk
    Reviewed by:    koobs (python)
    Approved by:    koobs (python)
    MFH:            2020Q2 (bugfix)

 lang/python38/Makefile | 19 ++++++-------------
 lang/python39/Makefile | 19 ++++++-------------
 2 files changed, 12 insertions(+), 26 deletions(-)
Comment 10 commit-hook freebsd_committer freebsd_triage 2021-06-10 18:22:30 UTC
A commit in branch 2021Q2 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=712927d32f8c753ba4e4ff250d9b795bf7391383

commit 712927d32f8c753ba4e4ff250d9b795bf7391383
Author:     Dmitry Marakasov <amdmi3@FreeBSD.org>
AuthorDate: 2021-06-04 14:18:37 +0000
Commit:     Dmitry Marakasov <amdmi3@FreeBSD.org>
CommitDate: 2021-06-10 17:12:30 +0000

    lang/python3[89]: remove LIBFFI option

    Python now requires libffi from ports and does not build with LIBFFI
    disabled, so remove the option.

    PR:             256141
    Reported by:    majo-bugs.freebsd.org@cerny.sk
    Reviewed by:    koobs (python)
    Approved by:    koobs (python)
    MFH:            2020Q2 (bugfix)

    (cherry picked from commit 64be746e535b0ca620460c95a819b81ac2159d01)

 lang/python38/Makefile | 17 +++++------------
 lang/python39/Makefile | 17 +++++------------
 2 files changed, 10 insertions(+), 24 deletions(-)