Closed ehaupt closed 5 months ago
Through some blind prodding I got it to compile:
I've added -D__BSD_VISIBLE=1
manually to the EXTRA_CFLAGS
in config.mk
after I ran the configure script.
I don't know if gbsplay really works that way, because I only have a remote shell account and can't test it properly.
We'll then have to find out how to set that flag automatically - or even better, what to do so we don't have to set it at all.
I've found this bug report https://github.com/kcat/openal-soft/issues/4 that mentions some flags that should not be set or types like u_long
and friends will become unavailable.
I think we need some BSD expertise here.
Through some blind prodding I got it to compile: I've added -D__BSD_VISIBLE=1 manually to the EXTRA_CFLAGS in config.mk after I ran the configure script.
That worked. I'll further test the functionality.
From what I can tell, gbsplay
works as expected. I was able to successfully play the nightmode.gbs
sample.
Unfortunately dfa1f23 didn't solve the issue.
See:
curl https://critical.ch/people/gbsplay-issue-105/typescript-noextraflags.txt
Adding -D__BSD_VISIBLE=1
to CFLAGS
is still required.
See:
curl https://critical.ch/people/gbsplay-issue-105/typescript-extraflags.txt
I've tried to make a minimal broken example that we can include in our configure script to eg. detect if using sys/soundcard.h
needs to have __BSD_VISIBLE
set to true.
Unfortunately I could not get an example that does not compile. This compiles cleanly when just called as cc foo.c
:
#include <sys/soundcard.h>
#include <stdio.h>
int main(int argc, char **argv) {
snd_capabilities capabilites;
printf("%ld\n", sizeof(capabilites));
return 0;
}
The snd_capabilites
struct contains 5 u_long
s and 1 u_short
.
So it seems that our other compile flags somehow play into this, this needs further testing.
I have also found out that sys/soundcard.h
contains multiple sound systems: The basic OSS /dev/dsp
interface as well as a new FreeBSD AIO interface. Only the AIO interface uses the u_*
types so theoretically we would be fine if the header file was split into two…
Apart from https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=de5df6489b6b425b8c626a7e524808ef6dc277ba I did not find any real documentation on how to use AIO yet.
With more information we could write a FreeBSD specific AIO audio driver, just like DirectSound for Windows. But without fixing the compile problems this would not help us anyway.
I have bisected the code and found the culprit:
Commit fad6a3e3b951de1f7def3 introduces the POSIX-enablement flags
GBSCFLAGS := -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200809L
which seem to disable __BSD_VISIBLE
.
We now have a CI pipeline that is able to reproduce this very bug and thus fails :wink: https://github.com/mmitch/gbsplay/actions?query=workflow%3A%22FreeBSD+Build%22
@mmitch Big thanks for sorting out the FreeBSD issue with GBSplay. Really appreciate your effort! Having a FreeBSD pipeline is an awesome bonus!
@ehaupt Could you please test it?
The fix has been merged to the master branch.
The configure script should now automatically set __BSD_VISIBLE
on FreeBSD.
@mmitch, I can confirm that e59ba36 fixes the issue. Thank you!
I think we'll do another release then, even if it breaks our habit of multiple years going by between releases…
Trying to compile version
0.0.95
I get:Including
<sys/types.h>
does not help.Full build log