Bug 59264

Summary: 'xcb_generic_error_t' has no member named 'major_code' and no member named 'minor_code'
Product: cairo Reporter: Peter Dyballa <Peter_Dyballa>
Component: xcb backendAssignee: Uli Schlachter <psychon>
Status: RESOLVED INVALID QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: 1.12.8   
Hardware: x86-64 (AMD64)   
OS: Mac OS X (All)   
Whiteboard:
i915 platform: i915 features:

Description Peter Dyballa 2013-01-12 00:12:27 UTC
I trying to build FontForge as an application that could run on many Macs, so I am trying to build quite a lot of static and shared libraries. Cairo 1.12.8 was configured as:

	env LANG=C PATH=${HOME}/Softwaren64/bin:/usr/bin:/opt/local/x86_64-apple-darwin10.8.0/bin:/opt/local/bin:$PATH ./configure --prefix=${HOME}/Softwaren64 --with-pic --enable-static --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib CPPFLAGS="-H -I${HOME}/Softwaren64/include -DCAIRO_NO_MUTEX=1 " CFLAGS="-pipe -fPIC -fno-common -Os -march=core2 -mtune=core2 -m64 -fomit-frame-pointer -msse4.2  -Wimplicit-function-declaration" LDFLAGS="-m64 -Wl,-t -Wl,-dead_strip_dylibs -L${HOME}/Softwaren64/lib" PKG_CONFIG_PATH=${HOME}/Softwaren64/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11/share/pkgconfig:/usr/X11/lib/pkgconfig

Xcb is version 1.9. The compiler option -Wimplicit-function-declaration is needed or this error will be reported:

	cairo-xcb-shm.c: In function '_cairo_xcb_connection_allocate_shm_info':
	cairo-xcb-shm.c:177: error: implicit declaration of function 'xcb_discard_reply'
	cairo-xcb-shm.c:177: warning: nested extern declaration of 'xcb_discard_reply'

With the above configuration I ran into this error:

	cairo-boilerplate-xcb.c: In function '_cairo_boilerplate_xcb_handle_errors':
	cairo-boilerplate-xcb.c:59: error: 'xcb_generic_error_t' has no member named 'major_code'
	cairo-boilerplate-xcb.c:59: error: 'xcb_generic_error_t' has no member named 'minor_code'
	make[5]: *** [cairo-boilerplate-xcb.lo] Error 1
	make[4]: *** [../boilerplate/libcairoboilerplate.la] Error 2

Is my Xcb version too up-to-date?

The compiler used is GCC 4.2.1, OS is Mac OS X 10.6.8, Snow Leopard.

How can I make the "macros" CC etc. display the complete line of invocation?
Comment 1 Uli Schlachter 2013-01-12 09:43:17 UTC
(In reply to comment #0)
> Xcb is version 1.9. The compiler option -Wimplicit-function-declaration is
> needed or this error will be reported:
> 
> 	cairo-xcb-shm.c: In function '_cairo_xcb_connection_allocate_shm_info':
> 	cairo-xcb-shm.c:177: error: implicit declaration of function
> 'xcb_discard_reply'
> 	cairo-xcb-shm.c:177: warning: nested extern declaration of
> 'xcb_discard_reply'

Are you really, really, really sure that this is xcb 1.9? And there is no older version of xcb laying around somewhere? The function xcb_discard_reply() was added in libxcb 1.6.

> With the above configuration I ran into this error:
> 
> 	cairo-boilerplate-xcb.c: In function '_cairo_boilerplate_xcb_handle_errors':
> 	cairo-boilerplate-xcb.c:59: error: 'xcb_generic_error_t' has no member
> named 'major_code'
> 	cairo-boilerplate-xcb.c:59: error: 'xcb_generic_error_t' has no member
> named 'minor_code'
> 	make[5]: *** [cairo-boilerplate-xcb.lo] Error 1
> 	make[4]: *** [../boilerplate/libcairoboilerplate.la] Error 2
> 
> Is my Xcb version too up-to-date?

Apparently not. These fields are even older and were added in libxcb 1.4

> How can I make the "macros" CC etc. display the complete line of invocation?

I am not sure. It was either "make VERBOSE=1" or "make V=1". You can also pass --disable-silent-rules to ./configure.

How many versions of libxcb do you have laying around? With "locate xcb.pc" you should at least be able to find all the xcb pkg-config files.
Comment 2 Peter Dyballa 2013-01-12 22:09:27 UTC
(In reply to comment #1)
> 
> Are you really, really, really sure that this is xcb 1.9? And there is no
> older version of xcb laying around somewhere? The function
> xcb_discard_reply() was added in libxcb 1.6.

Configure performs this check:

	  xcb_REQUIRES="xcb >= 1.6 xcb-render >= 1.6"
	  ($PKG_CONFIG --exists --print-errors "$xcb_REQUIRES") 2>&5

and then reports:

	checking for xcb... yes

So configure likely checked a libxcb version >= 1.6. Changing directory to libxcb-1.9 I get:

	find . -type f -name "*.[ch]" -exec grep xcb_discard_reply {} /dev/null \;
	./src/xcb.h:void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence);
	./src/xcb_in.c:void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence)
	./src/xcbext.h: * xcb_discard_reply(). */

These lines from the compilation with -H show the use of the original Mac OS X libxcb header files:

	/usr/X11/include/xcb/render.h
	/usr/X11/include/xcb/shm.h
	/usr/X11/include/xcb/xcb.h
	/usr/X11/include/xcb/xcbext.h
	/usr/X11/include/xcb/xproto.h

It is version 1.2… Which explains the failure. The cause is here (from config.log):

	xcb_CFLAGS='-I${HOME}/Softwaren64/include -I/usr/X11/include  '
	xcb_LIBS='-L${HOME}/Softwaren64/lib -lxcb-render -lxcb  '
	xcb_shm_CFLAGS='-I${HOME}/Softwaren64/include -I/usr/X11/include  '
	xcb_shm_LIBS='-L${HOME}/Softwaren64/lib -lxcb-shm -lxcb  '
	xlib_CFLAGS='-I/usr/X11/include  '
	xlib_LIBS='-L/usr/X11/lib -lX11 -lXext  '
	xlib_xcb_CFLAGS=''
	xlib_xcb_LIBS=''
	xlib_xrender_CFLAGS='-I/usr/X11/include  '
	xlib_xrender_LIBS='-L/usr/X11/lib -lXrender -lX11  '

It uses Mac OS X's original libX11, which is version 1.2.1. I am also using fontconfig from Mac OS X, so I have one more reason to include /usr/X11/include. But GCC 4 (at least on Mac OS X) knows the option -idirafter. Configuring as in:

	env LANG=C PATH=${HOME}/Softwaren64/bin:/usr/bin:/opt/local/x86_64-apple-darwin10.8.0/bin:/opt/local/bin:$PATH ./configure --prefix=${HOME}/Softwaren64 --with-pic --enable-static --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib CPPFLAGS="-H -I${HOME}/Softwaren64/include -idirafter /usr/X11/include -DCAIRO_NO_MUTEX=1" CFLAGS="-pipe -fPIC -fno-common -Os -march=core2 -mtune=core2 -m64 -fomit-frame-pointer -msse4.2" LDFLAGS="-m64 -Wl,-t -Wl,-dead_strip_dylibs -L${HOME}/Softwaren64/lib" PKG_CONFIG_PATH=${HOME}/Softwaren64/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11/share/pkgconfig:/usr/X11/lib/pkgconfig

allows to successfully build Cairo 1.12.8!


Thank you for encouraging me to search my own failures!

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.