Unable to compile with airtunes on Linux
#1
Hi guys,

I installed libshairport with the bundled Makefile and configured --with-airtunes, but building xbmc fails on AirTunesServer.

Code:
CPP     AirTunesServer.o
AirTunesServer.cpp: In member function ‘bool CAirTunesServer::Initialize(const CStdString&)’:
AirTunesServer.cpp:346:22: error: aggregate ‘printfPtr funcPtr’ has incomplete type and cannot be defined
/tmp/xbmc/xbmc/utils/CharsetConverter.h: At global scope:
/tmp/xbmc/xbmc/utils/CharsetConverter.h:83:157: warning: ‘g_charsetConverter’ defined but not used
make[1]: *** [AirTunesServer.o] Error 1
make[1]: Leaving directory `/tmp/xbmc/xbmc/network'
make: *** [xbmc/network/network.a] Error 2

This is Gentoo GCC 4.5.3 on x86_64.

Interestingly, the xbmc live ebuild fails already in configure:
Code:
configure:22819: checking for shairport_set_ao in -lshairport
configure:22844: x86_64-pc-linux-gnu-gcc -o conftest -march=core2 -maes -mpclmul -msahf -msse3 -msse4 -msse4.1 -msse4.2 -mssse3 -mstackrealign -mtune=generic -O2 -pipe -fPIC -DPIC -D_REENTRANT -D_LARGEFILE6
4_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG=1  -Wl,-O1 -Wl,--as-needed conftest.c -lshairport  -lsmbclient -lXrandr -lavahi-client -lavahi-common -lpulse -lmicrohttpd -lSDL_image -lSDL_mixer -lrt -ljasper -lre
solv -ldl -lyajl -lssh -lmysqlclient -lssl -lcrypto -lz -llzo2 -lpthread -ltiff -ljpeg -lbz2 -lGLU -lGLEW -lGL  -Wl,-O1 -Wl,--as-needed -rdynamic -L/usr/lib64/mysql -lmysqlclient -L/usr//lib64 -lz -lcrypt -
lnsl -lm -L/usr/lib64/ -lssl -lcrypto -lfontconfig   -lfribidi   -lsqlite3   -lpng14   -lpcre   -lpcrecpp   -lcdio -lm   -lsamplerate   -lfreetype   -lasound   -ldbus-1 -lpthread -lrt   -lSDL -lpthread   -l
X11   -lXext   -lXt -lX11   -lXmu -lXt -lX11   >&5
/usr/local/lib64/libshairport.so: undefined reference to `sincos'
/usr/local/lib64/libshairport.so: undefined reference to `pow'
collect2: ld returned 1 exit status

Perhaps I am missing some dependencies?
Reply
#2
"printfPtr funcPtr" support was recently added to quiet libshairport's logging to printf spew. Both libshairport and xbmc have to match in version.

On the other, libshairport might be missing a linkage to some lib.
Reply
#3
Right. The no_printf patch was added to tools/darwin/depends, but not lib/libshairport. Compiled fine after applying the patch to lib/libshairport sources.

I think the other might be related to --as-needed, I'll see if I can fix it.
Reply
#4
bamdrainage Wrote:Right. The no_printf patch was added to tools/darwin/depends, but not lib/libshairport. Compiled fine after applying the patch to lib/libshairport sources.

I think the other might be related to --as-needed, I'll see if I can fix it.

missing patch in lib/libshairport added in trunk, so that's fixed now.
Reply
#5
bamdrainage Wrote:Right. The no_printf patch was added to tools/darwin/depends, but not lib/libshairport. Compiled fine after applying the patch to lib/libshairport sources.

I think the other might be related to --as-needed, I'll see if I can fix it.

did you have any success fixing the --as-needed error?

btw. is it really necessary to install it in /usr/local/lib instead of /usr/lib?
Reply
#6
ofc not necessary. but who'd want non-system maintained libs in their /usr ?
Reply
#7
einhänder Wrote:did you have any success fixing the --as-needed error?

Explicitly adding -lm after -lshairport to LIBS in the configure test seemed to fix the --as-needed issue when libshairport was built with the bundled Makefile. Can perhaps be fixed by adding LIBS="-lm $LIBS" to configure.in, (i.e after USE_AIRTUNES=0).

Anecdotally, if libshairport itself is being linked --as-needed xbmc configure fails to link ssl.

Code:
configure:22819: checking for shairport_set_ao in -lshairport
configure:22844: x86_64-pc-linux-gnu-gcc -o conftest -march=atom -m64 -msse2 -msse3 -mssse3 -mfpmath=sse -msahf -mmovbe -mhard-float -O2 -pipe -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG=1  -Wl,-O1 -Wl,--as-needed conftest.c -lshairport -lm -lsmbclient -lXrandr -lavahi-client -lavahi-common -lmicrohttpd -lSDL_image -lSDL_mixer -lrt -ljasper -lresolv -ldl -lyajl -lbluetooth -lmysqlclient -lssl -lcrypto -lz -llzo2 -lpthread -ltiff -ljpeg -lbz2 -lGLU -lGLEW -lGL  -Wl,-O1 -Wl,--as-needed -rdynamic -L/usr/lib64/mysql -lmysqlclient -L/usr//lib64 -lz -lcrypt -lnsl -lm -L/usr/lib64/ -lssl -lcrypto -lfontconfig   -lfribidi   -lsqlite3   -lpng14   -lpcre   -lpcrecpp   -lcdio -lm   -lsamplerate   -lfreetype   -lasound   -ldbus-1 -lpthread -lrt   -lSDL -lpthread   -lX11   -lXext   -lXt -lX11   -lXmu -lXt -lX11   >&5
/usr//lib64/libshairport.so: undefined reference to `BIO_new_mem_buf'
/usr//lib64/libshairport.so: undefined reference to `BIO_free'
/usr//lib64/libshairport.so: undefined reference to `BIO_s_mem'
/usr//lib64/libshairport.so: undefined reference to `BIO_f_base64'
/usr//lib64/libshairport.so: undefined reference to `BIO_free_all'
/usr//lib64/libshairport.so: undefined reference to `BIO_ctrl'
/usr//lib64/libshairport.so: undefined reference to `AES_set_decrypt_key'
/usr//lib64/libshairport.so: undefined reference to `RSA_size'
/usr//lib64/libshairport.so: undefined reference to `RSA_private_decrypt'
/usr//lib64/libshairport.so: undefined reference to `RSA_check_key'
/usr//lib64/libshairport.so: undefined reference to `BIO_new'
/usr//lib64/libshairport.so: undefined reference to `RSA_private_encrypt'
/usr//lib64/libshairport.so: undefined reference to `PEM_read_bio_RSAPrivateKey'
/usr//lib64/libshairport.so: undefined reference to `BIO_set_flags'
/usr//lib64/libshairport.so: undefined reference to `AES_cbc_encrypt'
/usr//lib64/libshairport.so: undefined reference to `BIO_push'
/usr//lib64/libshairport.so: undefined reference to `RSA_free'
/usr//lib64/libshairport.so: undefined reference to `BIO_write'
/usr//lib64/libshairport.so: undefined reference to `BIO_read'
Reply
#8
spiff Wrote:ofc not necessary. but who'd want non-system maintained libs in their /usr ?

That's true. But I created an ebuild for Gentoo, see: https://bugs.gentoo.org/show_bug.cgi?id=386909

@bamdrainage
Thanks for your hints. But as you can see in the bug report I wasn't able to fix it with your solution. What worked is to filter --as-needed in the xbmc ebuild by adding:

Code:
inherit flag-o-matic ...  pkg_setup() {     append-ldflags $(no-as-needed) }
But I assume this would not be accepted by the xbmc ebuild maintainer.
Reply
#9
einhänder Wrote:
Code:
inherit flag-o-matic ...  pkg_setup() {     append-ldflags $(no-as-needed) }
But I assume this would not be accepted by the xbmc ebuild maintainer.

You could try:
  1. build libshairport without --as-needed (using flag-o-matic.eclass)
  2. patch xbmc ebuild/sources to add -lm directly after -lshairport in the configure test

That made configure pick up the library, but I was unable to test functionality (and lost interest) since I don't have iTunes.

Don't install libpng15 if you want to try it, however..
Reply
#10
commit https://github.com/xbmc/xbmc/commit/40ab...7741e902f4 fixed it on gentoo, too.

thanks a lot. Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Unable to compile with airtunes on Linux0