[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: make error



On Fri, 2007-12-07 at 13:13 -0500, krow14 wrote:
> Hey guys
> 
> This is the error I've been getting trying to make tuxnes that I 
> mentioned briefly last night.
> 
> [root@localhost tuxnes-0.75]# ./configure
> loading cache ./config.cache
> checking for a BSD compatible install... (cached) /usr/bin/install -c
> checking whether build environment is sane... yes
> checking whether make sets ${MAKE}... (cached) yes
> checking for working aclocal... missing
> checking for working autoconf... missing
> checking for working automake... missing
> checking for working autoheader... missing
> checking for working makeinfo... missing
> checking host system type... i686-pc-linux-gnu
> checking for gcc... (cached) gcc
> checking whether the C compiler (gcc -O ) works... yes
> checking whether the C compiler (gcc -O ) is a cross-compiler... no
> checking whether we are using GNU C... (cached) yes
> checking whether gcc accepts -g... (cached) yes
> checking for a BSD compatible install... /usr/bin/install -c
> checking how to run the C preprocessor... (cached) gcc -E
> checking for X... (cached) no
> checking for dirent.h that defines DIR... (cached) yes
> checking for opendir in -ldir... (cached) no
> checking for ANSI C header files... (cached) yes
> checking for features.h... (cached) yes
> checking for fcntl.h... (cached) yes
> checking for strings.h... (cached) yes
> checking for sys/time.h... (cached) yes
> checking for linux/joystick.h... (cached) yes
> checking for linux/soundcard.h... (cached) yes
> checking for sys/soundcard.h... (cached) yes
> checking for ppm.h... (cached) no
> checking for snss.h... (cached) no
> checking for gzgetc in -lz... (cached) yes
> checking for pbm_writepbm in -lpbm... (cached) no
> checking for pgm_writepgm in -lpgm... (cached) no
> checking for ppm_writeppm in -lppm... (cached) no
> checking for sin in -lm... (cached) yes
> checking for openSnssFile in -lsnss... (cached) no
> checking for ggi/gii.h... (cached) no
> checking for ggi/ggi.h... (cached) no
> checking for ggiInit in -lggi... (cached) no
> checking for giiInit in -lgii... (cached) no
> checking for Wlib.h... (cached) no
> checking for w_init in -lW... (cached) no
> checking whether byte ordering is bigendian... (cached) no
> checking for working const... (cached) yes
> checking for inline... (cached) inline
> checking whether time.h and sys/time.h may both be included... (cached) yes
> checking for size_t... (cached) yes
> checking for 8-bit clean memcmp... (cached) yes
> checking for unistd.h... (cached) yes
> checking for getpagesize... (cached) yes
> checking for working mmap... (cached) yes
> checking return type of signal handlers... (cached) void
> checking for gettimeofday... (cached) yes
> checking for strtod... (cached) yes
> checking for strtoul... (cached) yes
> creating ./config.status
> creating Makefile
> creating config.h
> config.h is unchanged
> [root@localhost tuxnes-0.75]# make
> gcc -DHAVE_CONFIG_H -I. -I. -I. -O -pipe -Wall -D__USE_BSD -c emu.c
> emu.c: In function ‘loadpal’:
> emu.c:893: error: expected ‘)’ before string constant
> emu.c:915: error: expected ‘)’ before string constant
> emu.c:927: error: expected ‘)’ before string constant
> emu.c: In function ‘main’:
> emu.c:1605: error: expected ‘)’ before string constant
> make: *** [emu.o] Error 1
> 
> Any one know what is wrong? Is it something I can fix?
> 
> Krow14

Yay for using compiler-specific extensions to a language without staying
up-to-date with the compiler semantics.  The functions that are causing
problems are of the form:

          perror (__FUNCTION__ "string");

For those that don't know, __FUNCTION__ is an extension to C(++)
specific to gcc (and some other gcc-compatible compilers...) that is
replaced with the current function name.  Originally, __FUNCTION__ was
replaced by the compiler (not the pre-processor) with a string literal
representation of the function.  This allowed easy concatenation with
other strings.  However, with the addition of C99 support to gcc, and
the new standard __func__ (a variable, not a string literal),
concatenation is no longer possible.
See
http://gcc.gnu.org/onlinedocs/gcc-4.2.2/gcc/Function-Names.html#Function-Names for more details.

Attached is a simple patch to fix the problem.  In the directory, run 

$ patch -p1 < tuxnes.patch

and you should be able to build tuxnes.

--- tuxnes-0.75/emu.c	2001-04-11 17:45:47.000000000 -0400
+++ tuxnes-0.75.mtu/emu.c	2007-12-07 14:42:44.000000000 -0500
@@ -890,7 +890,7 @@
       len = strlen(palfile) + 1;
       if (! (buffer = malloc(len)))
 	{
-	  perror (__FUNCTION__ ": malloc");
+	  perror ("loadpal: malloc");
 	  return;
 	}
       memcpy (buffer, palfile, len);
@@ -912,7 +912,7 @@
       len = strlen(filename) + 1;
       if (! (buffer = malloc(len)))
 	{
-	  perror (__FUNCTION__ ": malloc");
+	  perror ("loadpal: malloc");
 	  return;
 	}
       memcpy (buffer, filename, len);
@@ -924,7 +924,7 @@
 	return;
       if (!(palfile = malloc ((len = strlen (filename)) + 11)))
         {
-          perror (__FUNCTION__ ": malloc");
+          perror ("loadpal: malloc");
           return;
         }
       strcpy (palfile, filename);
@@ -1602,7 +1602,7 @@
 
     if (! (basefilename = malloc(baseend - basestart + 1)))
       {
-        perror (__FUNCTION__ ": malloc");
+        perror ( "main: malloc");
         exit (1);
       }