-   Linux - Software (
-   -   Glib compile error (

intramaweb 10-07-2006 09:24 PM

Glib compile error
I'm tring to install glib 1.2.10 but when I try and compile the source, I get the following error:


gcc -DHAVE_CONFIG_H -I. -I. -I. -DG_LOG_DOMAIN=g_log_domain_glib -g -O2 -Wall -D_REENTRANT -c gstrfuncs.c  -fPIC -DPIC -o .libs/gstrfuncs.lo
gstrfuncs.c: In function `g_printf_string_upper_bound':
gstrfuncs.c:870: error: syntax error before string constant
gstrfuncs.c:1037: error: syntax error before string constant
gstrfuncs.c:1080: error: syntax error before string constant
gstrfuncs.c:1111: error: syntax error before string constant
make[2]: *** [gstrfuncs.lo] Error 1
make[2]: Leaving directory `/home/user/Desktop/glib-1.2.10'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/user/Desktop/glib-1.2.10'
make: *** [all-recursive-am] Error 2

Looking inside gstrfuncs.c, the lines reporting errors are all the same:


The code above is all there is on each line so I don't understand how there can be a syntax error. Different things are passed to the function in each function call but not on the same line. (The function call ends on the line below with the closed bracket in its proper place.)

It's been a while since I went to C lessons and I think I only got up to the if statement so perhaps unsurprisingly my debugging attempts haven't resulted in much success. I'm stumped so any bright ideas will be very welcome!

Lenard 10-08-2006 09:24 PM

Why are you attempting to do this???? You have no real reason to........



glib-1.2.10-11.1.i386.rpm                              15-Mar-2004 22:45  128K
glib-devel-1.2.10-11.1.i386.rpm                        15-Mar-2004 22:45  111K

caspervn 10-08-2006 09:59 PM

intramaweb: what's your gcc version ?
Did you try older gcc ? May be gcc-2.95.3 is good (at least)

limeric22 01-16-2007 10:16 PM

Solution if needed still

I'm new to this forum and Linux for that matter. I thought I'd give some help since I have figured it out. Locate all instances of this line of code in the file gstrfuncs.c:

There should be four according to your error:
870, 1037, 1080, 1111

Add a comma at the end of the line. So it should read:

This worked for me. I think there is a patch out there but why bother if you only have to add four commas.

You may have to "make distclean" before you try "./configure && make" again.

Hope this helps.
- limeric22

studioj 01-16-2007 11:57 PM

i think this old gcc3 patch will fix it
download this to outside the build directory
patch with the command
patch -Np1 -i ../glib-1.2.10-gcc34-1.patch

i think i would seriously pass on the adding a comma thing.
i think this is suposed to be fixed with line

bpringlemeir 04-19-2007 08:08 PM

The supplied patch is ok, but...
The supplied patch is ok, but the correct way would be like this,

- "(): unable to handle positional parameters (%%n$)");
+ g_warning ("%s(): unable to handle positional parameters (%%n$)", G_GNUC_PRETTY_FUNCTION);

Gcc version 3.3 and later changed the way "PRETTY_FUNCTION" behaves. Previously it was a string literal. Now it is a (const char *?) variable, so "string concatenation" doesn't work. This patch would work with any GCC and will display the function name on an error.

stees 09-28-2007 03:37 PM

thanks guys that patch worked perfect, i had originally found another place where someone explain the mess in the code and manually edited the function calls before, but i was rebuilding the package and didnt back it up so the patch saved me some time.

kewei 04-23-2008 08:12 AM

hanks guys that patch worked perfect

debguy 03-11-2015 03:06 PM

Note resolved above
#ifdef __GNUC__

is wrong because ?cywin? at gcc has been hacking incompatible changes that break past code that had worked - apparently needlessly

infact gcc's documents still say "__FUNCTION" works however

printf(__FUNCTION__"hello\n"); // FAILS

only thing to do is be specific: patch it to test all __FOO in question ...

i've been seeing in past allot of hacks like __bsd __linux. test what you need not a generalism - because if they can break it i think they will - i think they look for things to break


cd "$dir/"
[ ! -f glib.h.old ] && {
cp glib.h glib.h.old
cat << EOF | ed || true
r glib.h
#if defined(__GNUC__) && defined(__FUNCTION__) && defined(__PRETTY_FUNCTION__)
wq glib.h
cd "$pwd/

John VV 03-12-2015 05:22 PM


please start a new thread and not necro post to a thread that was last used in 2008

All times are GMT -5. The time now is 06:10 PM.