GNOME Bugzilla – Bug 517985
[lame] compile error on Solaris, broken GST_ELEMENT_ERROR macro use
Last modified: 2008-02-29 11:09:20 UTC
I'm building gst-plugins-ugly 0.10.7 to go along with gstreamer 0.10.17, gst-plugins-base 0.10.17, and gst-plugins-good from CVS. I'm building on x86_64-sun-solaris2.10 with the Sun Workshop 12 compilers. When I get to the build for ext/gstlame.c, it fails with this error: source='gstlame.c' object='libgstlame_la-gstlame.lo' libtool=yes \ DEPDIR=.deps depmode=none /bin/bash ../../depcomp \ /bin/bash ../../libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -I../.. -I/local/include/X11 -I/local/include -I/local/gnu/include/X11 -I/local/gnu/include -I../../gst-libs -I../../gst-libs -D_REENTRANT -D_PTHREADS -I/local/gnu/include/gstreamer-0.10 -I/local/gnu/include/glib-2.0 -I/local/gnu/lib/64/glib-2.0/include -I/local/gnu/include/libxml2 -g -DGSTLAME_PRESET -I/local/include/X11 -I/local/include -I/local/gnu/include/X11 -I/local/gnu/include -Xa -xO2 -xstrconst -KPIC -m64 -xtarget=native -xarch=native -c -o libgstlame_la-gstlame.lo `test -f 'gstlame.c' || echo './'`gstlame.c mkdir .libs cc -DHAVE_CONFIG_H -I. -I../.. -I/local/include/X11 -I/local/include -I/local/gnu/include/X11 -I/local/gnu/include -I../../gst-libs -I../../gst-libs -D_REENTRANT -D_PTHREADS -I/local/gnu/include/gstreamer-0.10 -I/local/gnu/include/glib-2.0 -I/local/gnu/lib/64/glib-2.0/include -I/local/gnu/include/libxml2 -g -DGSTLAME_PRESET -I/local/include/X11 -I/local/include -I/local/gnu/include/X11 -I/local/gnu/include -Xa -xO2 -xstrconst -KPIC -m64 -xtarget=native -xarch=native -c gstlame.c -KPIC -DPIC -o .libs/libgstlame_la-gstlame.o "../../gst-libs/gst/gettext.h", line 45: warning: macro redefined: gettext "../../gst-libs/gst/gettext.h", line 46: warning: macro redefined: dgettext "../../gst-libs/gst/gettext.h", line 47: warning: macro redefined: dcgettext "../../gst-libs/gst/gettext.h", line 48: warning: macro redefined: ngettext "../../gst-libs/gst/gettext.h", line 50: warning: macro redefined: dngettext "../../gst-libs/gst/gettext.h", line 52: warning: macro redefined: dcngettext "../../gst-libs/gst/gettext.h", line 54: warning: macro redefined: textdomain "../../gst-libs/gst/gettext.h", line 55: warning: macro redefined: bindtextdomain "../../gst-libs/gst/gettext.h", line 56: warning: macro redefined: bind_textdomain_codeset "gstlame.c", line 581: warning: assignment type mismatch: pointer to char "=" pointer to function(pointer to const char, ...) returning pointer to char "gstlame.c", line 581: syntax error before or at: 0L "gstlame.c", line 584: cannot recover from previous errors cc: acomp failed for gstlame.c If I preprocess the file, I see that the macro expands to: setup_failed: { if ( 1 ) { gchar * __txt = _gst_element_error_printf ( ( ( const char * ) ( "Failed to configure LAME encoder. Check your encoding parameters." ) ) ) ; gchar * __dbg = _gst_element_error_printf 0L ; if ( __txt ) if ( 1 ) { if ( ( GST_LEVEL_WARNING <= __gst_debug_min ) ) { gst_debug_log ( ( debug ) , ( GST_LEVEL_WARNING ) , "gstlame.c" , __func__ , 581 , ( GObject * ) ( lame ) , "error: %s" , __txt ) ; } } else ( void ) 0 ; if ( __dbg ) if ( 1 ) { if ( ( GST_LEVEL_WARNING <= __gst_debug_min ) ) { gst_debug_log ( ( debug ) , ( GST_LEVEL_WARNING ) , "gstlame.c" , __func__ , 581 , ( GObject * ) ( lame ) , "error: %s" , __dbg ) ; } } else ( void ) 0 ; gst_element_message_full ( ( ( ( ( GstElement * ) g_type_check_instance_cast ( ( GTypeInstance * ) ( ( lame ) ) , ( ( gst_element_get_type ( ) ) ) ) ) ) ) , GST_MESSAGE_ERROR , gst_library_error_quark ( ) , GST_LIBRARY_ERROR_SETTINGS , __txt , __dbg , "gstlame.c" , __func__ , 581 ) ; } else ( void ) 0 ; # 582 return ( 0 ); } The problem is the 0L after the _gst_element_error_printf. Looking at the macro for zero_output_rate, above the one for setup_failed, I see that the NULL is in a different place in the argument list. If I move it to look more like that macro call, the compile proceeds. Not sure if that's the right fix, if it is, I can provide a patch.
Ouch, I guess you can tell a macro is really broken if even the creator of said macro can't use it properly :) Should be fixed in CVS now: 2008-02-22 Tim-Philipp Müller <tim at centricular dot net> * ext/lame/gstlame.c: (gst_lame_sink_setcaps): Fix broken GST_ELEMENT_ERROR macro, fixes compile with the Sun Workshop 12 compiler, but probably also crashes (#517985). This is the change: http://webcvs.freedesktop.org/gstreamer/gst-plugins-ugly/ext/lame/gstlame.c?r1=1.114&r2=1.115 I have no idea what causes those gettext warnings though. Any chance you could have a look at that? (Maybe using #include <foo.h> helps? Although it shouldn't really make a difference, I think)
I have verified that your patch fixes the issue. The warnings are happening because I'm running configure with the --disable-nls option. The gst-libs/gst/gettext.h (there's a newer version of that header, BTW) code is redefining gettext, dcgettext, etc. It's really a problem with the gettext.h header and the order stuff gets included in, but it only shows up when you configure with --disable.nls.