Bug 22972

Summary: libuuid apparently mis-detected on Darwin and OpenBSD
Product: Telepathy Reporter: jack fink <jackfink>
Component: gabbleAssignee: Nicolas Dufresne <nicolas>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium CC: jasper
Version: unspecified   
Hardware: All   
OS: other   
Whiteboard:
i915 platform: i915 features:

Description jack fink 2009-07-27 14:44:16 UTC
next build issue...here is the complete output on stderr when running make -k:

gibber-resolver.c: In function 'gibber_resolver_res_query_to_list':
gibber-resolver.c:667: error: 'HEADER' undeclared (first use in this function)
gibber-resolver.c:667: error: (Each undeclared identifier is reported only once
gibber-resolver.c:667: error: for each function it appears in.)
gibber-resolver.c:669: error: 'head' undeclared (first use in this function)
gibber-resolver.c:669: error: parse error before ')' token
gibber-resolver.c:678: error: 'QFIXEDSZ' undeclared (first use in this function)
gibber-resolver.c:692: error: 'T_SRV' undeclared (first use in this function)
gibber-resolver.c:692: error: 'C_IN' undeclared (first use in this function)
gibber-resolver.c: In function 'gibber_resolver_gai_error_to_g_error':
gibber-resolver.c:738: error: 'EAI_OVERFLOW' undeclared (first use in this function)
gibber-resolver.c: In function 'resolver_resolv_srv':
gibber-resolver.c:800: error: 'C_IN' undeclared (first use in this function)
gibber-resolver.c:800: error: 'T_SRV' undeclared (first use in this function)
make[4]: *** [gibber-resolver.lo] Error 1
asyncns.c: In function 'handle_request':
asyncns.c:570: error: 'HEADER' undeclared (first use in this function)
asyncns.c:570: error: (Each undeclared identifier is reported only once
asyncns.c:570: error: for each function it appears in.)
asyncns.c:570: error: parse error before 'answer'
asyncns.c:580: error: 'answer' undeclared (first use in this function)
make[4]: *** [asyncns.lo] Error 1
make[4]: Target `all-am' not remade because of errors.
make[3]: *** [all] Error 2
make[2]: *** [all-recursive] Error 1
make[2]: Target `all' not remade because of errors.
util.c: In function 'gabble_generate_id':
util.c:82: error: storage size of 'uu' isn't known
util.c:86: warning: implicit declaration of function 'uuid_generate_random'
util.c:87: warning: implicit declaration of function 'uuid_unparse_lower'
util.c:82: warning: unused variable 'uu'
make[3]: *** [util.lo] Error 1
gibber-resolver.c: In function 'gibber_resolver_res_query_to_list':
gibber-resolver.c:667: error: 'HEADER' undeclared (first use in this function)
gibber-resolver.c:667: error: (Each undeclared identifier is reported only once
gibber-resolver.c:667: error: for each function it appears in.)
gibber-resolver.c:669: error: 'head' undeclared (first use in this function)
gibber-resolver.c:669: error: parse error before ')' token
gibber-resolver.c:678: error: 'QFIXEDSZ' undeclared (first use in this function)
gibber-resolver.c:692: error: 'T_SRV' undeclared (first use in this function)
gibber-resolver.c:692: error: 'C_IN' undeclared (first use in this function)
gibber-resolver.c: In function 'gibber_resolver_gai_error_to_g_error':
gibber-resolver.c:738: error: 'EAI_OVERFLOW' undeclared (first use in this function)
gibber-resolver.c: In function 'resolver_resolv_srv':
gibber-resolver.c:800: error: 'C_IN' undeclared (first use in this function)
gibber-resolver.c:800: error: 'T_SRV' undeclared (first use in this function)
make[4]: *** [gibber-resolver.lo] Error 1
asyncns.c: In function 'handle_request':
asyncns.c:570: error: 'HEADER' undeclared (first use in this function)
asyncns.c:570: error: (Each undeclared identifier is reported only once
asyncns.c:570: error: for each function it appears in.)
asyncns.c:570: error: parse error before 'answer'
asyncns.c:580: error: 'answer' undeclared (first use in this function)
make[4]: *** [asyncns.lo] Error 1
make[4]: Target `libgibber.la' not remade because of errors.
make[3]: *** [../lib/gibber/libgibber.la] Error 2
make[3]: Target `all-am' not remade because of errors.
make[2]: *** [all] Error 2
util.c: In function 'gabble_generate_id':
util.c:82: error: storage size of 'uu' isn't known
util.c:86: warning: implicit declaration of function 'uuid_generate_random'
util.c:87: warning: implicit declaration of function 'uuid_unparse_lower'
util.c:82: warning: unused variable 'uu'
make[3]: *** [util.lo] Error 1
gibber-resolver.c: In function 'gibber_resolver_res_query_to_list':
gibber-resolver.c:667: error: 'HEADER' undeclared (first use in this function)
gibber-resolver.c:667: error: (Each undeclared identifier is reported only once
gibber-resolver.c:667: error: for each function it appears in.)
gibber-resolver.c:669: error: 'head' undeclared (first use in this function)
gibber-resolver.c:669: error: parse error before ')' token
gibber-resolver.c:678: error: 'QFIXEDSZ' undeclared (first use in this function)
gibber-resolver.c:692: error: 'T_SRV' undeclared (first use in this function)
gibber-resolver.c:692: error: 'C_IN' undeclared (first use in this function)
gibber-resolver.c: In function 'gibber_resolver_gai_error_to_g_error':
gibber-resolver.c:738: error: 'EAI_OVERFLOW' undeclared (first use in this function)
gibber-resolver.c: In function 'resolver_resolv_srv':
gibber-resolver.c:800: error: 'C_IN' undeclared (first use in this function)
gibber-resolver.c:800: error: 'T_SRV' undeclared (first use in this function)
make[4]: *** [gibber-resolver.lo] Error 1
asyncns.c: In function 'handle_request':
asyncns.c:570: error: 'HEADER' undeclared (first use in this function)
asyncns.c:570: error: (Each undeclared identifier is reported only once
asyncns.c:570: error: for each function it appears in.)
asyncns.c:570: error: parse error before 'answer'
asyncns.c:580: error: 'answer' undeclared (first use in this function)
make[4]: *** [asyncns.lo] Error 1
make[4]: Target `libgibber.la' not remade because of errors.
make[3]: *** [../lib/gibber/libgibber.la] Error 2
make[3]: Target `write-mgr-file' not remade because of errors.
make[2]: *** [gabble.manager] Error 2
make[2]: Target `all' not remade because of errors.
make[5]: *** No rule to make target `../../src/libgabble-convenience.la', needed by `telepathy-gabble-debug'.
make[5]: *** No rule to make target `../../lib/gibber/libgibber.la', needed by `telepathy-gabble-debug'.
make[5]: Target `all-am' not remade because of errors.
make[4]: *** [all-recursive] Error 1
make[3]: *** [all] Error 2
make[3]: *** No rule to make target `../src/libgabble-convenience.la', needed by `test-base64'.
make[3]: Target `all-am' not remade because of errors.
make[2]: *** [all-recursive] Error 1
make[2]: Target `all' not remade because of errors.
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Comment 1 Simon McVittie 2009-07-28 02:55:11 UTC
Looks like three separate portability bugs; thanks for doing the make -k, this lets us deal with them all at the same time!

(In reply to comment #0)
> next build issue...here is the complete output on stderr when running make -k:
> 
> gibber-resolver.c: In function 'gibber_resolver_res_query_to_list':
> gibber-resolver.c:667: error: 'HEADER' undeclared (first use in this function)
> gibber-resolver.c:667: error: (Each undeclared identifier is reported only once
> gibber-resolver.c:667: error: for each function it appears in.)
> gibber-resolver.c:669: error: 'head' undeclared (first use in this function)
> gibber-resolver.c:669: error: parse error before ')' token
> gibber-resolver.c:678: error: 'QFIXEDSZ' undeclared (first use in this
> function)
> gibber-resolver.c:692: error: 'T_SRV' undeclared (first use in this function)
> gibber-resolver.c:692: error: 'C_IN' undeclared (first use in this function)

Jack, could you look at your standard library headers - is there a macro we can use to obtain these on Darwin? On Linux you need either <arpa/nameser_compat.h>, or <arpa/nameser.h> with BIND_4_COMPAT defined (which that header does automatically). Perhaps defining BIND_4_COMPAT on Darwin would work?

Sjoerd, do you have any idea about the portability of those headers?

> gibber-resolver.c: In function 'gibber_resolver_gai_error_to_g_error':
> gibber-resolver.c:738: error: 'EAI_OVERFLOW' undeclared (first use in this
> function)

That error code might be Linux-specific; we could do an autoconf test for it?

> util.c: In function 'gabble_generate_id':
> util.c:82: error: storage size of 'uu' isn't known
> util.c:86: warning: implicit declaration of function 'uuid_generate_random'
> util.c:87: warning: implicit declaration of function 'uuid_unparse_lower'
> util.c:82: warning: unused variable 'uu'
> make[3]: *** [util.lo] Error 1

lib/gibber/Makefile.am should add UUID_CFLAGS to Makefile.am, but doesn't.
Comment 2 Simon McVittie 2009-07-28 03:00:06 UTC
(In reply to comment #1)
> lib/gibber/Makefile.am should add UUID_CFLAGS to Makefile.am, but doesn't.

Er, src/Makefile.am, even... but it does. So, something is wrong in your version of libuuid... the pkg-config test is finding it, but then producing the wrong CFLAGS, or something.

What output do you get for these commands?

pkg-config --exists uuid ; echo $?
pkg-config --cflags uuid
pkg-config --libs uuid

and where are your libuuid.so and uuid.h located?
Comment 3 Simon McVittie 2010-09-27 08:05:29 UTC
(In reply to comment #0)
> gibber-resolver.c: In function 'gibber_resolver_res_query_to_list':

We've deleted this file, so, RESOLVED FIXED :-)

> asyncns.c: In function 'handle_request':

This one, too.

> util.c: In function 'gabble_generate_id':
> util.c:82: error: storage size of 'uu' isn't known
> util.c:86: warning: implicit declaration of function 'uuid_generate_random'
> util.c:87: warning: implicit declaration of function 'uuid_unparse_lower'
> util.c:82: warning: unused variable 'uu'

The remaining bug, which, as far as I can see, ought to work already; see Comment #2. Jack, could you answer the questions I asked there please?

It appears OpenBSD have a patch for this too [1], so I've cc'd the OpenBSD maintainer. Jasper, if you can answer my questions from Comment #2 for OpenBSD, that might shed some light on this? You really shouldn't need that patch, unless uuid.pc is rather different on *BSD: on Linux, it adds -I/usr/include/uuid, so including <uuid.h> is correct.

<uuid/uuid.h> seems incorrect, because that assumes that the *parent* directory is on the -I path; if your libuuid was installed in /opt/mypackages or something, then that would fail, because /opt/mypackages/include wouldn't be in the -I path, but -I/opt/mypackages/include/uuid is added by pkg-config.

[1] http://www.openbsd.org/cgi-bin/cvsweb/ports/net/telepathy/telepathy-gabble/patches/patch-src_util_c?rev=1.3
Comment 4 Jasper Lievisse Adriaanse 2010-09-27 08:25:03 UTC
The uuid from our devel/uuid appears too old, so I've patched our port to use the newer uuid from e2fsprogs.

The first one uses include/uuid.h while the latter one uses include/uuid/uuid.h to prevent a conflict between the too.

gurthang:jasper {2001} pkg-config --exists uuid ; echo $?
1
gurthang:jasper {2002}

The relevant cvsweb pages are:
http://www.openbsd.org/cgi-bin/cvsweb/ports/devel/uuid/ (the one that's too old)
http://www.openbsd.org/cgi-bin/cvsweb/ports/sysutils/e2fsprogs/ (the one we use)
Comment 5 Simon McVittie 2010-09-27 09:15:03 UTC
(In reply to comment #4)
> The uuid from our devel/uuid appears too old, so I've patched our port to use
> the newer uuid from e2fsprogs.

It seems your "uuid" is from ossp.org. It isn't the same library at all, so it's not surprising if it isn't compatible! In Debian, this one is packaged as ossp-uuid, with the SONAME and the name in pkg-config changed.

Because Debian repackages it to coexist with e2fsprogs' uuid, I hadn't realised that both upstreams provide uuid.pc, with incompatible APIs. I'm opening bugs asking them to provide <ossp-uuid.h> and <e2fs-uuid.h> or something, in addition to the colliding names, with corresponding pkg-config files.

The one from e2fsprogs is indeed the one we intended Gabble to use.

Perhaps you could get the OSSP uuid port in OpenBSD changed to use /usr/include/ossp/uuid.h and put -I/usr/include/ossp in its pkg-config flag? Then it'd be possible to select either version to provide <uuid.h>, by setting -I/usr/include/ossp or -I/usr/include/uuid, without accidentally getting the "chosen" /usr/include/uuid.h turning up when unwanted.
Comment 6 Simon McVittie 2010-09-27 09:23:10 UTC
(In reply to comment #5)
> I'm opening bugs
> asking them to provide <ossp-uuid.h> and <e2fs-uuid.h> or something

e2fsprogs: https://sourceforge.net/tracker/?func=detail&aid=3076666&group_id=2406&atid=352406

OSSP: http://cvs.ossp.org/tktview?tn=181
Comment 7 Jasper Lievisse Adriaanse 2010-09-27 09:49:17 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > The uuid from our devel/uuid appears too old, so I've patched our port to use
> > the newer uuid from e2fsprogs.
> 
> It seems your "uuid" is from ossp.org. It isn't the same library at all, so
> it's not surprising if it isn't compatible! In Debian, this one is packaged as
> ossp-uuid, with the SONAME and the name in pkg-config changed.
> 
> Because Debian repackages it to coexist with e2fsprogs' uuid, I hadn't realised
> that both upstreams provide uuid.pc, with incompatible APIs. I'm opening bugs
> asking them to provide <ossp-uuid.h> and <e2fs-uuid.h> or something, in
> addition to the colliding names, with corresponding pkg-config files.
> 
> The one from e2fsprogs is indeed the one we intended Gabble to use.
> 
> Perhaps you could get the OSSP uuid port in OpenBSD changed to use
> /usr/include/ossp/uuid.h and put -I/usr/include/ossp in its pkg-config flag?
> Then it'd be possible to select either version to provide <uuid.h>, by setting
> -I/usr/include/ossp or -I/usr/include/uuid, without accidentally getting the
> "chosen" /usr/include/uuid.h turning up when unwanted.

Good point, Ill take care of this.
Comment 8 Nicolas Dufresne 2010-10-04 08:55:13 UTC
Note that this is fixed upstream by removing dependency to libuuid. Should this be considered for inclusion in stable 0.10 branch ?
Comment 9 Jasper Lievisse Adriaanse 2010-10-04 10:22:33 UTC
(In reply to comment #8)
> Note that this is fixed upstream by removing dependency to libuuid. Should this
> be considered for inclusion in stable 0.10 branch ?

Backport the removal into 0.10 you mean?
Comment 10 Simon McVittie 2010-10-04 10:35:44 UTC
(In reply to comment #8)
> Note that this is fixed upstream by removing dependency to libuuid. Should this
> be considered for inclusion in stable 0.10 branch ?

Yes, I think that'd be appropriate. Cherry-picking the patch is probably enough.
Comment 11 Nicolas Dufresne 2010-10-04 10:56:29 UTC
Fixed in stable 0.10 branch too. Will be available in the next stable release (will be 0.10.3).
Comment 12 Jasper Lievisse Adriaanse 2010-10-04 10:57:35 UTC
(In reply to comment #11)
> Fixed in stable 0.10 branch too. Will be available in the next stable release
> (will be 0.10.3).

Thanks!

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.