mikebrady / shairport-sync

AirPlay and AirPlay 2 audio player
Other
7.17k stars 569 forks source link

Unable to compile under OpenBSD/amd64 [resolved] #658

Closed heinrichrebehn closed 3 years ago

heinrichrebehn commented 6 years ago

Hi all, has anybody been able to compile shairport-sync under OpenBSD/amd64? I downloaded the source and needed utilities, but when I issue 'autoreconf -i -f' the command runs forever eating up > 90% CPU.

Any ideas?

-Heinrich

mikebrady commented 6 years ago

Hi there. Have you looked at the FREEBSD page? (Sorry if it's an obvious question...)

mikebrady commented 6 years ago

Also -- are you compiling the regular (master) branch or the development branch?

heinrichrebehn commented 6 years ago

I saw this mail only now. No, I have not looked yet. Will do so now..

-Heinrich

heinrichrebehn commented 6 years ago

Hi Mike,

Thank you for your quick reply!

I am trying to compile from shairport-sync-3.1.7.tar.gz The problem that i initially reported, has been solved. It was an improper installation of autoconf.

Next problem was that OpenBSD does not have librt. I manually removed the related lines from configure.ac

Next issue was: Although i specified —without-alsa to ./configure I got errors saying ALSA was not found. Omitting this flag cleared the error.

Now "./configure --with-sndio --with-avahi” completes without error, but when I issue “make”, I get

shairport.c:31:23: error: libconfig.h: No such file or directory

find / -name libconfig.h

/usr/local/include/libconfig.h

Using ktrace(1) I found that libconfig.h is only looked for in /usr/include, not in /usr/local/include.

I linked /usr/local/include/libconfig.h to /usr/include/

Now I get:

make all-recursive Making all in man depbase=echo shairport.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'; gcc -DHAVE_CONFIG_H -I. -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\" -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\" -g -O2 -MT shairport.o -MD -MP -MF $depbase.Tpo -c -o shairport.o shairport.c && mv -f $depbase.Tpo $depbase.Po In file included from shairport.c:34: /usr/include/net/if.h:121: error: field 'ifi_lastchange' has incomplete type /usr/include/net/if.h:359: error: field 'ifru_addr' has incomplete type /usr/include/net/if.h:360: error: field 'ifru_dstaddr' has incomplete type /usr/include/net/if.h:361: error: field 'ifru_broadaddr' has incomplete type /usr/include/net/if.h:388: error: field 'ifrau_addr' has incomplete type /usr/include/net/if.h:394: error: field 'ifra_dstaddr' has incomplete type /usr/include/net/if.h:396: error: field 'ifra_mask' has incomplete type /usr/include/net/if.h:439: error: field 'addr' has incomplete type /usr/include/net/if.h:440: error: field 'dstaddr' has incomplete type /usr/include/net/if.h:446: error: expected specifier-qualifier-list before 'sa_family_t' In file included from /usr/include/net/if.h:455, from shairport.c:34: /usr/include/net/if_arp.h:79: error: field 'arp_pa' has incomplete type /usr/include/net/if_arp.h:80: error: field 'arp_ha' has incomplete type shairport.c:35:18: error: popt.h: No such file or directory shairport.c:78:29: error: libdaemon/dexec.h: No such file or directory

.. and many more

I am at a loss now.

Greetings,

Heinrich Rebehn

On 2. Feb 2018, at 15:35, Mike Brady notifications@github.com wrote:

Also -- are you compiling the regular (master) branch or the development branch?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

mikebrady commented 6 years ago

Thanks. Could you list the packages you've installed so far?

heinrichrebehn commented 6 years ago

pkg_info

autoconf-2.69p2 automatically configure source code on many Unx platforms automake-1.15.1 GNU Standards-compliant Makefile generator avahi-0.7p0 framework for Multicast DNS Service Discovery bash-4.4.12p0 GNU Bourne Again Shell bzip2-1.0.6p8 block-sorting file compressor, unencumbered dbus-1.10.22p0v0 message bus system dbus-daemon-launch-helper-1.10.22p0 DBus setuid helper for starting system services gdbm-1.13 GNU dbm gdiff-3.6 GNU versions of the diff utilities gettext-0.19.8.1p1 GNU gettext runtime libraries and programs glib2-2.52.3 general-purpose utility library gmake-4.2.1 GNU make libconfig-1.5p1 library for manipulating structured configuration files libdaemon-0.14p1 lightweight C library that eases the writing of daemons libelf-0.8.13p3 read, modify, create ELF files on any arch libffi-3.2.1p2 Foreign Function Interface libiconv-1.14p3 character set conversion library libsigsegv-2.10p2 library for handling page faults in user mode libslang-2.2.4p2 stack-based interpreter for terminal applications libssh2-1.8.0 library implementing the SSH2 protocol mc-4.8.19 free Norton Commander clone with many useful features metaauto-1.0p1 wrapper for gnu auto oniguruma-5.9.6 regular expressions library pcre-8.40p1 perl-compatible regular expression library png-1.6.31 library for manipulating PNG images popt-1.16p1 getopt(3)-like library with a number of enhancements python-2.7.14 interpreted object-oriented programming language quirks-2.367 exceptions to pkg_add rules sqlite3-3.20.1 embedded SQL implementation unzip-6.0p11 extract, list & test files in a ZIP archive zip-3.0p0 create/update ZIP files compatible with PKZip(tm)

On 2. Feb 2018, at 20:16, Mike Brady notifications@github.com wrote:

Thanks. Could you list the packages you've installed so far?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

mikebrady commented 6 years ago

Thanks. I'll try to take a look at it over the next few days.

heinrichrebehn commented 6 years ago

Thank you for your kind support!

-Heinrich

On 3. Feb 2018, at 12:00, Mike Brady notifications@github.com wrote:

Thanks. I'll try to take a log at it over the next few days.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

mikebrady commented 6 years ago

Hi there. I think I got it to build, but I'm not quite sure how, so I'm going to try to reproduce the steps and get back to you. It looks like there might be a silent bug in Linux and FreeBSD in configure.ac.

Just to tantalise -- sorry, can't resist :)

$ make
make  all-recursive
Making all in man
depbase=`echo shairport.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; gcc -DHAVE_CONFIG_H -I.  -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -I/usr/local/include -g -O2 -MT shairport.o -MD -MP -MF $depbase.Tpo -c -o shairport.o shairport.c && mv -f $depbase.Tpo $depbase.Po
depbase=`echo rtsp.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; gcc -DHAVE_CONFIG_H -I.  -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -I/usr/local/include -g -O2 -MT rtsp.o -MD -MP -MF $depbase.Tpo -c -o rtsp.o rtsp.c && mv -f $depbase.Tpo $depbase.Po
depbase=`echo mdns.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; gcc -DHAVE_CONFIG_H -I.  -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -I/usr/local/include -g -O2 -MT mdns.o -MD -MP -MF $depbase.Tpo -c -o mdns.o mdns.c && mv -f $depbase.Tpo $depbase.Po
depbase=`echo mdns_external.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; gcc -DHAVE_CONFIG_H -I.  -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -I/usr/local/include -g -O2 -MT mdns_external.o -MD -MP -MF $depbase.Tpo -c -o mdns_external.o mdns_external.c && mv -f $depbase.Tpo $depbase.Po
depbase=`echo common.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; gcc -DHAVE_CONFIG_H -I.  -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -I/usr/local/include -g -O2 -MT common.o -MD -MP -MF $depbase.Tpo -c -o common.o common.c && mv -f $depbase.Tpo $depbase.Po
depbase=`echo rtp.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; gcc -DHAVE_CONFIG_H -I.  -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -I/usr/local/include -g -O2 -MT rtp.o -MD -MP -MF $depbase.Tpo -c -o rtp.o rtp.c && mv -f $depbase.Tpo $depbase.Po
depbase=`echo player.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; gcc -DHAVE_CONFIG_H -I.  -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -I/usr/local/include -g -O2 -MT player.o -MD -MP -MF $depbase.Tpo -c -o player.o player.c && mv -f $depbase.Tpo $depbase.Po
depbase=`echo alac.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; gcc -DHAVE_CONFIG_H -I.  -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -I/usr/local/include -g -O2 -MT alac.o -MD -MP -MF $depbase.Tpo -c -o alac.o alac.c && mv -f $depbase.Tpo $depbase.Po
depbase=`echo audio.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; gcc -DHAVE_CONFIG_H -I.  -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -I/usr/local/include -g -O2 -MT audio.o -MD -MP -MF $depbase.Tpo -c -o audio.o audio.c && mv -f $depbase.Tpo $depbase.Po
depbase=`echo loudness.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; gcc -DHAVE_CONFIG_H -I.  -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -I/usr/local/include -g -O2 -MT loudness.o -MD -MP -MF $depbase.Tpo -c -o loudness.o loudness.c && mv -f $depbase.Tpo $depbase.Po
depbase=`echo mdns_avahi.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; gcc -DHAVE_CONFIG_H -I.  -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -I/usr/local/include -g -O2 -MT mdns_avahi.o -MD -MP -MF $depbase.Tpo -c -o mdns_avahi.o mdns_avahi.c && mv -f $depbase.Tpo $depbase.Po
depbase=`echo audio_sndio.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; gcc -DHAVE_CONFIG_H -I.  -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -Wno-multichar -DSYSCONFDIR=\"/usr/local/etc\"   -I/usr/local/include -g -O2 -MT audio_sndio.o -MD -MP -MF $depbase.Tpo -c -o audio_sndio.o audio_sndio.c && mv -f $depbase.Tpo $depbase.Po
g++  -g -O2    -o shairport-sync shairport.o rtsp.o  mdns.o mdns_external.o common.o  rtp.o player.o alac.o audio.o  loudness.o  mdns_avahi.o    audio_sndio.o                 -lsndio -lavahi-common -lavahi-client  -lssl -lcrypto -L/usr/local/lib -lconfig -L/usr/local/lib -lpopt -lintl -liconv -lm -lpthread -L/usr/local/lib -ldaemon 
shairport.o: In function `get_version_string':
/home/mike/shairport-sync/shairport.c:183: warning: warning: strcpy() is almost always misused, please use strlcpy()
/home/mike/shairport-sync/shairport.c:191: warning: warning: strcat() is almost always misused, please use strlcat()
player.o: In function `stuff_buffer_basic_32':
/home/mike/shairport-sync/player.c:1225: warning: warning: rand() may return deterministic values, is that what you want?
/usr/local/lib/libpopt.so.1.0: warning: warning: random() may return deterministic values, is that what you want?
/usr/local/lib/libpopt.so.1.0: warning: warning: stpcpy() is dangerous; do not use it
rtsp.o: In function `handle_setup':
/home/mike/shairport-sync/rtsp.c:839: warning: warning: sprintf() is often misused, please use snprintf()
/usr/local/lib/libdbus-1.so.11.1: warning: warning: vsprintf() is often misused, please use vsnprintf()
$ ./shairport-sync -V
3.1.7-OpenSSL-Avahi-sndio-sysconfdir:/usr/local/etc
$ uname -a
OpenBSD openbsd.localdomain 6.2 GENERIC.MP#134 amd64
$ 

Frankly, I'm surprised it got this far. Since it's missing the timer functionality from the librt library, I would be surprised if it actually works. (Am I right in thinking that this functionality is available in the libc library?) Here is what happens [updated with avahi-daemon enabled]:

$ ./shairport-sync -vv --statistics 
Can't resolve the configuration file "/usr/local/etc/shairport-sync.conf".
Output device name is "default".
The processor is running little-endian.
Version: "3.1.7-OpenSSL-Avahi-sndio-sysconfdir:/usr/local/etc"
statistics_requester status is 1.
daemon status is 0.
deamon pid file is "/var/run/shairport-sync/shairport-sync.pid".
rtsp listening port is 5000.
udp base port is 6001.
udp port range is 100.
player name is "Openbsd.localdomain".
backend is "(null)".
on-start action is "(null)".
on-stop action is "(null)".
wait-cmd status is 0.
on-start returns output is 0.
mdns backend "(null)".
userSuppliedLatency is 0.
AirPlayLatency is -1.
iTunesLatency is -1.
forkedDaapdLatency is -1.
stuffing option is "0" (0-basic, 1-soxr).
resync time is 0.050000 seconds.
allow a session to be interrupted: 0.
busy timeout time is 120.
drift tolerance is 0.001995 seconds.
password is "(null)".
ignore_volume_control is 0.
volume_max_db is not set
playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
disable_synchronization is 0.
use_mmap_if_available is 1.
output_rate is 44100.
output_format is 3 (0-unknown, 1-S8, 2-U8, 3-S16, 4-S24, 5-S24_3LE, 6-S24_3BE, 7-S32).
audio backend desired buffer length is 0.360000 seconds.
audio backend latency offset is 0.000000 seconds.
audio backend silence lead-in time is -1.000000 seconds. A value -1.0 means use the default.
volume range in dB (zero means use the range specified by the mixer): 0.
zeroconf regtype is "_raop._tcp".
decoders_supported field is 1.
use_apple_decoder is 0.
alsa_use_playback_switch_for_mute is 0.
no special mdns service interface was requested.
configuration file name "/usr/local/etc/shairport-sync.conf" can not be resolved.
loudness is 0.
loudness reference level is 0.000000
Successful Startup
avahi: avahi_register.
avahi: register_service.
avahi: service '375E0AB792FA@Openbsd.localdomain' group is not yet committed.
avahi: request to add "_raop._tcp" service without metadata
avahi: service '375E0AB792FA@Openbsd.localdomain' group is registering.
avahi: service '375E0AB792FA@Openbsd.localdomain' successfully added.
heinrichrebehn commented 6 years ago

Great! I hope that it will compile on arm too. I intend to buy a Raspberry Pi 3 and use it as an airplay receiver under OpenBSD. Thank you so much for your efforts!

-Heinrich

On 6. Feb 2018, at 22:49, Mike Brady notifications@github.com wrote:

Hi there. I think I got it working, but I'm not quite sure how, so I'm going to try to reproduce the steps and get back to you. It looks like there might be a silent bug in Linux and FreeBSD in configure.ac.

Just to tantalise -- sorry, can't resist :)

$ ./shairport-sync -V 3.1.7-OpenSSL-Avahi-sndio-sysconfdir:/usr/local/etc $ uname -a OpenBSD openbsd.localdomain 6.2 GENERIC.MP#134 amd64 $

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

mikebrady commented 6 years ago

Thanks. It’s not clear yet that it’s fully working... it will need a little more investigation.

mikebrady commented 6 years ago

There is now a very preliminary OPENBSD.md page. I'd be grateful if you could test it and report any problems.

I have not been able to test this -- I know it compiles and it seems to generate audio, but I'm running it in an installation with no sound hardware, so I can't test it. Maybe you can.

heinrichrebehn commented 6 years ago

Thanks! I think I will be able to test ist over the weekend and will report back to you.

-Heinrich

On 9. Feb 2018, at 21:54, Mike Brady notifications@github.com wrote:

There is now a very preliminary OPENBSD.md page. I'd be grateful if you could test it and report any problems.

I have not been able to test this -- I know it compiles and it seems to generate audio, but I'm running it in an installation with no sound hardware, so I can't test it. Maybe you can.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

heinrichrebehn commented 6 years ago

Hi Mike,

I tested with OpenBSD 6.2 running virtualised under VMware Fusion with sound output via a cheap USB dongle.

Your development branch compiles and runs fine under both virtual amd64 and i386 machines.

Music was played using iTunes on a Mac and sent simultaneously to an Airport Express and shairport-sync. Both audio streams were perfectly in sync! No slapback echo, no fake stereo (doubling).

Thank you so much for your work! Next step for me will be purchasing a Raspberry Pi 3 and run shairport-sync there. Can I expect to compile as smooth as on intel? I have absolutely no experience with other platforms, but autoconf/make should work just the same?

With best wishes,

Heinrich

On 9. Feb 2018, at 21:54, Mike Brady notifications@github.com wrote:

There is now a very preliminary OPENBSD.md page. I'd be grateful if you could test it and report any problems.

I have not been able to test this -- I know it compiles and it seems to generate audio, but I'm running it in an installation with no sound hardware, so I can't test it. Maybe you can.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

mikebrady commented 6 years ago

That's great news, Heinrich!

My OpenBSD 6.2 is also in VmWare Fusion -- can you tell me what you did to get the USB DAC connected please? Did you have to install VMWare Tools and what audio settings did you need to set?

I'm afraid I have really no knowledge of how OpenBSD runs on a Pi, but if it's reasonably complete, Shairport Sync should compile and run -- autoconf is indeed great.

Please keep us all posted.

heinrichrebehn commented 6 years ago

It was very simple, no magic involved. No VMWare Tools, i was not even aware that they exist for OpenBSD. I

uaudio0 at uhub2 port 1 configuration 1 interface 0 "ABC C-Media USB Audio Device" rev 1.10/1.00 addr 4 uaudio0: audio rev 1.00, 8 mixer controls audio0 at uaudio0 uhidev2 at uhub2 port 1 configuration 1 interface 3 "ABC C-Media USB Audio Device" rev 1.10/1.00 addr 4 uhidev2: iclass 3/0 uhid0 at uhidev2: input=4, output=4, feature=0

on the virtual machine’s console.

sndio connects to the new device and you can start shairport-sync.

However, sound support via USB DAC is quite flakey. It works fine while you leave the host machine alone, but as soon as you open a browser window or similar, sound stops. This is not related to shairport, it also happens when you play an audio file using sox(1).

On 10. Feb 2018, at 19:46, Mike Brady notifications@github.com wrote:

That's great news, Heinrich!

My OpenBSD 6.2 is also in VmWare Fusion -- can you tell me what you did to get the USB DAC connected please? Did you have to install VMWare Tools and what audio settings did you need to set.

I'm afraid I have really no knowledge of how OpenBSD runs on a Pi, but if it's reasonably complete, Shairport Sync should compile and run -- autoconf is indeed great.

Please keep us all posted.

It will probably take a couple of weeks to get and install the Raspi, but I will either report success or bother you with questions ;-)

-Heinrich

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

mikebrady commented 6 years ago

Many thanks.

heinrichrebehn commented 6 years ago

Hi Mike,

I just wanted to get back to you and report about shairport-sync on Raspi under OpenBSD. The good news: it compiles fine :-) It can also be started and runs fine.

The bad news: Onboard sound is not supported on the Raspi and any attempt to access a USB audio device results in a kernel panic:

https://marc.info/?l=openbsd-bugs&m=151897155509345&w=2

While waiting for a fix I installed Raspbian with shairport-sync via apt-get install. It works OOB without any delays!

Thank you for your good work!

P.S.

I also tried to install under macOS High Sierra using MacPorts. It installs:

Version: "2.8.6-OpenSSL-ao-stdout-pipe-soxr-metadata-sysconfdir:/opt/local/etc/shairport-sync” Unfortunately it produces a horrible delay (almost a second)

I then tried:

git clone https://github.com/mikebrady/shairport-sync.git Cloning into 'shairport-sync'... remote: Counting objects: 8700, done. remote: Compressing objects: 100% (93/93), done. remote: Total 8700 (delta 67), reused 57 (delta 26), pack-reused 8581 Receiving objects: 100% (8700/8700), 4.15 MiB | 2.12 MiB/s, done. Resolving deltas: 100% (5709/5709), done.

cd shairport-sync/ heinrich@host35 [~/shairport-sync]: autoconf -i -f configure.ac:6: error: possibly undefined macro: AM_INIT_AUTOMAKE If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. configure.ac:28: error: possibly undefined macro: AC_MSG_ERROR configure.ac:35: error: possibly undefined macro: AM_CONDITIONAL configure.ac:64: error: possibly undefined macro: AC_DEFINE heinrich@host35 [~/shairport-sync]:

Any thoughts about this?

I am totally happy that it runs on Raspi, but being able to use my PC as an Airplay Server would be even better :-)

-Heinrich

On 10. Feb 2018, at 22:30, Mike Brady notifications@github.com wrote:

Many thanks.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

mikebrady commented 6 years ago

Thanks for the update. I think there’s a homebrew version of Shairport Sync doing the rounds.

github-actions[bot] commented 3 years ago

This issue has been inactive for 60 days so will be closed 7 days from now. To prevent this, please remove the "stale" label or post a comment.