Bug 92065 - some sort of build breakage on mingw
Summary: some sort of build breakage on mingw
Status: RESOLVED INVALID
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: git master
Hardware: Other All
: medium normal
Assignee: D-Bus Maintainers
QA Contact: D-Bus Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-21 13:09 UTC by Simon McVittie
Modified: 2015-09-22 19:15 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Simon McVittie 2015-09-21 13:09:12 UTC
Ralf wrote:

compiling tests with autotools seems to be broken:
./dbus/configure --cache-file=mingw32-config.cache --host=i686-w64-mingw32 --build=x86_64-suse-linux-gnu --target=i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32/sys-root/mingw --exec-prefix=/usr/i686-w64-mingw32/sys-root/mingw --bindir=/usr/i686-w64-mingw32/sys-root/mingw/bin --sbindir=/usr/i686-w64-mingw32/sys-root/mingw/sbin --sysconfdir=/usr/i686-w64-mingw32/sys-root/mingw/etc --datadir=/usr/i686-w64-mingw32/sys-root/mingw/share --includedir=/usr/i686-w64-mingw32/sys-root/mingw/include --libdir=/usr/i686-w64-mingw32/sys-root/mingw/lib --libexecdir=/usr/i686-w64-mingw32/sys-root/mingw/libexec --localstatedir=/usr/i686-w64-mingw32/sys-root/mingw/var --sharedstatedir=/usr/i686-w64-mingw32/sys-root/mingw/com --mandir=/usr/i686-w64-mingw32/sys-root/mingw/share/man --infodir=/usr/i686-w64-mingw32/sys-root/mingw/share/info --enable-maintainer-mode --disable-static --enable-verbose-mode --enable-tests --enable-embedded-tests --enable-checks --enable-asserts --disable-xml-docs --disable-doxygen-docs
...
make 
CC       test-utils-glib.lo
../../dbus-master/test/test-utils-glib.c: In function 'test_kill_pid':
../../dbus-master/test/test-utils-glib.c:396:11: warning: comparison between pointer and integer
   if (pid != NULL)
           ^
../../dbus-master/test/test-utils-glib.c:397:23: warning: passing argument 1 of 'TerminateProcess' makes pointer from integer without a cast [-Wint-conversion]
     TerminateProcess (pid, 1);
                       ^
In file included from /home/sysroot-mingw/include/winbase.h:29:0,
                 from /home/sysroot-mingw/include/windows.h:70,
                 from /home/sysroot-mingw/include/winsock2.h:23,
                 from /home/sysroot-mingw/include/ws2tcpip.h:17,
                 from ../../dbus-master/dbus/dbus-sysdeps.h:66,
                 from ../../dbus-master/dbus/dbus-internals.h:33,
                 from ../../dbus-master/test/test-utils.h:10,
                 from ../../dbus-master/test/test-utils-glib.h:34,
                 from ../../dbus-master/test/test-utils-glib.c:28:
/home/sysroot-mingw/include/processthreadsapi.h:81:29: note: expected 'HANDLE {aka void *}' but argument is of type 'GPid {aka int}'
   WINBASEAPI WINBOOL WINAPI TerminateProcess (HANDLE hProcess, UINT uExitCode);
                             ^
../../dbus-master/test/test-utils-glib.c: In function 'test_init':
../../dbus-master/test/test-utils-glib.c:434:3: warning: implicit declaration of function 'alarm' [-Wimplicit-function-declaration]
   alarm (TIMEOUT + 10);
   ^
../../dbus-master/test/test-utils-glib.c:434:3: warning: nested extern declaration of 'alarm' [-Wnested-externs]
../../dbus-master/test/test-utils-glib.c:438:14: error: variable 'act' has initializer but incomplete type
       struct sigaction act = { };
              ^
../../dbus-master/test/test-utils-glib.c:438:24: error: storage size of 'act' isn't known
       struct sigaction act = { };
                        ^
../../dbus-master/test/test-utils-glib.c:442:7: warning: implicit declaration of function 'sigaction' [-Wimplicit-function-declaration]
       sigaction (SIGALRM, &act, NULL);
       ^
../../dbus-master/test/test-utils-glib.c:442:7: warning: nested extern declaration of 'sigaction' [-Wnested-externs]
../../dbus-master/test/test-utils-glib.c:442:18: error: 'SIGALRM' undeclared (first use in this function)
       sigaction (SIGALRM, &act, NULL);
                  ^
../../dbus-master/test/test-utils-glib.c:442:18: note: each undeclared identifier is reported only once for each function it appears in
../../dbus-master/test/test-utils-glib.c:438:24: warning: unused variable 'act' [-Wunused-variable]
       struct sigaction act = { };
                        ^
Comment 1 Simon McVittie 2015-09-21 13:13:49 UTC
(In reply to Simon McVittie from comment #0)
> ../../dbus-master/test/test-utils-glib.c: In function 'test_init':
> ../../dbus-master/test/test-utils-glib.c:434:3: warning: implicit
> declaration of function 'alarm' [-Wimplicit-function-declaration]
>    alarm (TIMEOUT + 10);

This is not compiled unless G_OS_UNIX is defined, which should only happen on a Unix host architecture.

I suspect you are using the headers of a GLib that was compiled for Linux, not one that was compiled for mingw.

Here is how I configure D-Bus for mingw:

${srcdir}/configure \
--enable-maintainer-mode --enable-developer \
--enable-installed-tests --enable-modular-tests --with-glib \
--build=x86_64-pc-linux-gnu --host=i686-w64-mingw32 \
build_alias=x86_64-pc-linux-gnu host_alias=i686-w64-mingw32 \
--prefix=/opt/i686-w64-mingw32 \
LDFLAGS=-L/opt/i686-w64-mingw32/lib \
CPPFLAGS=-I/opt/i686-w64-mingw32/include \
PKG_CONFIG_LIBDIR=/opt/i686-w64-mingw32/lib/pkgconfig \
PKG_CONFIG_PATH=

I have GLib installed with --prefix=/opt/i686-w64-mingw32. You'd use /usr/i686-w64-mingw32/sys-root/mingw instead, I think.
Comment 2 Ralf Habacker 2015-09-22 10:57:43 UTC
(In reply to Simon McVittie from comment #1)
> (In reply to Simon McVittie from comment #0)
> > ../../dbus-master/test/test-utils-glib.c: In function 'test_init':
> > ../../dbus-master/test/test-utils-glib.c:434:3: warning: implicit
> > declaration of function 'alarm' [-Wimplicit-function-declaration]
> >    alarm (TIMEOUT + 10);
> 
> This is not compiled unless G_OS_UNIX is defined, which should only happen
> on a Unix host architecture.
> 
> I suspect you are using the headers of a GLib that was compiled for Linux,
> not one that was compiled for mingw.
> 
> Here is how I configure D-Bus for mingw:
> 
> ${srcdir}/configure \
> --enable-maintainer-mode --enable-developer \
> --enable-installed-tests --enable-modular-tests --with-glib \
> --build=x86_64-pc-linux-gnu --host=i686-w64-mingw32 \
> build_alias=x86_64-pc-linux-gnu host_alias=i686-w64-mingw32 \
> --prefix=/opt/i686-w64-mingw32 \
> LDFLAGS=-L/opt/i686-w64-mingw32/lib \
> CPPFLAGS=-I/opt/i686-w64-mingw32/include \
> PKG_CONFIG_LIBDIR=/opt/i686-w64-mingw32/lib/pkgconfig \
> PKG_CONFIG_PATH=
> 
> I have GLib installed with --prefix=/opt/i686-w64-mingw32. You'd use
> /usr/i686-w64-mingw32/sys-root/mingw instead, I think.

Looks indeed to be a local configure error. Yesterday I added a opensuse package for dbus-1.10 and enabled embedded tests, which compiled without any problem. 
See https://build.opensuse.org/build/home:rhabacker:branches:windows:mingw:win32/openSUSE_13.1/x86_64/mingw32-dbus-1/_log for the log file.

The related configure line is. 

./configure --host=i686-w64-mingw32 --build=x86_64-suse-linux-gnu --target=i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32/sys-root/mingw --exec-prefix=/usr/i686-w64-mingw32/sys-root/mingw --bindir=/usr/i686-w64-mingw32/sys-root/mingw/bin --sbindir=/usr/i686-w64-mingw32/sys-root/mingw/sbin --sysconfdir=/usr/i686-w64-mingw32/sys-root/mingw/etc --datadir=/usr/i686-w64-mingw32/sys-root/mingw/share --includedir=/usr/i686-w64-mingw32/sys-root/mingw/include --libdir=/usr/i686-w64-mingw32/sys-root/mingw/lib --libexecdir=/usr/i686-w64-mingw32/sys-root/mingw/libexec --localstatedir=/usr/i686-w64-mingw32/sys-root/mingw/var --sharedstatedir=/usr/i686-w64-mingw32/sys-root/mingw/com --mandir=/usr/i686-w64-mingw32/sys-root/mingw/share/man --infodir=/usr/i686-w64-mingw32/sys-root/mingw/share/info --enable-maintainer-mode --disable-static --enable-verbose-mode --enable-embedded-tests --enable-checks --enable-asserts --disable-xml-docs --disable-doxygen-docs.

So I recreated a fresh build dir and did run 

../dbus/autogen.sh --host=i686-w64-mingw32 --build=x86_64-suse-linux-gnu --target=i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32/sys-root/mingw --exec-prefix=/usr/i686-w64-mingw32/sys-root/mingw --bindir=/usr/i686-w64-mingw32/sys-root/mingw/bin --sbindir=/usr/i686-w64-mingw32/sys-root/mingw/sbin --sysconfdir=/usr/i686-w64-mingw32/sys-root/mingw/etc --datadir=/usr/i686-w64-mingw32/sys-root/mingw/share --includedir=/usr/i686-w64-mingw32/sys-root/mingw/include --libdir=/usr/i686-w64-mingw32/sys-root/mingw/lib --libexecdir=/usr/i686-w64-mingw32/sys-root/mingw/libexec --localstatedir=/usr/i686-w64-mingw32/sys-root/mingw/var --sharedstatedir=/usr/i686-w64-mingw32/sys-root/mingw/com --mandir=/usr/i686-w64-mingw32/sys-root/mingw/share/man --infodir=/usr/i686-w64-mingw32/sys-root/mingw/share/info --enable-maintainer-mode --disable-static --enable-verbose-mode --enable-embedded-tests --enable-checks --enable-asserts --disable-xml-docs --disable-doxygen-docs

and got still the same error. 

Greping "usr/include" in <build-root>/config.status returns 

S["GLIB_CFLAGS"]="-pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include "
S["oldincludedir"]="/usr/include"

This looks wrong. The pathes should be prefixed with /usr/i686-... 

autoconf/pkgconfig issue ?
Comment 3 Simon McVittie 2015-09-22 11:18:55 UTC
This is not a D-Bus bug, as far as I can see.

(In reply to Ralf Habacker from comment #2)
> autoconf/pkgconfig issue ?

Yes, looks like it. If you are cross-compiling anything that uses pkg-config, you need to do at least one of these two things:

* set PKG_CONFIG_PATH and/or PKG_CONFIG_LIBDIR so that pkg-config
  will look in the appropriate prefix or sysroot to find your
  foreign (mingw) libraries; or

* have a ${tuple}-pkg-config in your $PATH which looks in
  the appropriate prefix or sysroot to find the foreign libraries,
  or set ${PKG_CONFIG} to point to a script or executable that does so

${tuple} represents the host alias, which is i686-w64-mingw32 in your case. ${tuple}-pkg-config is usually implemented as a shell script that sets PKG_CONFIG_PATH and/or PKG_CONFIG_LIBDIR, then execs the real pkg-config.

If you don't do either of those, then pkg-config will find your build system's GLib instead of the foreign GLib, and you get these errors.

You can see from the log that the OBS build procedure has in fact done *both*:

[   83s] + PKG_CONFIG_PATH=/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/i686-w64-mingw32/sys-root/mingw/share/pkgconfig
[   83s] + export PKG_CONFIG_PATH

and

[   83s] + declare -x PKG_CONFIG=/usr/bin/i686-w64-mingw32-pkg-config
[   83s] + export PKG_CONFIG

(In reply to Ralf Habacker from comment #2)
> So I recreated a fresh build dir and did run 
> 
> ../dbus/autogen.sh --host=i686-w64-mingw32 --build=x86_64-suse-linux-gnu
> --target=i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32/sys-root/mingw
> --exec-prefix=/usr/i686-w64-mingw32/sys-root/mingw
> --bindir=/usr/i686-w64-mingw32/sys-root/mingw/bin
> --sbindir=/usr/i686-w64-mingw32/sys-root/mingw/sbin
> --sysconfdir=/usr/i686-w64-mingw32/sys-root/mingw/etc
> --datadir=/usr/i686-w64-mingw32/sys-root/mingw/share
> --includedir=/usr/i686-w64-mingw32/sys-root/mingw/include
> --libdir=/usr/i686-w64-mingw32/sys-root/mingw/lib
> --libexecdir=/usr/i686-w64-mingw32/sys-root/mingw/libexec
> --localstatedir=/usr/i686-w64-mingw32/sys-root/mingw/var
> --sharedstatedir=/usr/i686-w64-mingw32/sys-root/mingw/com
> --mandir=/usr/i686-w64-mingw32/sys-root/mingw/share/man
> --infodir=/usr/i686-w64-mingw32/sys-root/mingw/share/info
> --enable-maintainer-mode --disable-static --enable-verbose-mode
> --enable-embedded-tests --enable-checks --enable-asserts --disable-xml-docs
> --disable-doxygen-docs
> 
> and got still the same error. 

For your information, you don't need *all* those directory options: the OBS build system is putting them in for completeness, but --prefix=/usr/i686-w64-mingw32/sys-root/mingw (or even just --prefix=/mingw) should be enough.

You also don't need --target, because dbus is not a compiler (again, OBS is just putting it in for completeness).

However, you do need to set up pkg-config to be looking in the right place for libraries. The simplest way is as I described in Comment #1.
Comment 4 Ralf Habacker 2015-09-22 18:59:56 UTC
(In reply to Simon McVittie from comment #3)
> This is not a D-Bus bug, as far as I can see.
> > 
> > ../dbus/autogen.sh --host=i686-w64-mingw32 --build=x86_64-suse-linux-gnu
> > --target=i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32/sys-root/mingw
> > --exec-prefix=/usr/i686-w64-mingw32/sys-root/mingw
> > --bindir=/usr/i686-w64-mingw32/sys-root/mingw/bin
> > --sbindir=/usr/i686-w64-mingw32/sys-root/mingw/sbin
> > --sysconfdir=/usr/i686-w64-mingw32/sys-root/mingw/etc
> > --datadir=/usr/i686-w64-mingw32/sys-root/mingw/share
> > --includedir=/usr/i686-w64-mingw32/sys-root/mingw/include
> > --libdir=/usr/i686-w64-mingw32/sys-root/mingw/lib
> > --libexecdir=/usr/i686-w64-mingw32/sys-root/mingw/libexec
> > --localstatedir=/usr/i686-w64-mingw32/sys-root/mingw/var
> > --sharedstatedir=/usr/i686-w64-mingw32/sys-root/mingw/com
> > --mandir=/usr/i686-w64-mingw32/sys-root/mingw/share/man
> > --infodir=/usr/i686-w64-mingw32/sys-root/mingw/share/info
> > --enable-maintainer-mode --disable-static --enable-verbose-mode
> > --enable-embedded-tests --enable-checks --enable-asserts --disable-xml-docs
> > --disable-doxygen-docs
> > 
> > and got still the same error. 

This bug has been introduced with dbus-1.10. Compiling dbus-1.8 branch with the same configure line do not show this compile error :-(
Comment 5 Ralf Habacker 2015-09-22 19:02:10 UTC
(In reply to Simon McVittie from comment #3)

> [   83s] +
> PKG_CONFIG_PATH=/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/i686-
> w64-mingw32/sys-root/mingw/share/pkgconfig
> [   83s] + export PKG_CONFIG_PATH
> 
> and
> 
> [   83s] + declare -x PKG_CONFIG=/usr/bin/i686-w64-mingw32-pkg-config
> [   83s] + export PKG_CONFIG
> 

For the record:  pkgconfig uses cross pkg-config and looks okay.
S["PKG_CONFIG"]="/usr/bin/i686-w64-mingw32-pkg-config"
Comment 6 Ralf Habacker 2015-09-22 19:06:24 UTC
(In reply to Ralf Habacker from comment #5)
> (In reply to Simon McVittie from comment #3)
> 
> > [   83s] +
> > PKG_CONFIG_PATH=/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/i686-
> > w64-mingw32/sys-root/mingw/share/pkgconfig
> > [   83s] + export PKG_CONFIG_PATH
> > 
> > and
> > 
> > [   83s] + declare -x PKG_CONFIG=/usr/bin/i686-w64-mingw32-pkg-config
> > [   83s] + export PKG_CONFIG
> > 
> 
> For the record:  pkgconfig uses cross pkg-config and looks okay.
> S["PKG_CONFIG"]="/usr/bin/i686-w64-mingw32-pkg-config"

and running 

 for i in $(/usr/bin/i686-w64-mingw32-pkg-config --list-all | gawk '{ print $1}'); do /usr/bin/i686-w64-mingw32-pkg-config --cflags $i; done | grep /usr/include

do not return any reference of /usr/include. 

It looks that with dbus-1.10 autotools build system introduces hardcoded /usr/include pathes regardless of choosen build target platform.
Comment 7 Ralf Habacker 2015-09-22 19:15:47 UTC
(In reply to Ralf Habacker from comment #6)

> It looks that with dbus-1.10 autotools build system introduces hardcoded
> /usr/include pathes regardless of choosen build target platform.

After switching back to dbus-1.10 after the dbus-1.8 recompile I got the error again once and then no more.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.