Hey all
I don't know exactly for how long, but jack support seems broken in current git master. This is how I compile Pd:
$ ./autogen.sh $ ./configure --enable-jack $ make -j
The resulting binary doesn't link against jack libraries:
$ ldd src/pd linux-gate.so.1 => (0xb7757000) libasound.so.2 => /usr/lib/i386-linux-gnu/libasound.so.2 (0xb760c000) libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb75ef000) libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb75e9000) libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7594000) libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb73de000) librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb73d5000) /lib/ld-linux.so.2 (0x80015000)
When I start:
$ pd -jack -channels 2
It segfaults.
Roman
On 07/06/2017 09:17 PM, Roman Haefeli wrote:
Hey all
I don't know exactly for how long, but jack support seems broken in current git master. This is how I compile Pd:
$ ./autogen.sh $ ./configure --enable-jack $ make -j
The resulting binary doesn't link against jack libraries:
$ ldd src/pd linux-gate.so.1 => (0xb7757000) libasound.so.2 => /usr/lib/i386-linux-gnu/libasound.so.2 (0xb760c000) libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb75ef000) libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb75e9000) libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7594000) libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb73de000) librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb73d5000) /lib/ld-linux.so.2 (0x80015000)
When I start:
$ pd -jack -channels 2
It segfaults.
unable to repdroduce (Debian/buster+sid, amd64)
but then, i haven't run Pd on a i386 architecture on linux for quite some time.
what's the output of configure? (the lines about jack). do you have a backtrace?
$ pd -jack -channels 2
i guess you did a 'make install' inbetween (or really did a "./src/pd ..."). just to make sure...
$ make -j
whoa. this would lock my machine (it's almost a fork-bomb!)
gfmadsr IOhannes
On Don, 2017-07-06 at 22:35 +0200, IOhannes m zmölnig wrote:
On 07/06/2017 09:17 PM, Roman Haefeli wrote:
Hey all
I don't know exactly for how long, but jack support seems broken in current git master. This is how I compile Pd:
$ ./autogen.sh $ ./configure --enable-jack $ make -j
The resulting binary doesn't link against jack libraries:
$ ldd src/pd linux-gate.so.1 => (0xb7757000) libasound.so.2 => /usr/lib/i386-linux-gnu/libasound.so.2 (0xb760c000) libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb75ef000) libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb75e9000) libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7594000) libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb73de000) librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb73d5000) /lib/ld-linux.so.2 (0x80015000)
When I start:
$ pd -jack -channels 2
It segfaults.
unable to repdroduce (Debian/buster+sid, amd64)
This is on Ubuntu 16.04 amd64 and i386. And yes, on Debian jessie amd64 it works fine for me, too.
but then, i haven't run Pd on a i386 architecture on linux for quite some time.
what's the output of configure? (the lines about jack). do you have a backtrace?
$ pd -jack -channels 2
i guess you did a 'make install' inbetween (or really did a "./src/pd ..."). just to make sure...
yes
Just to sum it up for others reading this. This issue appears on Ubuntu 16.04 and (according to a #dataflow user) on Gentoo. I had a shared SSH session with IOhannes and he investigated the problem. I might be not be able to fully explain what he found out, but it is related to weak linking and the way the the compiler that comes with Ubuntu 16.04 handles it. IOhannes proposed to add the '-Wl,--no-as-needed' linker flag like this:
$ ./configure --enable-jack LDFLAGS="-Wl,--no-as-needed"
Roman
On 07/07/2017 12:50 AM, Roman Haefeli wrote:
When I start:
$ pd -jack -channels 2
It segfaults.
there's actually two issues we discovered. - on some systems, the Pd binary ends up not being dynamically linked against libjack (even though "-ljack" is passed to the linker) - if this is the case, Pd segfaults when the jack backend is selected.
Just to sum it up for others reading this. This issue appears on Ubuntu 16.04 and (according to a #dataflow user) on Gentoo. I had a shared SSH session with IOhannes and he investigated the problem. I might be not be able to fully explain what he found out, but it is related to weak linking and the way the the compiler that comes with Ubuntu 16.04 handles it.
the issue is, that jack.h declares all symbols as "weak" symbols (so they might be missing) from the actually used dynamic library and Pd can still load. if the linker has the "--as-needed" flag (which is enabled by default on Ubuntu-16.04LTS), the linker will only link against a dynamic library if the application uses at least one non-weak symbol. since all symbols in jack.h are declared as weak, the linker simply removes the dependeny on libjack, and sets all function pointers to NULL.
foremost, this explains why Pd is crashing in this case: Pd has been compiled with USEAPI_JACK, but then the "jack_client_open" function is really just a NULL-pointer. there is already a check for this in place, to just fail the request to open a jack device (since on OSX we have weak linking by default), but unfortunately this is only active on OSX, thus making it crash on e.g. linux.
there's a pull-request [93] on github to fix the crash.
IOhannes proposed to add the '-Wl,--no-as-needed' linker flag like this:
$ ./configure --enable-jack LDFLAGS="-Wl,--no-as-needed"
this is a hack for the other problem.
for the record: i consider this a workaround for systems were the linker defaults to stripping unused libraries ("--as-needed").
I don't think that Pd is the actual culprit here, and I'm currently investigating whether the problem is with libjack or with gcc.
esp. i'm (currently) pretty convinced that "--no-as-needed" should *not* be added by Pd's build system by default.
msdt IOhannes
Thank you, IOhannes, for spotting all this!
Roman
On Fre, 2017-07-07 at 10:57 +0200, IOhannes m zmölnig wrote:
On 07/07/2017 12:50 AM, Roman Haefeli wrote:
When I start:
$ pd -jack -channels 2
It segfaults.
there's actually two issues we discovered.
- on some systems, the Pd binary ends up not being dynamically linked
against libjack (even though "-ljack" is passed to the linker)
- if this is the case, Pd segfaults when the jack backend is
selected.
Just to sum it up for others reading this. This issue appears on Ubuntu 16.04 and (according to a #dataflow user) on Gentoo. I had a shared SSH session with IOhannes and he investigated the problem. I might be not be able to fully explain what he found out, but it is related to weak linking and the way the the compiler that comes with Ubuntu 16.04 handles it.
the issue is, that jack.h declares all symbols as "weak" symbols (so they might be missing) from the actually used dynamic library and Pd can still load. if the linker has the "--as-needed" flag (which is enabled by default on Ubuntu-16.04LTS), the linker will only link against a dynamic library if the application uses at least one non-weak symbol. since all symbols in jack.h are declared as weak, the linker simply removes the dependeny on libjack, and sets all function pointers to NULL.
foremost, this explains why Pd is crashing in this case: Pd has been compiled with USEAPI_JACK, but then the "jack_client_open" function is really just a NULL-pointer. there is already a check for this in place, to just fail the request to open a jack device (since on OSX we have weak linking by default), but unfortunately this is only active on OSX, thus making it crash on e.g. linux.
there's a pull-request [93] on github to fix the crash.
IOhannes proposed to add the '-Wl,--no-as-needed' linker flag like this:
$ ./configure --enable-jack LDFLAGS="-Wl,--no-as-needed"
this is a hack for the other problem.
for the record: i consider this a workaround for systems were the linker defaults to stripping unused libraries ("--as-needed").
I don't think that Pd is the actual culprit here, and I'm currently investigating whether the problem is with libjack or with gcc.
esp. i'm (currently) pretty convinced that "--no-as-needed" should *not* be added by Pd's build system by default.
msdt IOhannes
[93] https://github.com/pure-data/pure-data/pull/93
Pd-dev mailing list Pd-dev@lists.iem.at https://lists.puredata.info/listinfo/pd-dev
On Fre, 2017-07-07 at 10:57 +0200, IOhannes m zmölnig wrote:
On 07/07/2017 12:50 AM, Roman Haefeli wrote:
When I start:
$ pd -jack -channels 2
It segfaults.
there's actually two issues we discovered.
- on some systems, the Pd binary ends up not being dynamically linked
against libjack (even though "-ljack" is passed to the linker)
- if this is the case, Pd segfaults when the jack backend is
selected.
Just to sum it up for others reading this. This issue appears on Ubuntu 16.04 and (according to a #dataflow user) on Gentoo. I had a shared SSH session with IOhannes and he investigated the problem. I might be not be able to fully explain what he found out, but it is related to weak linking and the way the the compiler that comes with Ubuntu 16.04 handles it.
the issue is, that jack.h declares all symbols as "weak" symbols (so they might be missing) from the actually used dynamic library and Pd can still load. if the linker has the "--as-needed" flag (which is enabled by default on Ubuntu-16.04LTS), the linker will only link against a dynamic library if the application uses at least one non-weak symbol. since all symbols in jack.h are declared as weak, the linker simply removes the dependeny on libjack, and sets all function pointers to NULL.
foremost, this explains why Pd is crashing in this case: Pd has been compiled with USEAPI_JACK, but then the "jack_client_open" function is really just a NULL-pointer. there is already a check for this in place, to just fail the request to open a jack device (since on OSX we have weak linking by default), but unfortunately this is only active on OSX, thus making it crash on e.g. linux.
there's a pull-request [93] on github to fix the crash.
IOhannes proposed to add the '-Wl,--no-as-needed' linker flag like this:
$ ./configure --enable-jack LDFLAGS="-Wl,--no-as-needed"
this is a hack for the other problem.
for the record: i consider this a workaround for systems were the linker defaults to stripping unused libraries ("--as-needed").
I don't think that Pd is the actual culprit here, and I'm currently investigating whether the problem is with libjack or with gcc.
esp. i'm (currently) pretty convinced that "--no-as-needed" should *not* be added by Pd's build system by default.
msdt IOhannes
Someone from #dataflow was asking in #jack about this and reported back:
simonvanderveldt> rdz: After some more investigation and discussion in #jack I think the conclusion is that weakjack.h should only be included on macOS/OS X and not on linux. If I remove that import everything works as it should, the linking works and my jack doesn't segfault once it's linked and I'm trying to connect to jack through Pd <simonvanderveldt> The code already shows a conditional for the weak jack client creation https://github.com/pure-data/pure-data/blob/master /src/s_audio_jack.c#L311 and the additional of the weakjack.h import was done to fix issues on mac https://github.com/pure-data/pure- data/commit/73362cc6a57d89337815023f1ffc4ee0adc1de55 <simonvanderveldt> The other way around around, the non mac call to jack_client_open (https://github.com/pure-data/pure-data/blob/master/sr c/s_audio_jack.c#L341) isn't conditional which seems to indicate that weak linking wasn't desired there <simonvanderveldt> also falk said weakjack never really worked in Linux, also a good pointer :P
So the question is: Why do we want Pd to have weak-linking support on Linux at all? I don't see an advantage. I commented out the line:
#include <jack/weakjack.h>
and I was successfully compiling Pd.
The file /usr/include/jack/weakjack.h has some more info about this and states:
"It is important to understand that very few clients need to do this - if you use this feature you should have a clear reason to do so."
Roman
Now I'm having a hard believing myself, but apparently the last commit that builds a pd linked against libjack is: 637ef74e
(which is over a year old. Can that be true?)
Roman
On Don, 2017-07-06 at 21:17 +0200, Roman Haefeli wrote:
Hey all
I don't know exactly for how long, but jack support seems broken in current git master. This is how I compile Pd:
$ ./autogen.sh $ ./configure --enable-jack $ make -j
The resulting binary doesn't link against jack libraries:
$ ldd src/pd linux-gate.so.1 => (0xb7757000) libasound.so.2 => /usr/lib/i386-linux-gnu/libasound.so.2 (0xb760c000) libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb75ef000) libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb75e9000) libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7594000) libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb73de000) librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb73d5000) /lib/ld-linux.so.2 (0x80015000)
When I start:
$ pd -jack -channels 2
It segfaults.
Roman