CUPS, Avahi, PDF

Hi everyone,

For the past weeks I've been trying to get a good Airprint support so that I can print from my phone on an old printer (print server is, hence, CUPS on my ASUS RT-N16). You know, the kind of project that starts simply but can get really complicated.

Now I need some help.

I got CUPS working by compiling it from Gr4ffy lede-cups (follow the instructions). Avahi (Zeroconf) is somewhat easy to setup...

Now, I'm trying to have the rest working : PDF printing and other printing protocols.

I figured out I needed poppler, I compiled it from : https://github.com/FranciscoBorges/openwrt-printing-packages

I'm not sure how those systems (CUPS, poppler) interact with each other, but I think it's through GIMP.

I tried to get Gutenprint/GIMP from https://sourceforge.net/p/gimp-print/source/ci/master/tree/ but I cannot get to compile : I have an issue with libpcap (error on line 264 about AF_MAX)...

Here are my questions:

  1. What packages do I need to be able to get PDF printing support on CUPS?
  2. Do you have a good feed for GIMP?
  3. Should I have a problem with compiling libpcap?

I must say that I'm new to a lot of this stuff. Couple of weeks ago, I hadn't :

  • Heard about OpenWRT
  • Installed packaged on a linux based OS
  • Compiled on Linux

I'm glad of what I've done on this project, I would be glad to complete it. I guess I'm not that far...

Your help and comments are more than welcome!
BR, Gab

Wow! Great work!

What kind of a device are you hoping to run this on? A lot of the packages you need for printing can be challenging to run on a router-class device. They typically need to spool the print jobs on the way in, and often on the way out (hard on flash memory, and can be very large for rasterized images, especially with an "old" printer that doesn't have native rasterization). You often need a lot of memory to to the conversion as well.

Since it sounds like you've gotten a "big" Linux system up and running, I'd suggest learning the parts you need to string together there first. I've been lucky in that all the printers I've dealt with interpret PostScript natively, so rasterization for CUPS isn't something I've poked into heavily. It's my understanding that gutenprint (f.k.a. "gimp-print") may be all you need in addition to CUPS to get a functional print server up and running with many printers.

libpcap seems to work well within the OpenWrt build system. It may be that your package's Makefile (the OpenWrt one, not the one with the distribution that it would download and build) needs to call out the libraries on which the build depends. Would you be able to post your package Makefile? (The </> button in the post editor will make it show up as pre-formatted text and a lot easier to read.)

Hey Jeff,

Thank you very much for this quick reply and your kind words, I really appreciate. I have an ASUS RT-N16. The printer, a HP LaserJet 1200, is slow but has PostScript support. I've added an USB stick (1 GB), I expect to have plenty of space for spooling.

I agree, libpcap compiled before.

I agree. For this to succeed, I must understand the details and tie them together, but it's a lot of new stuff for me, this forum will be useful. Looking at the Makefile is a good idea !

#
# Copyright (C) 2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=gutenprint
PKG_VERSION:=5.2.9
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=@SF/gimp-print
PKG_MD5SUM:=aefbec27b96dd404d9ac9811e17d58ce

PKG_BUILD_DEPENDS:=gutenprint-cups/host cups libiconv
HOST_BUILD_DEPENDS:=libiconv/host
PKG_INSTALL:=1

include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk

define Package/gutenprint-cups
  SECTION:=net
  CATEGORY:=Network
  TITLE:=gutenprint-cups -- Gutenprint CUPS drivers
  # XXX FIXME perl is required by cups-genppdupdate, but it needs more libs
  DEPENDS:=+cups +libcupsimage +libiconv
  URL:=http://gimp-print.sourceforge.net/
  SUBMENU:=Printing
endef

# define Package/gutenprint-foomatic
#   SECTION:=net
#   CATEGORY:=Network
#   TITLE:=gutenprint-foomatic -- Gutenprint Foomatic drivers
#   # perl is required by cups-genppdupdate
#   DEPENDS:=+ghostscript +libiconv
#   URL:=http://gimp-print.sourceforge.net/
#   SUBMENU:=Printing
# endef

define Package/gutenprint-cups/description
	Gutenprint CUPS drivers for a wide range of Canon, Epson, HP and
	compatible printers.
endef

CONFIGURE_ARGS+= \
	--disable-nls \
	--disable-test \
	--without-doc \
	--without-readline \
	--without-foomatic \
	--without-foomatic3 \
	--enable-escputil=no \
	--enable-test=no \
	--disable-translated-cups-ppds \
	--disable-globalized-cups-ppds \
	--enable-simplified-cups-ppds \
	--bindir=/usr/bin \
	--sbindir=/usr/bin \
	--prefix=/usr \
	--exec-prefix=/usr

define Build/Compile
	# Replace the cross-compiled "extract-string" by a shell-script that
	# runs the host's own compiled version (gutenprint needs to run this)
	(cd $(PKG_BUILD_DIR) && $(MAKE) -C src/xml extract-strings && \
	$(RM) src/xml/extract-strings && \
	echo '#!/bin/sh' > src/xml/extract-strings && \
	echo 'exec $(HOST_BUILD_DIR)/src/xml/extract-strings  "$$$$@" ' \
	>> src/xml/extract-strings && chmod +x src/xml/extract-strings && cp src/xml/extract-strings /tmp/)
	$(call Build/Compile/Default)
endef

define Package/gutenprint-cups/install
	$(INSTALL_DIR) $(1)/usr/sbin $(1)/usr/bin
	# XXX Do not install cups-genppdupdate, as it requires Perl + some perl libs
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/cups-genppd.[0-9]*.[0-9]* $(1)/usr/sbin/
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cups-calibrate $(1)/usr/bin/

	$(INSTALL_DIR) $(1)/usr/lib/cups/driver $(1)/usr/lib/cups/filter
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/cups/driver/gutenprint.* $(1)/usr/lib/cups/driver
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/cups/filter/* $(1)/usr/lib/cups/filter
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libgutenprint.* $(1)/usr/lib
	$(INSTALL_DIR) $(1)/usr/share/cups/mime
	$(CP) $(PKG_INSTALL_DIR)/etc/cups/command.types $(1)/usr/share/cups/mime
	$(INSTALL_DIR) $(1)/usr/share/gutenprint
	$(CP) $(PKG_INSTALL_DIR)/usr/share/gutenprint/[0-9]*.[0-9]* $(1)/usr/share/gutenprint
endef

define Host/Compile
  $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/src/xml $(HOST_MAKE_FLAGS) extract-strings
endef

define Host/Install
endef

$(eval $(call HostBuild))
$(eval $(call BuildPackage,gutenprint-cups))

What I see at the moment is that I will need "gutenprint-cups/host". How do I get it installed (the "/host" bugs me a little, is this a standard name for a package? Isn't it defined in the Makefile 8 lines below?)?

By the way, how do you find feeds? Are they always associated (in the same repo) as the "master program"?

I'm also trying to try to compile an old version of GIMP (I don't care about the version, maybe this would work). I was thinking about cloning version 4.3.9. How do you clone an old version? Since git clone https://git.code.sf.net/p/gimp-print/source gimp worked, I tried git clone https://git.code.sf.net/p/gimp-print-4_3_9/source gimpold without success...

Cheers,
Gab

Edit: Before diving into this further -- have you tried
https://openwrt.org/docs/guide-user/services/print_server/cups.server

Edit: I thought I had checked for a pre-built CUPS package first, and just rechecked and the table isn't showing one. https://openwrt.org/packages/table/start?dataflt[Name_pkg-dependencies*~]=cups nor is a download directory https://downloads.openwrt.org/releases/18.06.1/packages/mipsel_24kc/packages/
So onward, it seems to be.


OK -- reading that makefile it looks like it will download v5.2.9 of gutenprint from the repo at SourceForge. It looks like there's a 5.2.14 from https://sourceforge.net/p/gimp-print/source/ref/master/tags/, but that kind of tweak can come later on. (That whole print-utility repo is 4-5 years old, it looks like.)

It shouldn't need GIMP, at least the way I read it. cups and libiconv are all it needs. It should be able to build gutenprint-cups/host itself, and libiconv/host should be built by the libiconv package.

The directions for adding custom feeds are pretty confusing, so I copied openwrt/feeds.conf.default to openwrt/feeds.conf (where openwrt/ is the root directory of my build system. Then added to the end

src-git printing https://github.com/FranciscoBorges/openwrt-printing-packages;master

"SOP" to get feeds up to date and integrated into the build system:

openwrt$ ./scripts/feeds update -a
openwrt$ ./scripts/feeds install -a

and even after running install -a twice to get rid of any dependency ordering problems, I still see

openwrt$ ./scripts/feeds install -a
Collecting package info: done
WARNING: Makefile 'package/feeds/printing/cups/Makefile' has a dependency on 'openslp', which does not exist
WARNING: Makefile 'package/feeds/printing/gutenprint/Makefile' has a build dependency on 'gutenprint-cups/host', which does not exist
WARNING: Makefile 'package/feeds/printing/tig/Makefile' has a build dependency on 'libncurses', which does not exist
[...]

So you're probably not doing anything wrong. More that this repo hasn't been updated recently and is either referring to now non-existent packages, or expecting the build system to work differently than it now does ("host"
package generation, in particular).

openslp apparently was a maintained package sometime around 2008-2009 with v1.2.1 (with 2.0.0 being the current stable since 2013). I don't immediately find any references to it in the current git "packages" archive which goes back to 2014.

My night is drawing to a close so I can't dig in much farther.

You might want to change the title to something like "Packages for CUPS, Gutenprint Drivers, OpenSLP?" to attract the attention of someone who might have gone through this recently.

1 Like

Hey Jeff! Thank you for your detailed follow-up.

I've simply installed libiconv, and now it works !! That's it, I was only missing a single package. Now I still have some things to setup properly (samba for printers), move the spooling to the USB key (as I was intending to, but it doesn't seem to be working and I should have completed this project.

I've looked at the other information you pointed out, no hint about libiconv.

It's good to know I'm not doing anything wrong either. I now understand that if nobody is working on it at this moment, you pretty much can consider it dead. That means, it's really hard to find a 5 years old guideline on the internet and try to follow it, even if you plan on building the old code. I would have loved to have more details about compiling "older code" and cloning older feeds. But, anyway, I will simply accept this fact and move on.

Tonight was my last try, after that I was moving to a Raspberry Zero which would have been pretty much a 40$ plug and play solution.

I also had a hard time finding the feeds download link sometimes. Maybe I'll give it another shot in a future project.

Cheers,
Gab

1 Like

Please tell me full process.How you compile cups. please tell your target.

Hi Rohitdk1998,
To fix gutenprint compile error , just modify the PKG_BUILD_DEPENDS in the Makefile "PKG_BUILD_DEPENDS:=gutenprint-cups/host cups libiconv" to "PKG_BUILD_DEPENDS:=gutenprint/host cups libiconv"

1 Like

Thankyou very much