Configuring and building dbus-glib for cross-compile

Soh Kam Yung sohkamyung at gmail.com
Wed Jun 11 00:22:31 PDT 2008


Hello all,

I have managed to get dbus cross-compiled and running on an ARM
platform (glib and expat have already been cross-compiled).

But I am facing some problems building dbus-glib.  It appears to
compile properly but during the linking stage, I start getting
"undefined reference" errors like this:

dbus-binding-tool-glib.o: In function `dbus_g_type_get_marshal_name':
dbus-binding-tool-glib.c:(.text+0x18): undefined reference to
`g_type_fundamental'
dbus-binding-tool-glib.o: In function `dbus_g_type_get_c_name':
dbus-binding-tool-glib.c:(.text+0x2e8): undefined reference to `g_type_is_a'
dbus-binding-tool-glib.c:(.text+0x304): undefined reference to `g_strv_get_type'
dbus-binding-tool-glib.c:(.text+0x314): undefined reference to `g_type_is_a'
...

Here is a portion of the makefile I used to configure and build
dbus-glib.  Generally, source code resides in /home/ARM/source and
stuff gets built in /home/ARM/build.  My code is suppose to reside in
/myroot/ on the ARM platform.

=====Start=====
# directory where dbus-glib code will reside on the ARM environment
installpath := /myroot/dbus-glib

# directory when stuff gets built
BUILDHOME := /home/ARM

srcdir := $(BUILDHOME)/source/dbus-glib/dbus-glib-0.76
builddir := $(BUILDHOME)/build/dbus-glib
host := arm-linux

# expat dependent stuff
EXPAT_BUILD_PATH := $(BUILDHOME)/build/expat
EXPAT_LIB_PATH := $(EXPAT_BUILD_PATH)/lib
EXPAT_INCLUDE_PATH := $(EXPAT_BUILD_PATH)/include

# dbus dependent stuff
DBUS_BUILD_PATH := $(BUILDHOME)/build/dbus
DBUS_LIB_PATH := $(DBUS_BUILD_PATH)/lib
DBUS_INCLUDES := -I$(DBUS_BUILD_PATH)/include/dbus-1.0
-I$(DBUS_BUILD_PATH)/lib/dbus-1.0/include

# glib dependent stuff
GLIB_BUILD_PATH := $(BUILDHOME)/build/glib
GLIB_LIB_PATH := $(GLIB_BUILD_PATH)/lib
GLIB_INCLUDES := -I$(GLIB_BUILD_PATH)/include/glib-2.0
-I$(GLIB_BUILD_PATH)/lib/glib-2.0/include

# glib threads dependent stuff
GLIB_THREADS_BUILD_PATH := $(BUILDHOME)/build/glib
GLIB_THREADS_LIB_PATH := $(GLIB_THREADS_BUILD_PATH)/lib
GLIB_THREADS_INCLUDES := -I$(GLIB_BUILD_PATH)/include/glib-2.0
-I$(GLIB_BUILD_PATH)/lib/glib-2.0/include

config:
	cd $(builddir) && \
		$(srcdir)/configure \
			--prefix=$(installpath) \
			--srcdir=$(srcdir) \
			--host=$(host) \
			ac_cv_func_posix_getpwnam_r=yes \
			ac_cv_have_abstract_sockets=yes \
			LDFLAGS=-L$(EXPAT_LIB_PATH) \
			CFLAGS=-I$(EXPAT_INCLUDE_PATH) \
			DBUS_LIBS=-L$(DBUS_LIB_PATH) \
			DBUS_CFLAGS="$(DBUS_INCLUDES)" \
			DBUS_GLIB_LIBS=-L$(GLIB_LIB_PATH) \
			DBUS_GLIB_CFLAGS="$(GLIB_INCLUDES)" \
			DBUS_GLIB_THREADS_LIBS=-L$(GLIB_THREADS_LIB_PATH) \
			DBUS_GLIB_THREADS_CFLAGS="$(GLIB_THREADS_INCLUDES)"

build:
	cd $(builddir) && \
		make

===== End =====

Am I using the DBUS_xxx variables properly?  If I don't use them, I
start getting errors with pkg-config.

Regards,
Kam-Yung
-- 
Soh Kam Yung
my Google Reader Shared links:
(http://www.google.com/reader/shared/16851815156817689753)
my Google Reader Shared SFAS links:
(http://www.google.com/reader/shared/user/16851815156817689753/label/sfas)


More information about the dbus mailing list