HPLIP 3.15.4: hp_ipp.c needs '#define _GNU_SOURCE'

Bug #1456590 reported by Johannes Meixner
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
HPLIP
New
Undecided
Unassigned

Bug Description

At least on openSUSE I need this patch to build HPLIP 3.15.4:

##############################################################
--- protocol/hp_ipp.c.orig 2015-04-14 11:53:09.000000000 +0200
+++ protocol/hp_ipp.c 2015-05-19 13:12:47.000000000 +0200
@@ -18,6 +18,9 @@ Boston, MA 02110-1301, USA.

 \******************************************************************************/

+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif

 #include <cups/cups.h>
 #include <cups/language.h>

##############################################################

Without it there are various issues, primarily compiler warnings about strcasestr
that lead to SUSE build errors because strcasestr needs '#define _GNU_SOURCE'
in addition to '#include <string.h>' - see "man strcasestr":

##############################################################

       #define _GNU_SOURCE

       #include <string.h>

       char *strcasestr(const char *haystack, const char *needle);

##############################################################

Revision history for this message
Johannes Meixner (jsmeix) wrote :

FYI:

There are some more missing '#include <...>'
because I get those compiler warnings:

prnt/cupsext/cupsext.c:108:5: warning:
implicit declaration of function '_releaseCupsInstance'

prnt/cupsext/cupsext.c:390:5: warning:
implicit declaration of function 'addCupsPrinter'

prnt/cupsext/cupsext.c:414:5: warning:
implicit declaration of function 'delCupsPrinter'

prnt/cupsext/cupsext.c:440:5: warning:
implicit declaration of function 'setDefaultCupsPrinter'

prnt/cupsext/cupsext.c:461:5: warning:
implicit declaration of function 'controlCupsPrinter'

io/hpmud/jd.c:77:7: warning:
implicit declaration of function 'strtol'

scan/sane/hpaio.c:336:5: warning:
implicit declaration of function 'InitDbus'

scan/sane/bb_ledm.c:1008:6: warning:
implicit declaration of function 'usleep'

scan/sane/sclpml.c:435:13: warning:
implicit declaration of function 'gettimeofday'

scan/sane/sclpml.c:1887:5: warning:
implicit declaration of function 'strcasestr'

The follwing patch fixes them - except those in prnt/cupsext/cupsext.c which
I leave for you HPLIP authors at upstream because I won't try to guess what
your preferred way is how to fix it (add them to protocol/hp_ipp.h or
protocol/hp_ipp_i.h or something else...?)

##############################################################################
--- protocol/hp_ipp.c.orig 2015-04-14 11:53:09.000000000 +0200
+++ protocol/hp_ipp.c 2015-05-19 13:12:47.000000000 +0200
@@ -18,6 +18,9 @@ Boston, MA 02110-1301, USA.

 \******************************************************************************/

+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif

 #include <cups/cups.h>
 #include <cups/language.h>
--- scan/sane/sclpml.c.orig 2015-04-14 11:53:17.000000000 +0200
+++ scan/sane/sclpml.c 2015-05-19 13:45:44.000000000 +0200
@@ -25,11 +25,16 @@

 \************************************************************************************/

+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <string.h>
+#include <sys/time.h>
 #include "sane.h"
 #include "saneopts.h"
 #include "common.h"
--- scan/sane/bb_ledm.c.orig 2015-05-19 13:47:53.000000000 +0200
+++ scan/sane/bb_ledm.c 2015-05-19 13:48:42.000000000 +0200
@@ -26,7 +26,7 @@
 # include "http.h"
 # include "xml.h"
 # include <stdlib.h>
-
+# include <unistd.h>
 # include <stdint.h>

 # define _STRINGIZE(x) #x
--- scan/sane/hpaio.c.orig 2015-04-14 11:53:17.000000000 +0200
+++ scan/sane/hpaio.c 2015-05-19 13:51:21.000000000 +0200
@@ -43,6 +43,7 @@
 #include "hpaio.h"
 # include "ledm.h"
 #include "sclpml.h"
+#include "io.h"

 #define DEBUG_DECLARE_ONLY
 #include "sanei_debug.h"
--- io/hpmud/jd.c.orig 2015-05-19 13:46:39.000000000 +0200
+++ io/hpmud/jd.c 2015-05-19 13:47:01.000000000 +0200
@@ -31,6 +31,7 @@
 #endif

 #include <signal.h>
+#include <stdlib.h>
 #include "hpmud.h"
 #include "hpmudi.h"

##############################################################################

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.