LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Glib compile error (http://www.linuxquestions.org/questions/linux-software-2/glib-compile-error-490473/)

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:

Code:

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:

Code:

g_warning (G_GNUC_PRETTY_FUNCTION
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........

From: http://isoredirect.centos.org/centos...6/RedHat/RPMS/

Code:

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
 
intramaweb,

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:
Code:

g_warning (G_GNUC_PRETTY_FUNCTION
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:
Code:

g_warning (G_GNUC_PRETTY_FUNCTION,
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
http://www.linuxfromscratch.org/patc...-gcc34-1.patch
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
#define G_GNUC_PRETTY_FUNCTION

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,

- g_warning (G_GNUC_PRETTY_FUNCTION
- "(): 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


All times are GMT -5. The time now is 06:05 AM.