Bug 46367

Summary: cross-compiling dbus on ubuntu/mingw-w64, undefined reference to message_get_error_name
Product: dbus Reporter: william <r.3>
Component: coreAssignee: Havoc Pennington <hp>
Status: RESOLVED DUPLICATE QA Contact: John (J5) Palmieri <johnp>
Severity: normal    
Priority: medium    
Version: 1.5   
Hardware: x86 (IA32)   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: compilation log, configure.ac, configure.log
adds "disable_shared" detection
patch to dbus-1-5-8/tools/Makefile.am

Description william 2012-02-20 12:38:38 UTC
cross-compiling on top of mingw-w64 gcc, from ubuntu, with a modified version of mingw-cross-env, I run :
automake && ./configure --host='x86_64-w64-mingw32' --prefix='/home/performance/prgm/mingw-cross-env-x86/usr/x86_64-w64-mingw32' --disable-shared --enable-static

with this, I get errors, among which the first : 
  CCLD   dbus-launch.exe
  CC     dbus-monitor.o
  CC     dbus-print-message.o
  CCLD   dbus-monitor.exe
dbus-monitor.o: In function `profile_print_with_attrs':
/home/performance/prgm/mingw-cross-env-x86/tmp-dbus/dbus-1.5.8/tools/dbus-monitor.c:154: undefined reference to `__imp_dbus_message_get_error_name'
/home/performance/prgm/mingw-cross-env-x86/tmp-dbus/dbus-1.5.8/tools/dbus-monitor.c:151: undefined reference to `__imp_dbus_message_get_member'
/home/performance/prgm/mingw-cross-env-x86/tmp-dbus/dbus-1.5.8/tools/dbus-monitor.c:148: undefined reference to `__imp_dbus_message_get_interface'
/home/performance/prgm/mingw-cross-env-x86/tmp-dbus/dbus-1.5.8/tools/dbus-monitor.c:145: undefined reference to `__imp_dbus_message_get_path'
/home/performance/prgm/mingw-cross-env-x86/tmp-dbus/dbus-1.5.8/tools/dbus-monitor.c:142: undefined reference to `__imp_dbus_message_get_destination'
/home/performance/prgm/mingw-cross-env-x86/tmp-dbus/dbus-1.5.8/tools/dbus-monitor.c:139: undefined reference to `__imp_dbus_message_get_sender'
/home/performance/prgm/mingw-cross-env-x86/tmp-dbus/dbus-1.5.8/tools/dbus-monitor.c:136: undefined reference to `__imp_dbus_message_get_reply_serial'
/home/performance/prgm/mingw-cross-env-x86/tmp-dbus/dbus-1.5.8/tools/dbus-monitor.c:133: undefined reference to `__imp_dbus_message_get_serial'

I am trying to compile "static", but it seems there is some confusion with dll?
Comment 1 Simon McVittie 2012-02-21 01:35:41 UTC

*** This bug has been marked as a duplicate of bug 33973 ***
Comment 2 Simon McVittie 2012-02-21 07:10:54 UTC
*** Bug 46366 has been marked as a duplicate of this bug. ***
Comment 3 william 2012-02-22 10:45:31 UTC
Created attachment 57476 [details]
compilation log, configure.ac, configure.log
Comment 4 william 2012-02-22 10:46:47 UTC
the bug was not really the same as 33973, and the proposed action did not solved the problem...
Comment 5 william 2012-02-22 11:04:07 UTC
oops sorry :
the proposed patch on the configure.ac did not work :
if test "x$enable_shared" = xno; then
        AC_DEFINE([DBUS_STATIC_BUILD], [1],
            [Define to 1 if you are only building static libraries])
    fi

but adding DDBUS_STATIC_BUILD worked :
./configure [...] --enable-static --disable-shared CFLAGS=-DDBUS_STATIC_BUILD

I'll have a look to see a way to include this in configure.ac

cheers
Comment 6 william 2012-02-22 14:31:54 UTC
Created attachment 57488 [details] [review]
adds "disable_shared" detection
Comment 7 william 2012-02-22 14:32:51 UTC
Created attachment 57489 [details] [review]
patch to dbus-1-5-8/tools/Makefile.am
Comment 8 william 2012-02-22 14:37:36 UTC
Here are patches to dbus-1.5.8/configure.ac and dbus-1.5.8/tools/Makefile.am to fix the problem.
Comment 9 Simon McVittie 2012-03-12 07:14:26 UTC
(In reply to comment #4)
> the bug was not really the same as 33973

The cause and solution appear to be the same, even if your compilation environment is different. I'm going to (re-)close this as a duplicate and use Bug #33973 as the "main" bug, since that ensures that the reporter of 33973 gets cc'd.

(In reply to comment #8)
> Here are patches to dbus-1.5.8/configure.ac and dbus-1.5.8/tools/Makefile.am to
> fix the problem.

Thanks, these look good. I've adjusted them a bit to add some comments and propagate DBUS_BUILD_STATIC to the pkg-config files too, when in a static-only build (which I believe is necessary if you're using pkg-config). I'll attach the results to Bug #33973.

*** This bug has been marked as a duplicate of bug 33973 ***

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.