openairplay / goplay2

Airplay 2 Receiver written in Go
Apache License 2.0
384 stars 20 forks source link

Issues with CFLAGS and LDFLAGS #22

Closed dubo-dubon-duponey closed 3 years ago

dubo-dubon-duponey commented 3 years ago

Hey @AlbanSeurat

This https://github.com/openairplay/goplay2/blob/main/codec/aac.go#L27-L30 is problematic.

Both points are problematic for cross-compilation and for systems that do not ship a static version of libfdk - typically Debian Buster in the Dockerfile already requires live-patching the source (https://github.com/openairplay/goplay2/pull/19/files#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557R9)

Suggestion would be to leave the responsibility of picking these to the build system / command (eg: "-extldflags -static(-pie)") for people who would really want to be specific about these.

For most normal people, things will just continue building by default, and this should make life easier for advanced users (looking for cross-compilation, or more control over static vs. dynamic).

Let me know your thoughts and if you agree I can send a small PR to change that.

AlbanSeurat commented 3 years ago

I saw your patch on your docker file and I do understand why you would like to get rid of it.

However, I had link issue at startup with the dynamic lib on Ubuntu ( or raspbian) with missing symbols.

I do not want to have “-static” as it static link the libc as well and it does not work with cgo.

If you can find a simple cross platform solution (ubuntu, raspian, debian, macOS), I am happy to let you do it.

Just for Info, I had remove the makefile to keep thing simple at build time with just “go build”.

dubo-dubon-duponey commented 3 years ago

Ok. I'll have a deeper look into this and see if there is a good way to accommodate all use cases.

dubo-dubon-duponey commented 3 years ago

Static linking against glibc with CGO should still work fine (Would require the same version of glibc dyn lib to be there at runtime because NSS), but then if you do not require NSS, building with netgo should fix that. Musl static should work fine as well. More later if I can get something nice in.

AlbanSeurat commented 3 years ago

Exactly it was related to dns and how libc handle it.

Again, I have a simple “go build” solution to help me focus on audio features. And again, happy to receive help to improve the rest :)