Re: printing

"Richard" ([email protected] via blfs-support Mailing List) <[email protected]> Fri, 16 Jan 2026 14:21:08 -0500
Newsgroups gmane.linux.lfs.beyond.support
Message-ID <[email protected]>
On 1/16/26 11:59 AM, Bruce Dubbs ([email protected] via blfs-support 
Mailing List) wrote:
> On 1/16/26 9:02 AM, Richard ([email protected] via blfs-support Mailing 
> List) wrote:
>> On 1/15/26 10:52 AM, Bruce Dubbs ([email protected] via 
>> blfs-support Mailing 
>
> [snip]
>
>>>> I am the one who is missing something, I have never made
>>>> a patch before so I would have some learning to do. It was
>>>> just easier for me to copy the files.
>
>>> Just put the original expanded tarball into a directory, say 
>>> /tmp/hplip.orig, and copy that to /tmp/hplip.new.  Then copy the 
>>> modified files to /tmp/hplip.new.
>>>
>>> Make a patch file with:
>>>
>>> cd /tmp
>>> diff -Naur /tmp/hplip.orig /tmp/hplip.new > hplip-3.??.??.patch
>
>> Thanks for your help!
>>
>> I've made a patch that I tested, and I also have written up
>> a hint for my hplip fix. How can I submit the hint and
>> the patch? From the documentation on linuxfromscratch.org
>> it sounds like I am supposed to submit them first to a mailing
>> list.
>
> Just reply to this email and attach the hint.
>
>   -- Bruce
>
>

Here they are.

Richard

-- 
http://lists.linuxfromscratch.org/sympa/info/blfs-support
Unsubscribe: See the above information page
hplip-3.25.8_fix.patch (text/x-patch, 12.6 KB)
diff -Naur hplip-3.25.8.orig/io/hpmud/musb.c hplip-3.25.8.modified/io/hpmud/musb.c
--- hplip-3.25.8.orig/io/hpmud/musb.c	2026-01-16 08:22:56.465594662 -0500
+++ hplip-3.25.8.modified/io/hpmud/musb.c	2026-01-16 08:23:26.454146741 -0500
@@ -31,6 +31,11 @@
 #include <stdlib.h>
 #include "utils.h"
 
+/* rkm mods */
+/* for gettimeofday: */
+#include </usr/include/sys/time.h>
+/* end rkm mods */
+
 
 mud_device_vf __attribute__ ((visibility ("hidden"))) musb_mud_device_vf =
 {
diff -Naur hplip-3.25.8.orig/io/hpmud/musb_libusb01.c hplip-3.25.8.modified/io/hpmud/musb_libusb01.c
--- hplip-3.25.8.orig/io/hpmud/musb_libusb01.c	2026-01-16 08:22:56.465460390 -0500
+++ hplip-3.25.8.modified/io/hpmud/musb_libusb01.c	2026-01-16 08:23:26.451576311 -0500
@@ -30,6 +30,11 @@
 #include <dlfcn.h>
 #include "utils.h"
 
+/* rkm mods */
+/* for gettimeofday: */
+#include </usr/include/sys/time.h>
+/* end rkm mods */
+
 mud_device_vf __attribute__ ((visibility ("hidden"))) musb_mud_device_vf =
 {
     .read = musb_read,
diff -Naur hplip-3.25.8.orig/io/hpmud/pp.c hplip-3.25.8.modified/io/hpmud/pp.c
--- hplip-3.25.8.orig/io/hpmud/pp.c	2026-01-16 08:22:56.465547078 -0500
+++ hplip-3.25.8.modified/io/hpmud/pp.c	2026-01-16 08:23:26.456719991 -0500
@@ -29,6 +29,11 @@
 #include "hpmud.h"
 #include "hpmudi.h"
 
+/* rkm mods */
+/* for gettimeofday: */
+#include </usr/include/sys/time.h>
+/* end rkm mods */
+
 mud_device_vf __attribute__ ((visibility ("hidden"))) pp_mud_device_vf = 
 {
    .read = pp_read,
diff -Naur hplip-3.25.8.orig/pcard/pcardext/pcardext.c hplip-3.25.8.modified/pcard/pcardext/pcardext.c
--- hplip-3.25.8.orig/pcard/pcardext/pcardext.c	2026-01-16 08:22:56.479086361 -0500
+++ hplip-3.25.8.modified/pcard/pcardext/pcardext.c	2026-01-16 08:23:26.466812939 -0500
@@ -39,6 +39,13 @@
 #define PY_SSIZE_T_MIN INT_MIN
 #endif
 
+/* rkm mods */
+void PyString_AsStringAndSize(PyObject * result,char** rkm_at_result_str,void* rkm_len);
+long int PyInt_AS_LONG(void* rkm_result);
+void* PyString_FromStringAndSize(char* rkm_buffer,int rkm_len);
+PyObject *  Py_InitModule4(void *rkm_message,PyMethodDef * rkm_pcardext_methods,void* rkm_pcardext_documentation,void* rkm_pointer,int rkm_PYTHON_API_VERSION);
+/* end rkm mods */
+
 int verbose=0;
 
 PyObject * readsectorFunc = NULL;
diff -Naur hplip-3.25.8.orig/prnt/cupsext/cupsext.c hplip-3.25.8.modified/prnt/cupsext/cupsext.c
--- hplip-3.25.8.orig/prnt/cupsext/cupsext.c	2026-01-16 08:22:56.434220435 -0500
+++ hplip-3.25.8.modified/prnt/cupsext/cupsext.c	2026-01-16 08:23:26.443687107 -0500
@@ -89,6 +89,14 @@
 #include "hp_ipp.h"
 #include "utils.h"
 
+/* rkm mods: */
+void _releaseCupsInstance();
+int addCupsPrinter(char *name, char *device_uri, char *location, char *ppd_file, char *model, char *info);
+int delCupsPrinter(char *pr_name);
+int setDefaultCupsPrinter(char *pr_name);
+int controlCupsPrinter(char *pr_name, int op);
+/* end rkm mods */
+
 /* Ref: PEP 353 (Python 2.5) */
 #if PY_VERSION_HEX < 0x02050000
 typedef int Py_ssize_t;
diff -Naur hplip-3.25.8.orig/prnt/hpcups/HPCupsFilter.cpp hplip-3.25.8.modified/prnt/hpcups/HPCupsFilter.cpp
--- hplip-3.25.8.orig/prnt/hpcups/HPCupsFilter.cpp	2026-01-16 08:22:56.438777534 -0500
+++ hplip-3.25.8.modified/prnt/hpcups/HPCupsFilter.cpp	2026-01-16 08:23:26.459082417 -0500
@@ -44,6 +44,11 @@
 
 #define HP_FILE_VERSION_STR    "03.09.08.0"
 
+/* rkm mods */
+/* for gettimeofday: */
+#include </usr/include/sys/time.h>
+/* end rkm mods */
+
 static HPCupsFilter    filter;
 
 
diff -Naur hplip-3.25.8.orig/prnt/hpps/pserror.c hplip-3.25.8.modified/prnt/hpps/pserror.c
--- hplip-3.25.8.orig/prnt/hpps/pserror.c	2026-01-16 08:22:56.455005509 -0500
+++ hplip-3.25.8.modified/prnt/hpps/pserror.c	2026-01-16 08:23:26.469125275 -0500
@@ -24,7 +24,10 @@
 void message(int flags, char *format, ...)
 {
   va_list args ;
-  static column = 0 ;		/* current screen column for message wrap */
+/* rkm mods */
+/*  static column = 0 ; */      /* current screen column for message wrap */
+  static int column = 0 ;       /* current screen column for message wrap */
+/* end rkm mods */
   char msgbuf[MAX_MESSAGE] ;	/* buffer in which to put the message */
   char *bufptr = msgbuf ;	/* message buffer pointer */
 
diff -Naur hplip-3.25.8.orig/scan/sane/bb_ledm.c hplip-3.25.8.modified/scan/sane/bb_ledm.c
--- hplip-3.25.8.orig/scan/sane/bb_ledm.c	2026-01-16 08:22:56.461110364 -0500
+++ hplip-3.25.8.modified/scan/sane/bb_ledm.c	2026-01-16 08:23:26.446281148 -0500
@@ -29,6 +29,10 @@
 
 # include <stdint.h>
 
+/* rkm mods: */
+# include <unistd.h>
+/* end rkm mods */
+
 # define _STRINGIZE(x) #x
 # define STRINGIZE(x) _STRINGIZE(x)
 
diff -Naur hplip-3.25.8.orig/scan/sane/hpaio.c hplip-3.25.8.modified/scan/sane/hpaio.c
--- hplip-3.25.8.orig/scan/sane/hpaio.c	2026-01-16 08:22:56.460929612 -0500
+++ hplip-3.25.8.modified/scan/sane/hpaio.c	2026-01-16 08:23:26.448971009 -0500
@@ -52,6 +52,21 @@
 #include "io.h"
 #include "orblitei.h"
 
+/* rkm mods: */
+# include "sane.h"
+SANE_Status orblite_init (SANE_Int * version_code, SANE_Auth_Callback authorize);
+SANE_Status orblite_get_devices (SANE_Device *** device_list, SANE_Bool local_only);
+void orblite_exit (void);
+SANE_Status orblite_open (SANE_String_Const devicename, SANE_Handle * handle);
+void orblite_close (SANE_Handle handle);
+const SANE_Option_Descriptor * orblite_get_option_descriptor (SANE_Handle handle, SANE_Int option );
+SANE_Status orblite_control_option (SANE_Handle handle, SANE_Int option, SANE_Action action, void *value, SANE_Int * info);
+SANE_Status orblite_get_parameters (SANE_Handle handle, SANE_Parameters * params);
+SANE_Status orblite_start (SANE_Handle handle);
+SANE_Status orblite_read (SANE_Handle handle, SANE_Byte * data, SANE_Int max_length, SANE_Int * length);
+void orblite_cancel (SANE_Handle handle);
+/* end rkm mods */
+
 
 #define DEBUG_DECLARE_ONLY
 #include "sanei_debug.h"
diff -Naur hplip-3.25.8.orig/scan/sane/http.c hplip-3.25.8.modified/scan/sane/http.c
--- hplip-3.25.8.orig/scan/sane/http.c	2026-01-16 08:22:56.461162788 -0500
+++ hplip-3.25.8.modified/scan/sane/http.c	2026-01-16 08:23:26.464401762 -0500
@@ -58,6 +58,11 @@
 
 #define EXCEPTION_TIMEOUT 45 /* seconds */
 
+/* rkm mods */
+/* for usleep: */
+#include <unistd.h>
+/* end rkm mods */
+
 enum HTTP_STATE
 {
    HS_ACTIVE = 1,
diff -Naur hplip-3.25.8.orig/scan/sane/ledmi.h hplip-3.25.8.modified/scan/sane/ledmi.h
--- hplip-3.25.8.orig/scan/sane/ledmi.h	2026-01-16 08:22:56.461035756 -0500
+++ hplip-3.25.8.modified/scan/sane/ledmi.h	2026-01-16 08:23:26.471584966 -0500
@@ -162,8 +162,10 @@
 int bb_open(struct ledm_session*);
 int bb_close(struct ledm_session*);
 int bb_get_parameters(struct ledm_session*, SANE_Parameters*, int);
-int bb_is_paper_in_adf();         /* 0 = no paper in adf, 1 = paper in adf, -1 = error */
+/* rkm mods: */
+int bb_is_paper_in_adf(struct ledm_session *ps);         /* 0 = no paper in adf, 1 = paper in adf, -1 = error */
 SANE_Status bb_start_scan(struct ledm_session*);
+/* end rkm mods */
 int bb_get_image_data(struct ledm_session*, int); 
 int bb_end_page(struct ledm_session*, int);
 int bb_end_scan(struct ledm_session* , int);
diff -Naur hplip-3.25.8.orig/scan/sane/orblite.c hplip-3.25.8.modified/scan/sane/orblite.c
--- hplip-3.25.8.orig/scan/sane/orblite.c	2026-01-16 08:22:56.461136201 -0500
+++ hplip-3.25.8.modified/scan/sane/orblite.c	2026-01-16 08:23:26.474019764 -0500
@@ -45,6 +45,12 @@
 
 static struct t_SANE *g_handle = NULL;
 
+/* rkm mods: */
+/* Replaced every instance of "SANE_Char**" with "void *" */
+void _DBG(void *rkm_message);
+void dlclose(void *rkm_p);
+/* end rkm mods */
+
 SANE_Option_Descriptor	DefaultOrbOptions[] = {
 	/* name, title, desc,
 	 * type, unit, size, cap,
@@ -63,28 +69,28 @@
 		SANE_NAME_SCAN_TL_X, SANE_TITLE_SCAN_TL_X, SANE_DESC_SCAN_TL_X,  // name, title, desc
 		SANE_TYPE_FIXED, SANE_UNIT_MM, sizeof(SANE_Fixed),// type, unit, size
 		SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT,      // cap(ability)
-		SANE_CONSTRAINT_RANGE, (SANE_Char**)&SANE_rangeLeft  // constraint_type, constraint
+		SANE_CONSTRAINT_RANGE, (void *)&SANE_rangeLeft  // constraint_type, constraint
 	},
 
 	{
 		SANE_NAME_SCAN_TL_Y, SANE_TITLE_SCAN_TL_Y, SANE_DESC_SCAN_TL_Y,  // name, title, desc
 		SANE_TYPE_FIXED, SANE_UNIT_MM, sizeof(SANE_Fixed),// type, unit, size
 		SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT,      // cap(ability)
-		SANE_CONSTRAINT_RANGE, (SANE_Char**)&SANE_rangeTop  // constraint_type, constraint
+		SANE_CONSTRAINT_RANGE, (void *)&SANE_rangeTop  // constraint_type, constraint
 	},
   
 	{
 		SANE_NAME_SCAN_BR_X, SANE_TITLE_SCAN_BR_X, SANE_DESC_SCAN_BR_X,  // name, title, desc
 		SANE_TYPE_FIXED, SANE_UNIT_MM, sizeof(SANE_Fixed),// type, unit, size
 		SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT,      // cap(ability)
-		SANE_CONSTRAINT_RANGE, (SANE_Char**)&SANE_rangeRight  // constraint_type, constraint
+		SANE_CONSTRAINT_RANGE, (void *)&SANE_rangeRight  // constraint_type, constraint
 	},
 
 	{
 		SANE_NAME_SCAN_BR_Y, SANE_TITLE_SCAN_BR_Y, SANE_DESC_SCAN_BR_Y,  // name, title, desc
 		SANE_TYPE_FIXED, SANE_UNIT_MM, sizeof(SANE_Fixed),// type, unit, size
 		SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT,      // cap(ability)
-		SANE_CONSTRAINT_RANGE, (SANE_Char**)&SANE_rangeBottom  // constraint_type, constraint
+		SANE_CONSTRAINT_RANGE, (void *)&SANE_rangeBottom  // constraint_type, constraint
 	},
    
 	// optResolution,                                       // resolution group  
@@ -92,7 +98,7 @@
 		SANE_NAME_SCAN_RESOLUTION, SANE_TITLE_SCAN_RESOLUTION, SANE_DESC_SCAN_RESOLUTION, // name, title, desc
 		SANE_TYPE_INT, SANE_UNIT_DPI, sizeof(SANE_Word),  // type, unit, size,
 		SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT,      // cap(ability)
-		SANE_CONSTRAINT_WORD_LIST, (SANE_Char**)SANE_resolutions // constraint type, constraint
+		SANE_CONSTRAINT_WORD_LIST, (void *)SANE_resolutions // constraint type, constraint
 	},
 
 	// optMode,                                            // color/depth group
@@ -100,7 +106,7 @@
 		SANE_NAME_SCAN_MODE, SANE_TITLE_SCAN_MODE, SANE_DESC_SCAN_MODE, // name, title, desc
 		SANE_TYPE_STRING, SANE_UNIT_NONE, 256,  // type, unit, size,
 		SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT,      // cap(ability)
-		SANE_CONSTRAINT_STRING_LIST, (SANE_Char**)SANE_modes   // constraint type, constraint
+		SANE_CONSTRAINT_STRING_LIST, (void *)SANE_modes   // constraint type, constraint
 	},
  
 	// optSource, 
@@ -108,7 +114,7 @@
 		SANE_NAME_SCAN_SOURCE, SANE_TITLE_SCAN_SOURCE, SANE_DESC_SCAN_SOURCE, // name, title, desc
 		SANE_TYPE_STRING, SANE_UNIT_NONE, 256,  // type, unit, size,
 		SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT,      // cap(ability)
-		SANE_CONSTRAINT_STRING_LIST, (SANE_Char**)SANE_sources   // constraint type, constraint
+		SANE_CONSTRAINT_STRING_LIST, (void *)SANE_sources   // constraint type, constraint
 	},
  
 	// optPaperSize, 
@@ -116,7 +122,7 @@
 		SANE_NAME_PAPER_SIZE, SANE_TITLE_PAPER_SIZE, SANE_DESC_PAPER_SIZE, // name, title, desc
 		SANE_TYPE_STRING, SANE_UNIT_NONE, 256,  // type, unit, size,
 		SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT,      // cap(ability)
-		SANE_CONSTRAINT_STRING_LIST, (SANE_Char**)SANE_paper_sizes   // constraint type, constraint
+		SANE_CONSTRAINT_STRING_LIST, (void *)SANE_paper_sizes   // constraint type, constraint
 	},
  
 	// optPaperSize, 
@@ -124,7 +130,7 @@
 		SANE_NAME_PAPER_SIZE, SANE_TITLE_PAPER_SIZE, SANE_DESC_PAPER_SIZE, // name, title, desc
 		SANE_TYPE_INT, SANE_UNIT_DPI, sizeof(SANE_Word),  // type, unit, size,
 		SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT,      // cap(ability)
-		SANE_CONSTRAINT_WORD_LIST, (SANE_Char**)SANE_resolutions // constraint type, constraint
+		SANE_CONSTRAINT_WORD_LIST, (void *)SANE_resolutions // constraint type, constraint
 	},
 #ifdef NOTDEF
 // default template
@@ -303,8 +309,10 @@
 	stat = g_handle->bb_orblite_get_devices(device_list, local_only);
 	if (stat != SANE_STATUS_GOOD)
 		return stat;
-
-	stat = g_handle->bb_orblite_open(devicename, &g_handle);
+/* rkm mods: */
+/*	stat = g_handle->bb_orblite_open(devicename, &g_handle); */
+	stat = g_handle->bb_orblite_open(devicename,handle);
+/* end rkm mods */
 	if (stat == SANE_STATUS_GOOD)
 		*handle = g_handle;
 
diff -Naur hplip-3.25.8.orig/scan/sane/sclpml.c hplip-3.25.8.modified/scan/sane/sclpml.c
--- hplip-3.25.8.orig/scan/sane/sclpml.c	2026-01-16 08:22:56.461592414 -0500
+++ hplip-3.25.8.modified/scan/sane/sclpml.c	2026-01-16 08:23:26.461783292 -0500
@@ -46,6 +46,11 @@
 #define DEBUG_DECLARE_ONLY
 #include "sanei_debug.h"
 
+/* rkm mods */
+/* for gettimeofday: */
+#include </usr/include/sys/time.h>
+/* end rkm mods */
+
 //# define  SCLPML_DEBUG
 # ifdef SCLPML_DEBUG
    # define _DBG(args...) syslog(LOG_INFO, __FILE__ " " STRINGIZE(__LINE__) ": " args)
hplip-3.25.8_fix.txt (text/plain, 4.3 KB)
AUTHOR: Richard Mains <[email protected]>

DATE: 2026-01-16

LICENSE: GNU GENERAL PUBLIC LICENSE

SYNOPSIS: Fixes for building hplip-3.25.8

ATTACHMENTS: https://www.linuxfromscratch.org/hints/downloads/files/ATTACHMENTS/hplip-3.25.8_fix.patch

HINT:

I built blfs-12.4 according to the stable book, including all the
packages I thought are involved with printing. Because I have
two HP printers I also needed to install hplip, which is mentioned
in the blfs-12.4 book but is not supported. For hplip I also needed
to install net-snmp, which is also mentioned but not supported. I
installed net-snmp (from http://www.net-snmp.org/) as follows:

unzip net-snmp-5.9.4.zip
cd net-snmp-5.9.4
# answer questions during configure
./configure
make
make install

At the time, the latest source code version was hplip-3.25.8.tar.gz.
I was able able to run .configure (along with various options)
without any problems, but "make" always ended with errors, of
which there were many. (I also ran "make -d" instead of "make",
which gives a lot more debugging information). I ended up finding
make errors in 13 different files, but unfortunately when "make"
encountered any errors in a file it would stop, so I had to first
try to correct the errors in that particular file and the run
"make" again to find errors in the next file. Most of the errors
were due to implicit function declarations, which gcc now
flags as errors, but there were some other issues as well.

I am not a C expert, although I do have a lot of experience
programming at a basic level. Its convoluted use of functions
and pointers can sometimes make my head spin. So I can't
guarantee that all of my corrections are 100% correct. In
many cases the fixes were straight-forward, but for other
ones I had to make my "best guess" to correct the problem.
All I can say for certain is that the fixes allowed me to
build the package and to use my printers (although I still
haven't been able to get the scanner part of my HP7602
all-in-one printer to work in blfs).

With the help of the blfs-support mailing list, I was able
to upload a blfs hint and a patch file (hplip-3.25.8_fix.patch,
found in the attachments to the hints) which implements the
changes that I made in the hplip-3.25.8 source code. I also
identified the changes with comments in each of the altered
files. The comment blocs all begin with "rkm mods" and end
with "end rkm mods". (Note that "end rkm mods" does not
necessarily mean that there are no other modifications further
along in the files, it just indicates the end of that particular
bloc. Also, in one case where many lines had the same change,
I didn't surround each line with comments, but rather I
included the line:
Replaced every instance of "SANE_Char**" with "void *"
within a comment bloc.

There are changes in the following files, assuming you are
in the expanded hplip-3.25.8 directory:

prnt/cupsext/
scan/sane/
scan/sane/
io/hpmud
io/hpmud
io/hpmud
prnt/hpcups/
scan/sane/
scan/sane/
pcard/pcardext/
prnt/hpps/
scan/sane/ledmi.h
scan/sane/orblite.c

For my system, I built and installed hplip-3.25.8 using the
following ./configure options:

./configure --enable-pp-build --enable-hpijs-install --enable-hpijs-only-build=no --enable-new-hpcups --enable-hpcups-install --enable-qt4=no --prefix=/usr

I also tested "make" with these options that were suggested on the
blfs-support mailing list, but I didn't install them:

./configure --prefix=/usr --enable-pp-build
./configure --prefix=/usr --sysconfdir=/etc --enable-cups-ppd-install

Both of these also allowed "make" to build successfully.

Here are the steps that I used to build and install hplip-3.25.8
on my system:

cp hplip-3.25.8_fix.patch /sources
cp hplip-3.25.8.tar.gz /sources
cd /sources
tar xvzf hplip-3.25.8.tar.gz
cd hplip-3.25.8
patch -p1 < ../hplip-3.25.8_fix.patch
./configure --enable-pp-build --enable-hpijs-install --enable-hpijs-only-build=no --enable-new-hpcups --enable-hpcups-install --enable-qt4=no --prefix=/usr
make
(as root:)
make install

I was surprised that the released hplip-3.25.8 source code had so many
issues, which leads me to suspect that there may be something I am
missing that could avoid these problems. If anyone knows of a simpler
fix I would love to know about it.

I hope that this hint will be helpful for other hplip users. And I
hope that future releases of hplip will not have such problems!