dbus-glib bindings on WinXP with mingw compiler

nihil at blue.dyn-o-saur.com nihil at blue.dyn-o-saur.com
Thu Dec 10 07:21:02 PST 2009


I tried to compile dbus-glib-0.82 on winxp using the mingw/msys tools using the standard
configure, make, make install steps. I used dbus-mingw-1.2.4-1-lib and dbus-mingw-1.2.4-1-bin
as the dbus implementation from the sourceforge.net page with an custom dbus-1.pc for pkg-config.
While configure runs through without problems compilations fails with:
make[4]: Entering directory `/home/root/mingw-additional/dbus-glib-0.82/test/core'
gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../../dbus -I../.. -I../../dbus -Ic:/mingw/include/dbus-1.0 -Ic:/mingw/lib/dbus-1.0/include   -mms-bitfields -Ic:/mingw/include/glib-2.0 -Ic:/mingw/lib/glib-2.0/include   -DDBUS_COMPILATION  -I/mingw/include -I/usr/local/include  -g -O2 -Wall -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align -Wfloat-equal -Wsign-compare -fno-strict-aliasing -MT test-profile.o -MD -MP -MF .deps/test-profile.Tpo -c -o test-profile.o test-profile.c
test-profile.c:32:24: error: sys/socket.h: No such file or directory
test-profile.c:33:20: error: sys/un.h: No such file or directory
test-profile.c:34:24: error: netinet/in.h: No such file or directory
test-profile.c: In function 'plain_sockets_new_client_watch':
test-profile.c:757: error: storage size of 'addr' isn't known
test-profile.c:771: warning: implicit declaration of function 'accept'
test-profile.c:771: warning: nested extern declaration of 'accept'
test-profile.c:757: warning: unused variable 'addr'
test-profile.c: In function 'plain_sockets_init_server':
test-profile.c:801: error: storage size of 'addr' isn't known
test-profile.c:820: warning: implicit declaration of function 'socket'
test-profile.c:820: warning: nested extern declaration of 'socket'
test-profile.c:820: error: 'PF_UNIX' undeclared (first use in this function)
test-profile.c:820: error: (Each undeclared identifier is reported only once
test-profile.c:820: error: for each function it appears in.)
test-profile.c:820: error: 'SOCK_STREAM' undeclared (first use in this function)
test-profile.c:830: error: 'AF_UNIX' undeclared (first use in this function)
test-profile.c:844: warning: implicit declaration of function 'S_ISSOCK'
test-profile.c:844: warning: nested extern declaration of 'S_ISSOCK'
test-profile.c:851: warning: implicit declaration of function 'bind'
test-profile.c:851: warning: nested extern declaration of 'bind'
test-profile.c:858: warning: implicit declaration of function 'listen'
test-profile.c:858: warning: nested extern declaration of 'listen'
test-profile.c:801: warning: unused variable 'addr'
test-profile.c: In function 'plain_sockets_thread_func':
test-profile.c:940: error: storage size of 'addr' isn't known
test-profile.c:947: error: 'PF_UNIX' undeclared (first use in this function)
test-profile.c:947: error: 'SOCK_STREAM' undeclared (first use in this function)
test-profile.c:957: error: 'AF_UNIX' undeclared (first use in this function)
test-profile.c:970: warning: implicit declaration of function 'connect'
test-profile.c:970: warning: nested extern declaration of 'connect'
test-profile.c:940: warning: unused variable 'addr'

Without knowing exactly what i am speaking about for me it seems that the files in test/core are not 
windows compatible. Just out of curiosity a made a patch against the makefile in that folder to not compile
anything. This is the patch:
$ cat Makefile-dbus-glib-0.82-test-core.patch 
--- Makefile.orig       2009-12-09 09:46:10 +0000
+++ Makefile    2009-12-09 09:46:47 +0000
@@ -445,8 +445,9 @@
        test-profile.c
 
 test_profile_LDADD = $(DBUS_GLIB_THREADS_LIBS) $(top_builddir)/dbus/libdbus-glib-1.la 
-all: $(BUILT_SOURCES)
-       $(MAKE) $(AM_MAKEFLAGS) all-am
+#all: $(BUILT_SOURCES)
+#      $(MAKE) $(AM_MAKEFLAGS) all-am
+all:
 
 .SUFFIXES:
 .SUFFIXES: .c .lo .o .obj
@@ -751,8 +752,9 @@
        $(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(PROGRAMS)
 installdirs:
-install: $(BUILT_SOURCES)
-       $(MAKE) $(AM_MAKEFLAGS) install-am
+#install: $(BUILT_SOURCES)
+#      $(MAKE) $(AM_MAKEFLAGS) install-am
+install:
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am

After this modification i was quite surprised because make and make install were successful.
It seems as if dbus-glib code is portable enough but not the tests.
I used the following to compile and install dbus-glib:
	./configure --disable-tests --disable-doxygen-docs || exit
	cd test/core
	patch -p0 -i ../../../Makefile-dbus-glib-0.82-test-core.patch || exit
	cd ../../
	make || exit
	make install || exit
I hope that this information is useful for somebody else.







More information about the dbus mailing list