Skip to content

Various fixes for compilation with mingw

Orion Poplawski requested to merge opoplawski/pulseaudio:mingw into master

I'm trying to compile pulseaudio with mingw on Fedora rawhide and running into some compile errors. The changes here to arpa-inet.c I'm fairly confident in. The other changes to #ifdef out getuid() are more of a quick hack. I suspect for the module-console-kit case it would be better to simply disable the module somehow. But in my case HAVE_DBUS is true.

I'm also running into the following compile error:

x86_64-w64-mingw32-gcc -Isrc/libpulsecommon-16.1.dll.p -I. -I.. -Isrc -I../src -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/opus -I/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig/../../include/dbus-1.0 -I/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig/../../lib/dbus-1.0/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/glib-2.0 -I/usr/x86_64-w64-mingw32/sys-root/mingw/lib/glib-2.0/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/gtk-3.0 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/pango-1.0 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/gdk-pixbuf-2.0 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/cairo -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/atk-1.0 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/harfbuzz -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/freetype2 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/pixman-1 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/fribidi -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/libpng16 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu11 -O0 -g -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -mms-bitfields -mms-bitfields -pthread -DHAVE_CONFIG_H -D_GNU_SOURCE -MD -MQ src/libpulsecommon-16.1.dll.p/pulse_fork-detect.c.obj -MF src/libpulsecommon-16.1.dll.p/pulse_fork-detect.c.obj.d -o src/libpulsecommon-16.1.dll.p/pulse_fork-detect.c.obj -c ../src/pulse/fork-detect.c
In file included from ../src/pulsecore/atomic.h:25,
                 from ../src/pulse/fork-detect.c:26:
../src/pulse/fork-detect.c: In function 'pa_detect_fork':
../src/pulsecore/macro.h:202:13: error: duplicate case value
  202 |             case !!(expr):                         \
      |             ^~~~
../src/pulse/fork-detect.c:40:5: note: in expansion of macro 'pa_assert_cc'
   40 |     pa_assert_cc(sizeof(pa_atomic_t) >= sizeof(pid_t));
      |     ^~~~~~~~~~~~
../src/pulsecore/macro.h:201:13: note: previously used here
  201 |             case 0:                                \
      |             ^~~~
../src/pulse/fork-detect.c:40:5: note: in expansion of macro 'pa_assert_cc'
   40 |     pa_assert_cc(sizeof(pa_atomic_t) >= sizeof(pid_t));
      |     ^~~~~~~~~~~~

Which is coming from:

int pa_detect_fork(void) {
    static pa_atomic_t pid = PA_ATOMIC_INIT((int) -1);

    /* Some really stupid applications (Hey, vim, that means you!)
     * love to fork after initializing
     * gtk/libcanberra/pulseaudio. This is really bad style. We
     * however have to deal with this cleanly, so we try to detect the
     * forks making sure all our calls fail cleanly after the fork. */

    pa_assert_cc(sizeof(pa_atomic_t) >= sizeof(pid_t));

and really don't know what to do here.

Merge request reports