Control: tags -1 patch

Hello,

so, I had a look through this build error. When you look at the gcc
invocation, you will see a "-Dconst=" in it. This causes all appearances
of "const" to be replaced with nothing - leading to the original error.

The reason why configure sets this macro is to be found in config.log:

> configure:4233: checking for an ANSI C-conforming const
> configure:4297: x86_64-linux-gnu-gcc -c -Wall -g -O2 -DSEPARATOR="'/'" -Wall 
> -Werror -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT  conftest.c >&5
> configure: In function 'main':
> configure:4267:17: error: unused variable 's' [-Werror=unused-variable]
>    }
>                  ^
> configure:4287:15: error: unused variable 'foo' [-Werror=unused-variable]
>    (exit $ac_status); } &&
>                ^
> configure:4254:29: error: unused variable 'zero' [-Werror=unused-variable]
>      char const *s = 0 ? (char *) 0 : (char const *) 0;
>                              ^
> configure:4248:17: error: unused variable 'x' [-Werror=unused-variable]
>    /* HPUX 7.0 cc rejects these. */
>                  ^
> cc1: all warnings being treated as errors


The autoconf version that was used to generate the configure script is
old and together with the use of -Werror leads to the conftest error,
which in turn leads to the wrongly set "-Dconst=". Running autoconf in
the configure target fixes that error.

But that leads to a different failure:

> source='scripting.c' object='scripting.o' libtool=no \
>         depfile='.deps/scripting.Po' tmpdepfile='.deps/scripting.TPo' \
>         depmode=gcc3 /bin/bash ../../depcomp \
>         x86_64-linux-gnu-gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" 
> -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" 
> -DPACKAGE_URL=\"\" -DPACKAGE=\"gltron\" -DVERSION=\"0.70\" -DHAVE_LIBGL=1 
> -DHAVE_LIBZ=1 -DHAVE_
> scripting.c:171:6: error: conflicting types for ‘scripting_RunFile’
>  void scripting_RunFile(char *name) {
>       ^
> In file included from scripting.c:1:0:
> ../../nebu/include/scripting/nebu_scripting.h:21:13: note: previous 
> declaration of ‘scripting_RunFile’ was here
>  extern void scripting_RunFile(const char *name);
>              ^
> scripting.c:175:6: error: conflicting types for ‘scripting_Run’
>  void scripting_Run(char *command) {
>       ^
> In file included from scripting.c:1:0:
> ../../nebu/include/scripting/nebu_scripting.h:22:13: note: previous 
> declaration of ‘scripting_Run’ was here
>  extern void scripting_Run(const char *command);
>              ^
> scripting.c:180:6: error: conflicting types for ‘scripting_RunFormat’
>  void scripting_RunFormat(char *format, ... ) {
>       ^
> In file included from scripting.c:1:0:
> ../../nebu/include/scripting/nebu_scripting.h:23:13: note: previous 
> declaration of ‘scripting_RunFormat’ was here
>  extern void scripting_RunFormat(const char *format, ...);
>              ^
> make[3]: *** [scripting.o] Error 1

That is easy enough to fix, just match the function calls to the prototypes.

After fixing that, the build succeeds. I'm attaching a build log and a
debdiff with my changes.

Sorry for the wall of text.

Have a nice day ;-)
diff -Nru gltron-0.70final/debian/changelog gltron-0.70final/debian/changelog
--- gltron-0.70final/debian/changelog   2011-12-15 21:45:04.000000000 +0000
+++ gltron-0.70final/debian/changelog   2013-08-11 14:07:02.000000000 +0000
@@ -1,3 +1,11 @@
+gltron (0.70final-11) UNRELEASED; urgency=low
+
+  * Run autoconf to fix build with newer GCC versions. (Closes: #701289)
+  * debian/patches/fix-prototypes.patch: Match function calls with the 
prototype
+    declarations.
+
+ -- Andreas Moog <am...@ubuntu.com>  Sun, 11 Aug 2013 13:59:59 +0000
+
 gltron (0.70final-10) unstable; urgency=low
 
   [ Ari Pollak ]
diff -Nru gltron-0.70final/debian/patches/fix-prototypes.patch 
gltron-0.70final/debian/patches/fix-prototypes.patch
--- gltron-0.70final/debian/patches/fix-prototypes.patch        1970-01-01 
00:00:00.000000000 +0000
+++ gltron-0.70final/debian/patches/fix-prototypes.patch        2013-08-11 
13:26:34.000000000 +0000
@@ -0,0 +1,41 @@
+Description: The parameters for some prototypes are defined as const so the 
functions 
+ should use that too.
+Author: Andreas Moog <am...@ubuntu.com>
+
+Index: gltron/nebu/scripting/scripting.c
+===================================================================
+--- gltron.orig/nebu/scripting/scripting.c     2013-08-11 13:26:14.895792715 
+0000
++++ gltron/nebu/scripting/scripting.c  2013-08-11 13:26:14.887792716 +0000
+@@ -168,16 +168,16 @@
+   return status;
+ }    
+ 
+-void scripting_RunFile(char *name) {
++void scripting_RunFile(const char *name) {
+   lua_dofile(L, name);
+ }
+ 
+-void scripting_Run(char *command) {
++void scripting_Run(const char *command) {
+   /* fprintf(stderr, "[command] %s\n", command); */
+   lua_dostring(L, command);
+ }
+ 
+-void scripting_RunFormat(char *format, ... ) {
++void scripting_RunFormat(const char *format, ... ) {
+   char buf[4096];
+   va_list ap;
+   va_start(ap, format);
+Index: gltron/src/gltron.c
+===================================================================
+--- gltron.orig/src/gltron.c   2013-08-11 13:26:11.543792589 +0000
++++ gltron/src/gltron.c        2013-08-11 13:26:29.863793144 +0000
+@@ -9,7 +9,7 @@
+ #include "base/util.h"
+ #include "SDL.h"
+ 
+-int main(int argc, char *argv[] ) {
++int main(int argc, const char *argv[] ) {
+       initSubsystems(argc, argv);
+       runScript(PATH_SCRIPTS, "main.lua");
+   return 0;
diff -Nru gltron-0.70final/debian/patches/series 
gltron-0.70final/debian/patches/series
--- gltron-0.70final/debian/patches/series      2011-12-15 21:39:57.000000000 
+0000
+++ gltron-0.70final/debian/patches/series      2013-08-11 14:05:59.000000000 
+0000
@@ -5,3 +5,4 @@
 disable-screenmenu.patch
 gcc30.patch
 gcc-4.6.patch
+fix-prototypes.patch
diff -Nru gltron-0.70final/debian/rules gltron-0.70final/debian/rules
--- gltron-0.70final/debian/rules       2010-04-06 21:55:35.000000000 +0000
+++ gltron-0.70final/debian/rules       2013-08-11 14:01:54.000000000 +0000
@@ -24,7 +24,7 @@
 
 config.status: configure
        dh_testdir
-
+       autoconf
        cp -f /usr/share/misc/config.sub config.sub
        cp -f /usr/share/misc/config.guess config.guess
 
@@ -53,7 +53,6 @@
        [ ! -f Makefile ] || $(MAKE) distclean
 
        rm -f config.sub config.guess
-
        dh_clean
 
 

Attachment: gltron_0.70final-11_amd64.build.gz
Description: GNU Zip compressed data

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to