Cross compiling headless Audacious player for ARM - do I need glib?
I am attempting to compile audacious on OpenSuSE to run on a headless banana pi (armv7) running armbian (like debian). The BananaPi does not have any GUI packages installed and I'd prefer not to install any.
The cross-compiler I'm using is detailed on this post I made to the SuSE forum:
./configure CFLAGS="--sysroot=/ -march=armv7" LDFLAGS=--sysroot=/ --disable-qt --disable-gtk --build i686-pc-linux-gnu --host arm-linux-gnueabi
It starts compiling dbus and I got several errors like
... from /usr/include/glib-2.0/gio/gio.h:26, from aud-dbus.h:10, from aud-dbus.c:11: /usr/include/glib-2.0/glib/gtypes.h: In function ‘_GLIB_CHECKED_ADD_U64’: /usr/include/glib-2.0/glib/gmacros.h:232:53: error: size of array ‘_GStaticAssertCompileTimeAssertion_0’ is negative #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSEDNow the fundamental problem was that it should not have been using /usr/include/glib... Those are for this SuSE x64 system.
I had no glib libraries for ARM for the cross-compiler.
These /usr/include paths are in extra.mk.
I've tried various workrounds since, using Debian/ARM libraries, but then I started to wonder what glib was for and whether I needed it at all? It seems to be part of gnome and I have neither gnome nor glib on the target machine.
So can I get rid of all glib stuff? Should --disable-gtk have removed it?
I assume I do need to compile dbus. All I want to use is audacious -H ... and audtool which I will run over SSH.
RE: Cross compiling headless Audacious player for ARM - do I need glib? - Added by John Lindgren over 2 years ago
Short answer, yes, you need GLib. It provides various low-level utilities (portable file access, stable sort, main loop, etc.) and has very few dependencies; you certainly don't need to install GTK+ or any of the rest of GNOME.
RE: Cross compiling headless Audacious player for ARM - do I need glib? - Added by Dave Royal over 2 years ago
OK. Thanks. I see that gio and gobject and some others are necessary for dbus, and dbus is necessary for audtool.
So my main problem is that the cross-compiler does not provide glib, so configure does not set up extra.mk pointing to it.
I tried installing libglib2.0-dev and linux-libc-dev from debian into the cross compiler tree, but extra.mk is still incorrect. Maybe the wrong versions or the position in the tree is wrong. Hand-editing paths in extra.mk causes multiple other failures.
I need a better compiler.
I got a better compiler from linaro. I can now compile audacious - but not link it - see the end of this post.
This is my configure:
./configure CFLAGS="-nostdlib --sysroot=/opt/linaro -isystem/opt/linaro/arm-linux-gnueabihf/libc/usr/include -march=armv7" LDFLAGS="-nostdlib -L/opt/linaro/arm-linux-gnueabihf/libc/usr/lib -L/opt/linaro/usr/lib/arm-linux-gnueabihf/ -L/opt/linaro/usr/lib/arm-linux-gnueabihf/glib-2.0/include -Wl,-rpath,/opt/linaro/lib/arm-linux-gnueabihf -Wl,-rpath,/opt/linaro/usr/lib/arm-linux-gnueabihf" --disable-qt --disable-gtk --build i686-pc-linux-gnu --host arm-linux-gnueabihf
However, I then have to amend extra.mk manually. It contains:
GIO_CFLAGS ?= -pthread -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include GIO_LIBS ?= -lgio-2.0 -lgobject-2.0 -lglib-2.0 GLIB_CFLAGS ?= -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include GLIB_LIBS ?= -lglib-2.0 GMODULE_CFLAGS ?= -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include GMODULE_LIBS ?= -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0
I have to change those -I path references to point to directories in my cross compiler tree, the files having come from debian armhf.
GIO_CFLAGS ?= -pthread -I/opt/linaro/usr/include/gio-unix-2.0/ -I/opt/linaro/usr/include/glib-2.0 -I/opt/linaro/usr/lib/arm-linux-gnueabihf/glib-2.0/include ... GLIB_CFLAGS ?= -I/opt/linaro/usr/include/glib-2.0 ... GMODULE_CFLAGS ?= -pthread -I/opt/linaro/usr/include/glib-2.0 ...
I suspect that these /usr paths are from environment variables; I haven't changed any for cross-compiling - I've used CFLAGS and LDFLAGS to set paths, including -nostdlib which I think should prevent it using any default library paths.
What should I do to get extra.mk to point to the correct cross-compiler paths?
Anyway, if I correct extra.mk it compiles:
Entering directory src. Entering directory dbus. Successfully generated dependencies. Successfully compiled aud-dbus.c. Successfully linked aud-dbus.a. Leaving directory dbus. Entering directory audtool. Successfully generated dependencies. Successfully compiled main.c. Successfully compiled handlers_general.c. Successfully compiled handlers_playback.c. Successfully compiled handlers_playlist.c. Successfully compiled handlers_playqueue.c. Successfully compiled handlers_vitals.c. Successfully compiled handlers_equalizer.c. Successfully compiled report.c. Successfully compiled wrappers.c. /opt/linaro/bin/../lib/gcc/arm-linux-gnueabihf/7.2.1/../../../../arm-linux-gnueabihf/bin/ld: /opt/linaro/usr/lib/arm-linux-gnueabihf//libglib-2.0.a(libglib_2_0_la-gstrfuncs.o): undefined reference to symbol 'strtoull_l@@GLIBC_2.4' /opt/linaro/bin/../arm-linux-gnueabihf/libc/lib/libc.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status Failed to link audtool! ../../buildsys.mk:207: recipe for target 'audtool' failed
Any idea about that error? I do have libc.so.6: