Bug 99458 - Can't build with LLVM/clang because of introduced VLAIS
Summary: Can't build with LLVM/clang because of introduced VLAIS
Status: RESOLVED FIXED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium major
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 99067
  Show dependency treegraph
 
Reported: 2017-01-19 10:34 UTC by Tomasz Paweł Gajc
Modified: 2017-03-09 21:41 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Tomasz Paweł Gajc 2017-01-19 10:34:09 UTC
Hi,
looks like VLAIS has been introduced into pulseaudio-10.0.

Here is the log:

libtool: compile:  /usr/bin/clang -DHAVE_CONFIG_H -I. -I.. -I../src -I../src/modules -I../src/modules -DPA_ALSA_PATHS_DIR=\"/usr/share/pulseaudio/alsa-mixer/paths\" -DPA_ALSA_PROFILE_SETS_DIR=\"/usr/share/pulseaudio/alsa-mixer/profile-sets\" -DPA_SRCDIR=\"/builddir/build/BUILD/pulseaudio-10.0/src\" -DPA_BUILDDIR=\"/builddir/build/BUILD/pulseaudio-10.0/src\" -DPULSE_LOCALEDIR=\"/usr/share/locale\" -DFASTPATH -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -std=gnu11 -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -Os -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fPIC -flto -Wall -W -Wextra -Wno-long-long -Wno-overlength-strings -Wundef -Wformat=2 -Wsign-compare -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing -Wwrite-strings -Wno-unused-parameter -ffast-math -fno-common -fdiagnostics-show-option -fdiagnostics-color=auto -c pulsecore/iochannel.c  -fPIC -DPIC -o pulsecore/.libs/libpulsecommon_10.0_la-iochannel.o
make[3]: Leaving directory '/builddir/build/BUILD/pulseaudio-10.0/src'
pulsecore/iochannel.c:324:9: warning: cast from 'unsigned char *' to 'struct ucred *' increases required alignment from 1 to 4 [-Wcast-align]
    u = (struct ucred*) CMSG_DATA(&cmsg.hdr);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pulsecore/iochannel.c:358:17: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
        uint8_t data[CMSG_SPACE(sizeof(int) * nfd)];
                ^
pulsecore/iochannel.c:377:15: warning: cast from 'unsigned char *' to 'int *' increases required alignment from 1 to 4 [-Wcast-align]
    msgdata = (int*) CMSG_DATA(&cmsg.hdr);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
pulsecore/iochannel.c:450:35: warning: cast from 'unsigned char *' to 'int *' increases required alignment from 1 to 4 [-Wcast-align]
                        pa_close(((int*) CMSG_DATA(cmh))[i]);
                                  ^~~~~~~~~~~~~~~~~~~~~
3 warnings and 1 error generated.
make[3]: *** [Makefile:7816: pulsecore/libpulsecommon_10.0_la-iochannel.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Entering directory '/builddir/build/BUILD/pulseaudio-10.0/src'
Comment 1 Tanu Kaskinen 2017-01-24 08:10:08 UTC
Oops, we weren't aware that variable length arrays in structs would be forbidden by the C standard. Will fix.

Out of curiosity, what are you working on, how did you run into this issue? (It's interesting to know what projects are building pulseaudio with less common tools.)
Comment 2 Arun Raghavan 2017-01-24 11:53:17 UTC
As a side note, I'm just trying out building with clang on Travis (this was in our config, but commented out). If it works, will push it out so we have this tested as well.
Comment 3 Tomasz Paweł Gajc 2017-01-24 14:35:35 UTC
(In reply to Tanu Kaskinen from comment #1)
> Oops, we weren't aware that variable length arrays in structs would be
> forbidden by the C standard. Will fix.
> 

VLAIS is not a C standard, it's only a GNU extension.

> Out of curiosity, what are you working on, how did you run into this issue?
> (It's interesting to know what projects are building pulseaudio with less
> common tools.)

I'm from https://www.openmandriva.org distribution camp :)
We are building Linux with LLVM/clang almost everywhere.

Feel free to take a look on our build system:
https://abf.openmandriva.org/build_lists


Thanks for the fix.
Comment 4 Felipe Sateler 2017-01-31 18:41:21 UTC
(In reply to Arun Raghavan from comment #2)
> As a side note, I'm just trying out building with clang on Travis (this was
> in our config, but commented out). If it works, will push it out so we have
> this tested as well.

It appears it is now enabled?

https://travis-ci.org/pulseaudio/pulseaudio/jobs/196997520
Comment 5 Arun Raghavan 2017-02-01 11:40:08 UTC
Yes, the Clang build is now enabled on Travis.
Comment 6 Tomasz Paweł Gajc 2017-02-04 09:09:56 UTC
Any news when this issue will be fixed ?
Comment 7 Tanu Kaskinen 2017-02-04 12:22:02 UTC
Sorry for the delay. I submitted a patch now:
https://patchwork.freedesktop.org/patch/136885/
Comment 8 Tomasz Paweł Gajc 2017-02-18 13:11:14 UTC
Thanks for your patch. I've applied it and it works.

https://abf.openmandriva.org/build_lists/97905
Comment 9 Tanu Kaskinen 2017-03-09 21:41:26 UTC
The fix is now in the master branch.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.