Bug 268250

Summary: audio/pulseaudio: fix build with clang 15
Product: Ports & Packages Reporter: Dimitry Andric <dim>
Component: Individual Port(s)Assignee: freebsd-desktop (Team) <desktop>
Status: Closed FIXED    
Severity: Affects Some People Flags: jbeich: merge-quarterly+
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 265425    
Attachments:
Description Flags
audio/pulseaudio: fix build with clang 15 none

Description Dimitry Andric freebsd_committer freebsd_triage 2022-12-08 17:07:00 UTC
audio/pulseaudio: fix build with clang 15

During an exp-run for llvm 15 (see bug 265425), it turned out that devel/pulseaudio failed to build with clang 15:

  checking whether C compiler accepts -std=gnu11... no
  configure: error: *** Compiler does not support -std=gnu11
  ===>  Script "configure" failed unexpectedly.

The configure script compiles a few test cases with -pedantic -Werror, and with clang 15 this results in a -Wstrict-prototypes error, since the test cases use "int main ()" instead of "int main (void)".

Replace instances of "int main()" with "int main (void)" in the configure script to work around this problem.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2022-12-08 17:07:22 UTC
Created attachment 238639 [details]
audio/pulseaudio: fix build with clang 15
Comment 2 Jan Beich freebsd_committer freebsd_triage 2022-12-10 20:17:09 UTC
* configure (autoconf + autoconf-archive) was dropped in pulseaudio >= 15 in https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/f4bce0bb9808
* -Werror was originally introduced in https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/1afd23363018
* meson.build in pulseaudio >= 13 didn't inherit -Werror nor -pedantic nor -Wall -Wextra ...
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-12-10 20:37:36 UTC
A commit in branch main references this bug:

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

commit a968b5fd5ef3b5a20c5d507697e354cfa5d07743
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-12-08 17:00:36 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2022-12-10 20:36:16 +0000

    audio/pulseaudio: unbreak build with clang 15

    checking whether C compiler accepts -std=gnu11... no
    configure: error: *** Compiler does not support -std=gnu11
    [...]
    configure:9379: cc -c -O2 -pipe  -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -pedantic -Werror -std=gnu11 -DLIBICONV_PLUG -isystem /usr/local/include conftest.c >&5
    conftest.c:33:6: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    main ()
         ^
          void

    https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/1afd23363018
    https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=1717921aa6c1

    PR:             268250
    Reported by:    antoine (via bug 265425 exp-run)

 audio/pulseaudio/Makefile | 1 +
 1 file changed, 1 insertion(+)
Comment 4 commit-hook freebsd_committer freebsd_triage 2022-12-10 20:37:37 UTC
A commit in branch 2022Q4 references this bug:

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

commit 55f0944dd76f358ca1ca8c9aa1bc0b4f6e53c34f
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-12-08 17:00:36 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2022-12-10 20:36:48 +0000

    audio/pulseaudio: unbreak build with clang 15

    checking whether C compiler accepts -std=gnu11... no
    configure: error: *** Compiler does not support -std=gnu11
    [...]
    configure:9379: cc -c -O2 -pipe  -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -pedantic -Werror -std=gnu11 -DLIBICONV_PLUG -isystem /usr/local/include conftest.c >&5
    conftest.c:33:6: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    main ()
         ^
          void

    https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/1afd23363018
    https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=1717921aa6c1

    PR:             268250
    Reported by:    antoine (via bug 265425 exp-run)

    (cherry picked from commit a968b5fd5ef3b5a20c5d507697e354cfa5d07743)

 audio/pulseaudio/Makefile | 1 +
 1 file changed, 1 insertion(+)
Comment 5 Jan Beich freebsd_committer freebsd_triage 2022-12-10 21:08:04 UTC
Thanks. Landed with cosmetic changes:
- dropped redundant bits from the commit message
- added reference to upstream fix which is in autoconf

Note, -pedantic made configure abort early but -Werror propagated to subsequent checks. One of those explicitly added -Wstrict-prototypes and also got propagated to subsequent checks, so some features could be misdetected.