Installation of HPLIP Failed on Ubuntu 22.04 with error: 'make' command failed with status code 2

Asked by Chong Jit Kian

I just bought a new unit of HP Deskjet Ultra 4800 and I try to install HPLIP 3.22.10 on my Ubuntu 22.04 by using the auto installation script hplip-3.22.10.run. The script fail when reach the following stage:
-------------------------------------------------------------------------
Running 'make'
Please wait, this may take several minutes.....
errir: 'make' command failed with status code 2
-----------------------------------------------------------------------

I try to choose "custom" too at the beginning of the script starts then follows the steps but it still fail at the same stage. I am not sure what is the problem., hope someone can help, thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
HPLIP Edit question
Assignee:
No assignee Edit question
Solved by:
Chong Jit Kian
Solved:
Last query:
Last reply:
Revision history for this message
Chong Jit Kian (jkchong) said :
#1

I have follow steps in this link https://developers.hp.com/hp-linux-imaging-and-printing/install/manual/distros/ubuntu to install HPLIP. When I reach step 5 i get the following errors:-

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
prnt/hpcups/HPCupsFilter.cpp:662:35: error: ‘MAX_FILE_PATH_LEN’ was not declared in this scope
  662 | char hpPreProcessedRasterFile[MAX_FILE_PATH_LEN]; //temp file needed to store raster data with swaped pages.
      | ^~~~~~~~~~~~~~~~~
prnt/hpcups/HPCupsFilter.cpp:665:13: error: ‘hpPreProcessedRasterFile’ was not declared in this scope
  665 | sprintf(hpPreProcessedRasterFile, "%s/hp_%s_cups_SwapedPagesXXXXXX",CUPS_TMP_DIR, m_JA.user_name);
      | ^~~~~~~~~~~~~~~~~~~~~~~~
prnt/hpcups/HPCupsFilter.cpp:665:73: error: ‘CUPS_TMP_DIR’ was not declared in this scope; did you mean ‘CUPS_MEDIA’?
  665 | sprintf(hpPreProcessedRasterFile, "%s/hp_%s_cups_SwapedPagesXXXXXX",CUPS_TMP_DIR, m_JA.user_name);
      | ^~~~~~~~~~~~
      | CUPS_MEDIA
prnt/hpcups/HPCupsFilter.cpp:747:20: error: ‘szFileName’ was not declared in this scope
  747 | memset(szFileName, 0, sizeof(szFileName));
      | ^~~~~~~~~~
prnt/hpcups/HPCupsFilter.cpp:754:17: error: ‘createTempFile’ was not declared in this scope; did you mean ‘cupsTempFile’?
  754 | createTempFile(szFileName, &cfp);
      | ^~~~~~~~~~~~~~
      | cupsTempFile
prnt/hpcups/HPCupsFilter.cpp:765:17: error: ‘createTempFile’ was not declared in this scope; did you mean ‘cupsTempFile’?
  765 | createTempFile(szFileName, &kfp);
      | ^~~~~~~~~~~~~~
      | cupsTempFile
prnt/hpcups/HPCupsFilter.cpp: In member function ‘DRIVER_ERROR HPCupsFilter::startPage(cups_page_header2_t*)’:
prnt/hpcups/HPCupsFilter.cpp:455:18: warning: ignoring return value of ‘int getdomainname(char*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  455 | getdomainname(m_JA.domain_name, sizeof(m_JA.domain_name) - 1);
      | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Revision history for this message
Manfred Hampl (m-hampl) said :
#2

1. Why do you try the manual installation and not the automatic one?

2. If you are running Ubuntu, then you better install the adapted HPLIP packages from the Ubuntu repositories.
sudo apt install hplip-gui

Revision history for this message
brian_p (claremont102) said :
#3

Give the outputs from the commands

  avahi-browse -rt _ipp._tcp
  avahi-browse -rt _uscan._tcp
  driverless

Revision history for this message
Chong Jit Kian (jkchong) said :
#4

Hi! Manfred Hampl, I had tried the automatic way but it didn't work so I tried the manual way. I have tried to install the hplip and hplip-gui packages from Ubuntu too. The installation had no error, but when I tried to use hp-setup command to setup my printer, it said command not found.

Revision history for this message
Chong Jit Kian (jkchong) said :
#5

Hi! brian_p, I have tried all the 3 commands you shown me but there was no output after I issued each and every command.

Revision history for this message
Manfred Hampl (m-hampl) said (last edit ):
#6

If you have installed the hplip package from the Ubuntu repositories and then get "command not found" for the hp-setup command, then something must have gone wrong.

Please provide the full output that you receive for the following commands (to be executed in a terminal window):

uname -a
lsb_release -crid
dpkg -l | grep hplip
command -v hp-setup
hp-setup -h

Revision history for this message
Chong Jit Kian (jkchong) said :
#7

Hi! Manfred Hampl, the following output is the result of the commands:
jitkian@cjk-t440:~$ uname -a
Linux cjk-t440 5.15.0-58-generic #64-Ubuntu SMP Thu Jan 5 11:43:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
jitkian@cjk-t440:~$ lsb_release -crid
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy

jitkian@cjk-t440:~$ dpkg -l | grep hplip
ii hplip 3.21.12+dfsg0-1 amd64 HP Linux Printing and Imaging System (HPLIP)
ii hplip-data 3.21.12+dfsg0-1 all HP Linux Printing and Imaging - data files
ii hplip-gui 3.21.12+dfsg0-1 all HP Linux Printing and Imaging - GUI utilities (Qt-based)

jitkian@cjk-t440:~$ command -v hp-setup

jitkian@cjk-t440:~$ hp-setup -h
Command 'hp-setup' not found, but can be installed with:
sudo apt install hplip

The following output is the result of the installation process of hplip and hplip-gui:
jitkian@cjk-t440:~$ sudo apt install hplip hplip-gui
[sudo] password for jitkian:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libhpmud0 libsane-hpaio printer-driver-hpcups printer-driver-postscript-hp
Suggested packages:
  hplip-doc
The following NEW packages will be installed:
  hplip hplip-gui libhpmud0 libsane-hpaio printer-driver-hpcups printer-driver-postscript-hp
0 upgraded, 6 newly installed, 0 to remove and 9 not upgraded.
Need to get 1,844 kB of archives.
After this operation, 6,484 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://my.archive.ubuntu.com/ubuntu jammy/main amd64 libhpmud0 amd64 3.21.12+dfsg0-1 [113 kB]
Get:2 http://my.archive.ubuntu.com/ubuntu jammy/main amd64 libsane-hpaio amd64 3.21.12+dfsg0-1 [133 kB]
Get:3 http://my.archive.ubuntu.com/ubuntu jammy/main amd64 printer-driver-hpcups amd64 3.21.12+dfsg0-1 [244 kB]
Get:4 http://my.archive.ubuntu.com/ubuntu jammy/main amd64 hplip amd64 3.21.12+dfsg0-1 [208 kB]
Get:5 http://my.archive.ubuntu.com/ubuntu jammy/universe amd64 hplip-gui all 3.21.12+dfsg0-1 [18.6 kB]
Get:6 http://my.archive.ubuntu.com/ubuntu jammy/main amd64 printer-driver-postscript-hp amd64 3.21.12+dfsg0-1 [1,128 kB]
Fetched 1,844 kB in 1s (1,262 kB/s)
Selecting previously unselected package libhpmud0:amd64.
(Reading database ... 295286 files and directories currently installed.)
Preparing to unpack .../0-libhpmud0_3.21.12+dfsg0-1_amd64.deb ...
Unpacking libhpmud0:amd64 (3.21.12+dfsg0-1) ...
Selecting previously unselected package libsane-hpaio:amd64.
Preparing to unpack .../1-libsane-hpaio_3.21.12+dfsg0-1_amd64.deb ...
Unpacking libsane-hpaio:amd64 (3.21.12+dfsg0-1) ...
Selecting previously unselected package printer-driver-hpcups.
Preparing to unpack .../2-printer-driver-hpcups_3.21.12+dfsg0-1_amd64.deb ...
Unpacking printer-driver-hpcups (3.21.12+dfsg0-1) ...
Selecting previously unselected package hplip.
Preparing to unpack .../3-hplip_3.21.12+dfsg0-1_amd64.deb ...
Unpacking hplip (3.21.12+dfsg0-1) ...
Selecting previously unselected package hplip-gui.
Preparing to unpack .../4-hplip-gui_3.21.12+dfsg0-1_all.deb ...
Unpacking hplip-gui (3.21.12+dfsg0-1) ...
Selecting previously unselected package printer-driver-postscript-hp.
Preparing to unpack .../5-printer-driver-postscript-hp_3.21.12+dfsg0-1_amd64.deb ...
Unpacking printer-driver-postscript-hp (3.21.12+dfsg0-1) ...
Setting up printer-driver-postscript-hp (3.21.12+dfsg0-1) ...
Setting up libhpmud0:amd64 (3.21.12+dfsg0-1) ...
Setting up libsane-hpaio:amd64 (3.21.12+dfsg0-1) ...
Setting up printer-driver-hpcups (3.21.12+dfsg0-1) ...
Setting up hplip (3.21.12+dfsg0-1) ...
Creating/updating hplip user account...
Setting up hplip-gui (3.21.12+dfsg0-1) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Processing triggers for bamfdaemon (0.5.6+22.04.20220217-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...
Processing triggers for cups (2.4.1op1-1ubuntu4.1) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for dbus (1.12.20-2ubuntu4.1) ...

Revision history for this message
Manfred Hampl (m-hampl) said :
#8

If you re-install hplip with the command

sudo apt install --reinstall hplip

does hp-setup work then?

If it still does not work, what output do you receive for the command

/usr/bin/hp-setup

Revision history for this message
Chong Jit Kian (jkchong) said :
#9

Hi! Manfred Hampl, I have reinstall the hplip, it's still the same, hp-setup doesn't work, command not found. When i issue the command /usr/bin/hp-setup the output said "No such file or directory".

When I listed all the hp* files (ls -la hp*) in /usr/bin i found all the hp* files are linked to ../share/hplip/hp*.py inclusive of hp-setup. But as I listed all the files in /usr/share/hplip/ directory, I only saw a folder name "data", inside the data folder there is a sub-folder name models which contain a file models.dat. There is no hp*.py files.

Revision history for this message
Manfred Hampl (m-hampl) said :
#10

What is the output of the commands

ls -ld /usr/bin/hp*
ls -l /usr/share/hplip/se*

If that does not show anything or gives errors, then run

sudo apt install --reinstall hplip-data

and repeat the two commands again
What output do you receive?

Revision history for this message
Chong Jit Kian (jkchong) said :
#11

Hi! Manfred Hampl, after reinstall there is still nothing inside /usr/share/hplip/ folder. But I manage to use the desktop printer settings (Right upper corner -> Settings -> Printers) to setup my printer. The HP printer is automatically detected and I just change the ppd file, reboot ubuntu and then I can print.

Revision history for this message
Chong Jit Kian (jkchong) said :
#12

I install hplip in a new ubuntu 22.04 vm. Then i copy all the files in /usr/share/hplip/ and /etc/hp/hplip.conf from new ubuntu 22.04 to my laptop and the hp-setup command works.

After running through the hp-setup process, printer was added but couldn't print because of communication error. So I remove ipp-usb package and it works.