Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Problem]: Build fails on earlier macOS due to wrong header sequence and missing TCP_KEEPCNT / TCP_KEEPINTVL #1860

Closed
barracuda156 opened this issue Jun 4, 2024 · 18 comments

Comments

@barracuda156
Copy link

What happened?

Build fails on macOS < 10.9.
One problem is a wrong include order: trivially fixable, and in fact already fixed earlier in 8a6eb02 but then broken again.
Another is missing TCP_KEEPCNT / TCP_KEEPINTVL on macOS < 10.9.

Relevant log output

In file included from shairport.c:34:
/usr/include/net/if.h:264: error: field ‘ifru_addr’ has incomplete type
/usr/include/net/if.h:265: error: field ‘ifru_dstaddr’ has incomplete type
/usr/include/net/if.h:266: error: field ‘ifru_broadaddr’ has incomplete type
/usr/include/net/if.h:305: error: field ‘ifra_addr’ has incomplete type
/usr/include/net/if.h:306: error: field ‘ifra_broadaddr’ has incomplete type
/usr/include/net/if.h:307: error: field ‘ifra_mask’ has incomplete type
/usr/include/net/if.h:379: error: field ‘addr’ has incomplete type
/usr/include/net/if.h:380: error: field ‘dstaddr’ has incomplete type

rtsp.c: In function ‘rtsp_listen_loop’:
rtsp.c:5672: error: ‘TCP_KEEPCNT’ undeclared (first use in this function)
rtsp.c:5672: error: (Each undeclared identifier is reported only once
rtsp.c:5672: error: for each function it appears in.)
rtsp.c:5676: error: ‘TCP_KEEPINTVL’ undeclared (first use in this function)
make[1]: *** [rtsp.o] Error 1

System Information.

macOS 10.6 (locally)
macOS 10.8 (buildbot): https://build.macports.org/builders/ports-10.8_x86_64-builder/builds/180717/steps/install-port/logs/stdio

Configuration Information.

36-174% uname -a
Darwin 36-174.wireless-city.scu.edu.tw 10.0.0d2 Darwin Kernel Version 10.0.0d2: Fri Oct 10 19:37:52 PDT 2008; root:xnu-1346.7~1/RELEASE_PPC Power Macintosh

See also: https://trac.macports.org/ticket/70148



### PulseAudio or PipeWire installed?

- [ ] Check if your system uses a Sound Server.

### How did you install Shairport Sync?

Built from source

### Check previous issues

- [X] Confirm
@mikebrady
Copy link
Owner

Thanks for the report. TBH it wouldn't have the highest priority at the present time...

@mikebrady
Copy link
Owner

Do you happen to know of any substitutes for TCP_KEEPCNT / TCP_KEEPINTVL in macOS < 10.9?

@barracuda156
Copy link
Author

@mikebrady Thank you for responding!

Apparently on 10.7 and earlier there is TCP_KEEPALIVE: https://lists.apple.com/archives/macnetworkprog/2012/Jul/msg00005.html

Curl had a patch back then: Khalian/kcurl@29fdb27

@mikebrady
Copy link
Owner

@barracuda156 Thanks! I'll take a look.

@mikebrady
Copy link
Owner

mikebrady commented Jun 14, 2024

@barracuda156, are you using using HomeBrew on 10.8?

@barracuda156
Copy link
Author

@mikebrady I use MacPorts (and would like to fix the port after the recent update). Homebrew is broken for everything but recent systems.

@mikebrady
Copy link
Owner

So, an update in the development branch has just been pushed that addresses the two issues you raised. (Additionally a bug in the initialisation of the metadata system was uncovered, so thanks! 😊)

Just a note of caution about AirPlay 2 operation:

  1. For AirPlay 2 operation, NQPTP is needed. It uses ports 319 and 320, which are used on more recent macOS versions and may be in use on older Mac OS X versions.
  2. Shairport Sync almost certainly will not run in AirPlay 2 mode on a big-endian system. This is not likely to be fixed, I'm afraid, as at least one of the problems is in a library.

@barracuda156
Copy link
Author

Thank you!

I ran the build now. I think fixing headers was somehow lost in committing? It is mentioned, but not done:

In file included from shairport.c:34:
/usr/include/net/if.h:264: error: field ‘ifru_addr’ has incomplete type
/usr/include/net/if.h:265: error: field ‘ifru_dstaddr’ has incomplete type
/usr/include/net/if.h:266: error: field ‘ifru_broadaddr’ has incomplete type
/usr/include/net/if.h:305: error: field ‘ifra_addr’ has incomplete type
/usr/include/net/if.h:306: error: field ‘ifra_broadaddr’ has incomplete type
/usr/include/net/if.h:307: error: field ‘ifra_mask’ has incomplete type
/usr/include/net/if.h:379: error: field ‘addr’ has incomplete type
/usr/include/net/if.h:380: error: field ‘dstaddr’ has incomplete type
depbase=`echo alac.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
	/usr/bin/gcc-4.2 -std=gnu99 -DHAVE_CONFIG_H -I.   -I/opt/local/include -Wno-multichar -Wall -Wextra -Wno-deprecated-declarations -pthread -DSYSCONFDIR=\"/opt/local/etc/shairport-sync\" -DPIDDIR=\"/opt/local/var\" -I/opt/local/libexec/openssl3/include   -pipe -Os -arch ppc -MT alac.o -MD -MP -MF $depbase.Tpo -c -o alac.o alac.c &&\
	mv -f $depbase.Tpo $depbase.Po
make[1]: *** [shairport.o] Error 1

Specifically, we need #include <sys/socket.h> to come before #include <net/if.h>.
With that fixed, next error is:

	/usr/bin/gcc-4.2 -std=gnu99 -DHAVE_CONFIG_H -I.   -I/opt/local/include -Wno-multichar -Wall -Wextra -Wno-deprecated-declarations -pthread -DSYSCONFDIR=\"/opt/local/etc/shairport-sync\" -DPIDDIR=\"/opt/local/var\" -I/opt/local/libexec/openssl3/include   -pipe -Os -arch ppc -MT mdns_dns_sd.o -MD -MP -MF $depbase.Tpo -c -o mdns_dns_sd.o mdns_dns_sd.c &&\
	mv -f $depbase.Tpo $depbase.Po
/usr/bin/g++-4.2 -I/usr/local/include -Wno-multichar -Wall -Wextra -Wno-deprecated-declarations -pthread -DSYSCONFDIR=\"/opt/local/etc/shairport-sync\"  -pipe -Os -arch ppc  -L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc -o shairport-sync shairport.o rtsp.o mdns.o common.o rtp.o player.o alac.o audio.o loudness.o activity_monitor.o          audio_stdout.o audio_pipe.o  audio_ao.o     mdns_dns_sd.o           -L/opt/local/lib -lao -L/opt/local/lib -lsoxr -L/opt/local/libexec/openssl3/lib -lssl -lcrypto -L/opt/local/lib -lconfig -L/opt/local/lib -lpopt -lm -lpthread 
Undefined symbols:
  "_dprintf", referenced from:
      _do_sps_log_to_fd in common.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[1]: *** [shairport-sync] Error 1

However for this we can rely on MacPorts's legacy-support library, and once it is added, shairport-sync compiles successfully.

We should not use --with-airplay-2 with Big-endian archs, right?

@mikebrady
Copy link
Owner

Apologies -- I don't know how that happened. I'll fix it shortly.

So, yeah, best to omit the --with-airplay-2 with big-endian architectures. I don't expect it will ever work, sadly.

@barracuda156
Copy link
Author

@mikebrady Got it, thank you.

Could you make a tag which incorporates the fixes? If it’s not troublesome.
(But we can survive with patches until the next release either.)

@mikebrady
Copy link
Owner

Just pushed it there now. Regarding that:

Undefined symbols:
  "_dprintf", referenced from:
      _do_sps_log_to_fd in common.o
...

I didn't get that error. I was working on Mac OS X 10.8.5 (Mountain Lion) and Xcode 5.1.1. It was as far back as I could easily go, TBH...

If it's okay with you, let me wait a few days and then, all going well, just I'll push the development branch into a new master release. Would that be okay?

@barracuda156
Copy link
Author

barracuda156 commented Jun 15, 2024

I didn't get that error.

This is perhaps relevant for < 10.7. But no worries, legacy-support has got us covered here, there is no need to do anything about that.

If it's okay with you, let me wait a few days and then, all going well, just I'll push the development branch into a new master release. Would that be okay?

Yeah, sure. Thank you!

Copy link

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

@github-actions github-actions bot added the Stale label Aug 15, 2024
@barracuda156
Copy link
Author

@mikebrady This perhaps is fixed, right? Or did I forget something?

@mikebrady
Copy link
Owner

Yeah, it should be. It’s just a bot trying to close the issue.

@github-actions github-actions bot removed the Stale label Aug 16, 2024
Copy link

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

@github-actions github-actions bot added the Stale label Oct 15, 2024
@barracuda156
Copy link
Author

This was fixed, right?

@mikebrady
Copy link
Owner

Yep!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants