Bug 270977 - multimedia/dav1d: Fails to build with TEST=ON due to missing typedef cpu_set_t
Summary: multimedia/dav1d: Fails to build with TEST=ON due to missing typedef cpu_set_t
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Jan Beich
URL:
Keywords:
Depends on: 259787
Blocks:
  Show dependency treegraph
 
Reported: 2023-04-21 12:52 UTC by Ross McKelvie
Modified: 2023-04-25 00:51 UTC (History)
3 users (show)

See Also:
jbeich: maintainer-feedback+
jbeich: merge-quarterly+


Attachments
Poudriere test log for multimedia/dav1d on 12.4-RELEASE (84.14 KB, text/plain)
2023-04-21 12:52 UTC, Ross McKelvie
no flags Details
[patch] cpu_set_t is not in 12.4 (1.57 KB, patch)
2023-04-21 21:03 UTC, John Hein
jbeich: maintainer-approval+
Details | Diff
Poudriere test log for patched multimedia/dav1d on 12.4-RELEASE (279.74 KB, text/plain)
2023-04-24 08:50 UTC, Ross McKelvie
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ross McKelvie 2023-04-21 12:52:47 UTC
Created attachment 241629 [details]
Poudriere test log for multimedia/dav1d on 12.4-RELEASE

multimedia/dav1d fails to build with TEST=ON with the message:

BEGINS
../tests/checkasm/checkasm.c:623:13: error: unknown type name 'cpu_set_t'; did you mean 'cpuset_t'?
            cpu_set_t set;
            ^~~~~~~~~
            cpuset_t
/usr/include/sys/_cpuset.h:50:24: note: 'cpuset_t' declared here
typedef struct _cpuset cpuset_t;
                       ^
1 error generated.
ENDS

The missing cpu_set_t type appears to be a GNU extension to the POSIX standard:
https://www.gnu.org/software/libc/manual/html_node/CPU-Affinity.html

It seems equivalent to cpuset_t on FreeBSD. Other ports have been affected; see PR 259787.
Comment 1 John Hein 2023-04-21 21:03:56 UTC
Created attachment 241642 [details]
[patch] cpu_set_t is not in 12.4

The change that added cpu_set_t in FreeBSD base has not been merged back to 12.x (and probably never will be?).

The main dav1d source (in src/cpu.c) already has this:

#if defined(__FreeBSD__)
#define cpu_set_t cpuset_t
#endif

That is not needed anymore except in 12.x (and 13.0 which is no longer supported).  So that conditional #define won't be needed after 12.x goes EOL and is [now] overly broad as it is not needed in 13.1 and later.

Try the attached patch - it is just for TEST code and can be removed after 12.x goes EOL.  I didn't see the point in bothering with an upstream change for the relatively short time before 12.x EOL.
Comment 2 Ross McKelvie 2023-04-24 08:48:35 UTC
Thanks, John, that patch works well; I've attached the log.

I agree with your sentiment about the upstream change given that it is unnecessary for supported 13.x releases onwards.

In your opinion would it would be worth changing upstream now to remove the conditional define from src/cpu.c and instead including it as a patch to the port so that all the conditional defines are in one codebase (that is, the multimedia/dav1d port)?

Many thanks.
Comment 3 Ross McKelvie 2023-04-24 08:50:34 UTC
Created attachment 241694 [details]
Poudriere test log for patched multimedia/dav1d on 12.4-RELEASE
Comment 4 commit-hook freebsd_committer freebsd_triage 2023-04-25 00:48:15 UTC
A commit in branch main references this bug:

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

commit a50457696509832e70738d2afa9f68e11ab4e171
Author:     John Hein <jcfyecrayz@liamekaens.com>
AuthorDate: 2023-04-21 21:03:56 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-04-25 00:44:41 +0000

    multimedia/dav1d: unbreak TEST=on on FreeBSD < 13 after 17e9745faede

    ../tests/checkasm/checkasm.c:623:13: error: unknown type name 'cpu_set_t'; did you mean 'cpuset_t'?
                cpu_set_t set;
                ^~~~~~~~~
                cpuset_t
    /usr/include/sys/_cpuset.h:50:24: note: 'cpuset_t' declared here
    typedef struct _cpuset cpuset_t;
                           ^

    PR:             270977
    Reported by:    Ross McKelvie

 multimedia/dav1d/files/patch-freebsd12 (new) | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
Comment 5 commit-hook freebsd_committer freebsd_triage 2023-04-25 00:49:17 UTC
A commit in branch 2023Q2 references this bug:

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

commit d8032adfa543d561592525ac9142cc144954c7e0
Author:     John Hein <jcfyecrayz@liamekaens.com>
AuthorDate: 2023-04-21 21:03:56 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-04-25 00:47:57 +0000

    multimedia/dav1d: unbreak TEST=on on FreeBSD < 13 after 17e9745faede

    ../tests/checkasm/checkasm.c:623:13: error: unknown type name 'cpu_set_t'; did you mean 'cpuset_t'?
                cpu_set_t set;
                ^~~~~~~~~
                cpuset_t
    /usr/include/sys/_cpuset.h:50:24: note: 'cpuset_t' declared here
    typedef struct _cpuset cpuset_t;
                           ^

    PR:             270977
    Reported by:    Ross McKelvie

    (cherry picked from commit a50457696509832e70738d2afa9f68e11ab4e171)

 multimedia/dav1d/files/patch-freebsd12 (new) | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
Comment 6 Jan Beich freebsd_committer freebsd_triage 2023-04-25 00:51:28 UTC
Comment on attachment 241642 [details]
[patch] cpu_set_t is not in 12.4

I've slightly reworded the patch comment and dropped superfluous Makefile conditional.