FS#76259 - [ladspa] LADSPA filter plugin has unresolved libm symbols

Attached to Project: Arch Linux
Opened by Martin Rodriguez Reboredo (yakoyakoyokuyoku) - Friday, 21 October 2022, 13:24 GMT
Last edited by David Runge (dvzrv) - Saturday, 02 September 2023, 16:58 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To David Runge (dvzrv)
Architecture x86_64
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

When I was trying to run PipeWire with a filter chain that has a LADSPA node with a Low Pass filter the service failed to start. Searching through the logs it shows that a no such file or directory error happened, so I've run `listplugins` to see if the filter plugin, `filter.so`, was indeed listed but to my surprise it didn't appear. Listing its details with `analyseplugin filter.so` worked as expected, so I started to suspect that a link to a library was missing. Then I've listed its dynamic symbols with `nm -D -u` and in the output it had two symbols, `sqrtf` and `cos`, both members of libm which made me realize that it was missing and indeed, `ldd` confirms this.

```
$ LD_WARN=1 ldd -r /usr/lib/ladspa/filter.so
linux-vdso.so.1 (0x00007ffe0e9c9000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007fb7f420a000)
/usr/lib64/ld-linux-x86-64.so.2 (0x00007fb7f444c000)
undefined symbol: sqrtf (/usr/lib/ladspa/filter.so)
undefined symbol: cos (/usr/lib/ladspa/filter.so)
```

So to fix the issue I've used the following patch.

```patch
--- a/src/Makefile
+++ b/src/Makefile
@@ -41,6 +41,7 @@ CPP = c++
plugins/$*.o \
-shared \
$(CFLAGS) \
+ -lm \
-fvisibility=hidden \
-fvisibility-inlines-hidden \
-s \
@@ -52,6 +53,7 @@ CPP = c++
plugins/$*.o \
-shared \
$(CXXFLAGS) \
+ -lm \
-fvisibility=hidden \
-fvisibility-inlines-hidden \
-s \
```

Additional info:
* package version(s): ladspa 1.17

Steps to reproduce:

1. Use this config for PipeWire.

```
context.modules = [
{ name = libpipewire-module-filter-chain
args = {
node.description = "Noise Canceling sink"
media.name = "Noise Canceling sink"
filter.graph = {
nodes = [
{
type = ladspa
name = lopassL
plugin = /usr/lib/ladspa/filter.so
label = lpf
control = {
"Cutoff Frequency (Hz)" 440
}
}
{
type = ladspa
name = lopassR
plugin = /usr/lib/ladspa/filter.so
label = lpf
control = {
"Cutoff Frequency (Hz)" 440
}
}
]
inputs = [ "lopassL:Input" "lopassR:Input" ]
outputs = [ "lopassL:Output" "lopassR:Output" ]
}
capture.props = {
node.name = "effect_output.rnnoise"
media.class = Audio/Sink
audio.channels = 2
audio.position = [ FL FR ]
audio.rate = 48000
}
playback.props = {
node.name = "effect_input.rnnoise"
node.passive = true
audio.channels = 2
audio.position = [ FL FR ]
audio.rate = 48000
}
}
}
]
```

2. List plugins with `listplugins` or try to autocomplete `analyseplugin` and see that `filter` is not available.

3. Show the symbols of `/usr/lib/ladspa/filter.so` with `nm -D -u` and list its rundeps with `LD_WARN=1 ldd -r /usr/lib/ladspa/filter.so`.
This task depends upon

Closed by  David Runge (dvzrv)
Saturday, 02 September 2023, 16:58 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed with 1.17-4
Comment by Toolybird (Toolybird) - Friday, 21 October 2022, 23:00 GMT
If the plugin is built incorrectly, the fix should probably be sent upstream? Not sure if our LDFLAGS are a factor here..
Comment by Martin Rodriguez Reboredo (yakoyakoyokuyoku) - Saturday, 22 October 2022, 18:54 GMT
AFAICT there's no clear upstream of the LADSPA SDK for me to submit the fix, so I dunno. Also the Makefile of LADSPA uses its own definitions, so both flags and compilers are ignored by it.
Comment by David Runge (dvzrv) - Sunday, 23 October 2022, 09:06 GMT
@yakoyakoyokuyoku: Thanks for the ticket.

If this is indeed a build issue, then upstream should be contacted about this. To quote the website [1]: "The author (Richard Furse) can be emailed at richard at ladspa dot org."

We currently carry a patch also for a memory leak in the search functionality, so I can try and contact them about these issues.

[1] https://www.ladspa.org/
Comment by David Runge (dvzrv) - Sunday, 23 October 2022, 09:30 GMT
Sent a mail outlining this and two other issues. If they fix it in the code base and do a release, it is the much preferred option (as it benefits all downstreams).
Comment by Martin Rodriguez Reboredo (yakoyakoyokuyoku) - Monday, 31 October 2022, 01:18 GMT
AFAICT there's no clear upstream of the LADSPA SDK for me to submit the fix, so I dunno. Also the Makefile of LADSPA uses its own definitions, so both flags and compilers are ignored by it.
Comment by Martin Rodriguez Reboredo (yakoyakoyokuyoku) - Monday, 31 October 2022, 01:18 GMT
AFAICT there's no clear upstream of the LADSPA SDK for me to submit the fix, so I dunno. Also the Makefile of LADSPA uses its own definitions, so both flags and compilers are ignored by it.
Comment by Martin Rodriguez Reboredo (yakoyakoyokuyoku) - Monday, 31 October 2022, 01:19 GMT
Was refreshing the page and the comment was resubmitted, sorry for the noise.
Comment by David Runge (dvzrv) - Friday, 14 July 2023, 09:00 GMT
I've resent my mail from months ago. If there is no answer within the coming week, I will apply stuff in the PKGBUILD.

Loading...