Bug#1066470: kxl: FTBFS: KXLsound.c:75:9: error: implicit declaration of function 'read'; did you mean 'fread'? [-Werror=implicit-function-declaration]

Guillem Jover guillem at debian.org
Fri May 3 18:37:10 BST 2024


Control: tag -1 patch

Hi!

On Wed, 2024-03-13 at 12:52:04 +0100, Lucas Nussbaum wrote:
> Source: kxl
> Version: 1.1.7-17
> Severity: serious
> Justification: FTBFS
> Tags: trixie sid ftbfs
> User: lucas at debian.org
> Usertags: ftbfs-20240313 ftbfs-trixie ftbfs-impfuncdef

> This is most likely caused by a change in dpkg 1.22.6, that enabled
> -Werror=implicit-function-declaration. For more information, see
> https://wiki.debian.org/qa.debian.org/FTBFS#A2024-03-13_-Werror.3Dimplicit-function-declaration
> 
> Relevant part (hopefully):
> >  gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"KXL\" -DVERSION=\"1.1.7\" -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FCNTL_H=1 -DHAVE_MALLOC_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_LINUX_JOYSTICK_H=1 -DHAVE_LINUX_SOUNDCARD_H=1 -DTIME_WITH_SYS_TIME=1 -DRETSIGTYPE=void -DHAVE_SELECT=1 -I. -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c KXLjoystick.c  -fPIC -DPIC -o .libs/KXLjoystick.o
> > KXLmisc.c: In function 'KXL_ReadU16':
> > KXLmisc.c:196:3: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result]
> >   196 |   fread(c, 1, 2, fp);
> >       |   ^~~~~~~~~~~~~~~~~~
> > KXLmisc.c: In function 'KXL_ReadU32':
> > KXLmisc.c:209:3: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result]
> >   209 |   fread(c, 1, 4, fp);
> >       |   ^~~~~~~~~~~~~~~~~~
> > KXLsound.c: In function 'KXL_SoundServer':
> > KXLsound.c:75:9: error: implicit declaration of function 'read'; did you mean 'fread'? [-Werror=implicit-function-declaration]
> >    75 |     if (read(KXL_SoundData.Pipe[0], &Command,sizeof(Command)) != sizeof(Command))
> >       |         ^~~~
> >       |         fread
> > KXLsound.c:165:9: error: implicit declaration of function 'write'; did you mean 'fwrite'? [-Werror=implicit-function-declaration]
> >   165 |         write(KXL_SoundData.Device, KXL_SoundData.PBuff, fragment_size);
> >       |         ^~~~~
> >       |         fwrite
> > KXLimage.c: In function 'KXL_ReadBitmapHeader':
> > KXLimage.c:112:3: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result]
> >   112 |   fread(hed->magic, 1, 2, fp);
> >       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > KXLimage.c:166:7: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result]
> >   166 |       fread(&(hed->data[i * hed->w]), hed->w, 1, fp);
> >       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > KXLsound.c: In function 'KXL_InitSound':
> > KXLsound.c:262:7: error: implicit declaration of function 'pipe' [-Werror=implicit-function-declaration]
> >   262 |   if (pipe(KXL_SoundData.Pipe) < 0) {
> >       |       ^~~~
> > KXLsound.c:267:27: error: implicit declaration of function 'fork' [-Werror=implicit-function-declaration]
> >   267 |   if ((KXL_SoundData.ID = fork()) < 0) {
> >       |                           ^~~~
> > KXLsound.c:273:5: error: implicit declaration of function 'close'; did you mean 'pclose'? [-Werror=implicit-function-declaration]
> >   273 |     close(KXL_SoundData.Pipe[1]);
> >       |     ^~~~~
> >       |     pclose
> > KXLsound.c: In function 'KXL_LoadSound':
> > KXLsound.c:213:3: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result]
> >   213 |   fread(dummy, sizeof(Uint8), 40, file);
> >       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > KXLsound.c:216:3: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result]
> >   216 |   fread(new.Data, sizeof(Uint8), new.Length, file);
> >       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > KXLjoystick.c: In function 'KXL_CloseJoystick':
> > KXLjoystick.c:43:5: error: implicit declaration of function 'close'; did you mean 'pclose'? [-Werror=implicit-function-declaration]
> >    43 |     close(KXL_joydev);
> >       |     ^~~~~
> >       |     pclose
> > KXLjoystick.c: In function 'KXL_ReadJoystick':
> > KXLjoystick.c:55:9: error: implicit declaration of function 'read'; did you mean 'fread'? [-Werror=implicit-function-declaration]
> >    55 |     if (read(KXL_joydev, my, JS_RETURN) == JS_RETURN) {
> >       |         ^~~~
> >       |         fread
> >  gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"KXL\" -DVERSION=\"1.1.7\" -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FCNTL_H=1 -DHAVE_MALLOC_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_LINUX_JOYSTICK_H=1 -DHAVE_LINUX_SOUNDCARD_H=1 -DTIME_WITH_SYS_TIME=1 -DRETSIGTYPE=void -DHAVE_SELECT=1 -I. -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c KXLmisc.c -o KXLmisc.o >/dev/null 2>&1
> > cc1: some warnings being treated as errors
> > make[2]: *** [Makefile:281: KXLjoystick.lo] Error 1

The attached debdiff should fix this FTBFS.

Thanks,
Guillem
-------------- next part --------------
diff -Nru kxl-1.1.7/debian/patches/020_headers.diff kxl-1.1.7/debian/patches/020_headers.diff
--- kxl-1.1.7/debian/patches/020_headers.diff	2019-01-18 16:02:07.000000000 +0100
+++ kxl-1.1.7/debian/patches/020_headers.diff	2024-05-03 19:31:47.000000000 +0200
@@ -1,17 +1,26 @@
---- kxl-1.1.7.orig/src/KXLsound.c
-+++ kxl-1.1.7/src/KXLsound.c
-@@ -1,6 +1,9 @@
+---
+ src/KXL.h         |    2 ++
+ src/KXLimage.c    |    1 +
+ src/KXLjoystick.c |    1 +
+ src/KXLsound.c    |    4 ++++
+ src/KXLvisual.c   |    2 ++
+ 5 files changed, 10 insertions(+)
+
+--- a/src/KXLsound.c
++++ b/src/KXLsound.c
+@@ -1,6 +1,10 @@
  #include <stdio.h>
 +#include <stdlib.h>
  #include <signal.h>
  #include <fcntl.h>
 +#include <errno.h>
 +#include <string.h>
++#include <unistd.h>
  #include <sys/ioctl.h>
  #include <sys/time.h>
  #include <linux/soundcard.h>
---- kxl-1.1.7.orig/src/KXLvisual.c
-+++ kxl-1.1.7/src/KXLvisual.c
+--- a/src/KXLvisual.c
++++ b/src/KXLvisual.c
 @@ -1,4 +1,6 @@
  #include <stdio.h>
 +#include <stdlib.h>
@@ -19,16 +28,16 @@
  #include "KXL.h"
  
  //================================================================
---- kxl-1.1.7.orig/src/KXLimage.c
-+++ kxl-1.1.7/src/KXLimage.c
+--- a/src/KXLimage.c
++++ b/src/KXLimage.c
 @@ -1,4 +1,5 @@
  #include <stdio.h>
 +#include <stdlib.h>
  #include "KXL.h"
  
  extern KXL_Window *KXL_Root;
---- kxl-1.1.7.orig/src/KXL.h
-+++ kxl-1.1.7/src/KXL.h
+--- a/src/KXL.h
++++ b/src/KXL.h
 @@ -2,8 +2,10 @@
  #define _KXLIB_H_
  
@@ -40,3 +49,11 @@
  #include <linux/joystick.h>
  
  
+--- a/src/KXLjoystick.c
++++ b/src/KXLjoystick.c
+@@ -1,4 +1,5 @@
+ #include <stdio.h>
++#include <unistd.h>
+ #include <sys/ioctl.h>
+ #include <fcntl.h>
+ #include "KXL.h"
diff -Nru kxl-1.1.7/debian/patches/40_nonlinux.diff kxl-1.1.7/debian/patches/40_nonlinux.diff
--- kxl-1.1.7/debian/patches/40_nonlinux.diff	2019-01-18 16:02:07.000000000 +0100
+++ kxl-1.1.7/debian/patches/40_nonlinux.diff	2024-05-03 19:32:22.000000000 +0200
@@ -1,7 +1,13 @@
---- a/src/KXLsound.c.orig	2011-08-19 00:57:45.000000000 +0000
-+++ a/src/KXLsound.c	2011-08-19 00:57:47.000000000 +0000
-@@ -6,7 +6,7 @@
- #include <string.h>
+---
+ src/KXL.h         |    2 ++
+ src/KXLjoystick.c |    6 ++++++
+ src/KXLsound.c    |    2 +-
+ 3 files changed, 9 insertions(+), 1 deletion(-)
+
+--- a/src/KXLsound.c
++++ b/src/KXLsound.c
+@@ -7,7 +7,7 @@
+ #include <unistd.h>
  #include <sys/ioctl.h>
  #include <sys/time.h>
 -#include <linux/soundcard.h>
@@ -9,8 +15,8 @@
  #include "KXL.h"
  
  #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
---- a/src/KXL.h.orig	2011-08-19 00:58:51.000000000 +0000
-+++ a/src/KXL.h	2011-08-19 00:58:52.000000000 +0000
+--- a/src/KXL.h
++++ b/src/KXL.h
 @@ -6,7 +6,9 @@
  #include <X11/Xlib.h>
  #include <X11/Xutil.h>
@@ -21,9 +27,9 @@
  
  
  //================================================================
---- a/src/KXLjoystick.c.orig	2011-08-19 00:59:41.000000000 +0000
-+++ a/src/KXLjoystick.c	2011-08-19 01:00:00.000000000 +0000
-@@ -16,6 +16,7 @@
+--- a/src/KXLjoystick.c
++++ b/src/KXLjoystick.c
+@@ -17,6 +17,7 @@ Bool KXL_OpenJoystick(Uint8 *devname) {
    Uint8  axis = 2;
    Uint8  buttons = 2;
  
@@ -31,7 +37,7 @@
    KXL_joydev = open(devname, O_RDONLY);
    if (KXL_joydev < 0) {
      fprintf(stderr, "KXL error message\nCannot open \"%s\".\n", devname);
-@@ -29,6 +30,9 @@
+@@ -30,6 +31,9 @@ Bool KXL_OpenJoystick(Uint8 *devname) {
    fprintf(stderr, "KXL message\nJoystick (%s) has %d axes and %d buttons.\nDriver version is %d.%d.%d.\n",
  	  name, axis, buttons, version >> 16, (version >> 8) & 0xff, version & 0xff);
    return True;
@@ -41,7 +47,7 @@
  }
  
  //==============================================================
-@@ -46,11 +50,13 @@
+@@ -47,11 +51,13 @@ void KXL_CloseJoystick(void) {
  //  return value : True - ok, False - NG
  //==============================================================
  Bool KXL_ReadJoystick(KXL_Joystick *my) {
diff -Nru kxl-1.1.7/debian/patches/series kxl-1.1.7/debian/patches/series
--- kxl-1.1.7/debian/patches/series	2019-01-18 16:02:07.000000000 +0100
+++ kxl-1.1.7/debian/patches/series	2024-05-03 19:31:47.000000000 +0200
@@ -3,7 +3,7 @@
 020_64bits.diff -p1
 020_alsa.diff -p1
 020_autorepeat.diff -p1
-020_headers.diff -p1
+020_headers.diff
 020_badfont.diff
 030_underquoted_definition.diff
 40_nonlinux.diff


More information about the Pkg-games-devel mailing list