Tiny Core Linux

Tiny Core Extensions => TCE Talk => Topic started by: GNUser on January 11, 2024, 09:19:26 AM

Title: trouble compiling pipewire 1.0.1
Post by: GNUser on January 11, 2024, 09:19:26 AM
I'm trying to compile pipewire 1.0.1 (https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/1.0.1/pipewire-1.0.1.tar.bz2) on TCL15-alpha x86_64 to tinker with sound and possibly submit it as an extension if it works.

I'm following the build notes here (http://repo.tinycorelinux.net/12.x/x86_64/tcz/src/pipewire/compile_pipewire) but am getting stuck at the complilation (ninja) step with this error:

Code: [Select]
$ ninja
...
attribute=format -Wsign-compare -Wpointer-arith -Wpointer-sign -Wformat -Wformat-security -Wimplicit-fallthrough -Wmissing-braces -Wtype-limits -Wvariadic-macros -Wmaybe-uninitialized -Wno-missing-field-initializers -Wno-unused-parameter -Wno-pedantic -Wdeprecated-declarations -Wunused-result -Werror=return-type -D_GNU_SOURCE -DFASTPATH -Werror=implicit-function-declaration -Werror=int-conversion -Werror=old-style-declaration -Werror=old-style-definition -Werror=missing-parameter-type -Werror=strict-prototypes -fPIC -MD -MQ spa/plugins/v4l2/libspa-v4l2.so.p/v4l2-udev.c.o -MF spa/plugins/v4l2/libspa-v4l2.so.p/v4l2-udev.c.o.d -o spa/plugins/v4l2/libspa-v4l2.so.p/v4l2-udev.c.o -c ../spa/plugins/v4l2/v4l2-udev.c
../spa/plugins/v4l2/v4l2-udev.c: In function ‘remove_device’:
../spa/plugins/v4l2/v4l2-udev.c:136:21: error: void value not ignored as it ought to be
  136 |         device->dev = udev_device_unref(device->dev);
      |                     ^
[235/1217] Linking target spa/plugins/audioconvert/libspa-audioconvert.so
lto-wrapper: warning: using serial compilation of 4 LTRANS jobs
lto-wrapper: note: see the ‘-flto’ option documentation for more information
[236/1217] Linking target spa/plugins/bluez5/libspa-bluez5.so
lto-wrapper: warning: using serial compilation of 10 LTRANS jobs
lto-wrapper: note: see the ‘-flto’ option documentation for more information
ninja: build stopped: subcommand failed.
Command exited with non-zero status 1
I've tried loading every extension with "udev" or "v4l" in the name, to no avail.

Does anyone know how to get past the "../spa/plugins/v4l2/v4l2-udev.c:136:21: error: void value not ignored as it ought to be" error?

Title: Re: trouble compiling pipewire 1.0.1
Post by: curaga on January 11, 2024, 10:39:28 AM
This is a coding thing, it expects a different version (API) of udev. Perhaps Ubuntu etc has a patch. It's not something a one-line sed can safely change.
Title: Re: trouble compiling pipewire 1.0.1
Post by: Rich on January 11, 2024, 10:43:10 AM
Hi GNUser
...
Code: [Select]
----- Snip -----
spa/plugins/v4l2/libspa-v4l2.so.p/v4l2-udev.c.o -c ../spa/plugins/v4l2/v4l2-udev.c
../spa/plugins/v4l2/v4l2-udev.c: In function ‘remove_device’:
../spa/plugins/v4l2/v4l2-udev.c:136:21: error: void value not ignored as it ought to be
  136 |         device->dev = udev_device_unref(device->dev);
      |                     ^
 ----- Snip -----
Gcc is saying  udev_device_unref  returns a  void  and its being
assigned to a non-void variable (device->dev)

According to this:
https://manpages.debian.org/testing/libudev-dev/udev_device_unref.3.en.html#SYNOPSIS
udev_device_unref  returns a  struct udev_device  pointer.
And here it states:
https://manpages.debian.org/testing/libudev-dev/udev_device_unref.3.en.html#RETURN_VALUE
udev_device_unref  always returns  NULL.

According to this:
http://ftp.ntu.edu.tw/linux/utils/kernel/hotplug/libudev/libudev-udev-device.html#udev-device-unref
udev_device_unref  return type as  void.

/usr/local/include/libudev.h  from  udev-dev.tcz  also defines
udev_device_unref  return type as  void.

If you look in  spa/plugins/v4l2/libspa-v4l2.so.p/v4l2-udev.c  you'll
see  udev_device_unref  is used 3 times, but only 1 of those times
is there an attempt to use the return value:
Code: [Select]
static void remove_device(struct impl *this, struct device *device)
{
        device->dev = udev_device_unref(device->dev);
        stop_watching_device(this, device);
        *device = this->devices[--this->n_devices];
}
Based on the name of the function (remove_device) and what the
author did, it appears he wanted to set  device->dev  equal to  NULL
using the return value of  udev_device_unref.

If that is the case, the source should probably be changed to this:
Code: [Select]
static void remove_device(struct impl *this, struct device *device)
{
        udev_device_unref(device->dev);
        device->dev = NULL;
        stop_watching_device(this, device);
        *device = this->devices[--this->n_devices];
}
Title: Re: trouble compiling pipewire 1.0.1
Post by: GNUser on January 11, 2024, 11:19:29 AM
Hi curaga. I'm glad it's not a compilation issue. I was starting to feel stupid.

Hi Rich. I can feel lightning bolts of wizard-power through your post! Sure enough, compilation completes successfully with the edit you suggested. I will test the finished product to make sure everything seems to be working, given that the edit is probably a workaround for a udev API discrepancy as curaga suggested.