Skip to content

Instantly share code, notes, and snippets.

@BorysVrublevskyi
Last active January 19, 2024 14:40
Show Gist options
  • Save BorysVrublevskyi/0bf16f906aeb7bff67dc9a4b791d5c51 to your computer and use it in GitHub Desktop.
Save BorysVrublevskyi/0bf16f906aeb7bff67dc9a4b791d5c51 to your computer and use it in GitHub Desktop.
How to compile CUPS print server for the latest OpenWRT (tested on v21)

Compile CUPS print server for the latest OpenWrt (v21)

Sources

https://github.com/TheMMcOfficial/cups-for-openwrt
Deps https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem
Single package https://openwrt.org/docs/guide-developer/toolchain/single.package
http://ipkg.nslu2-linux.org/feeds/optware/ddwrt/cross/stable/
https://openwrt.org/docs/guide-developer/toolchain/using_the_sdk
https://openwrt.org/ru/doc/howto/build
https://github.com/syb999/openwrt-musl-cups/tree/master/x86_64

Run on Linux machine

git clone https://github.com/lede-project/source

cd source

echo "src-git cups https://github.com/TheMMcOfficial/lede-cups.git" >> feeds.conf.default

./scripts/feeds update -a && ./scripts/feeds install -a

make menuconfig

### Set the target system to your router's "Platform" and set Network -> Printing -> cups as "M"

make tools/install && make toolchain/install

# ???
# ./scripts/feeds install cups

make package/cups/compile 
# make package/cups/install
find ./ -name \*ipk

Copy .ipk files to your router

Run on router

opkg install ./packages/*.ipk
opkg install ./packages/libcups_2.3.0-2_x86_64.ipk
opkg install ./packages/libcups_2.3.0-2_x86_64.ipk

### CONFIG: Alow local admin (need to test)
cupsctl --remote-admin

/etc/init.d/cupsd restart

Open in browser. Add your printer

http://192.168.1.1:631/admin

Copy printer's url, add printer by url, but edit it to use http (not https)

@logicplace
Copy link

Hello you are the result on google so I'm leaving this here.

For a newer version of CUPS and also the ability to use gutenprint which is needed for Canon printers (and why would you be doing this otherwise? p910nd works with other brands), use this feed.

echo 'src-git printing https://github.com/logicplace/openwrt-printing-packages.git' >> feeds.conf.default

For those of you on Turris like me, here's the INCOMPLETE walkthru cause ultimately I suck at this and gave up, but didn't want to leave what I did accomplish unshared:

git clone https://gitlab.nic.cz/turris/os/build.git
cd build
echo 'src-git printing https://github.com/logicplace/openwrt-printing-packages.git' >> feeds.conf

# Open LuCI and look at your Firmware Version under System on the Dashboard. It'll say, for example, TurrisOS 6.1.0
# Checkout the tag for that version
git checkout v6.1.0

# Make a build dir
mkdir build
cd build

# Prepare everything. You can check which device you have from the same System box in the Dashboard where it says Model
# Mine's an Omnia so I put omnia here. If it's something else, you can check for the other target names available with:
# ls ../configs
../compile_pkgs prepare -t omnia

# Everything is selected to be installed by default, but if you want to remove some feel free to:
# make menuconfig
# You will not need to adjust the Target/Subtarget/Target Profile

../compile_pkgs prepare_tools -t omnia

# I had to do this to get cups to compile but I did it before making my own feed, so you may or may not need some:
rm feeds/packages/libs/libcups/Makefile
make package/gnutls/compile
make package/openssl/compile

# Compile gutenprint, cups, etc
make package/cups/compile
# TODO: I gave up here, but if anyone figures it out lmk
make package/gutenprint/compile

@PrvtN00b
Copy link

I did follow this tutorial, and I´m getting this error, my router which is a Turris Omnia

image

@PrvtN00b
Copy link

PrvtN00b commented Mar 26, 2023

../compile_pkgs prepare -t omnia

following your process and for some reason this is popping up and wont let me compile, not sure how do I fix this

image

@logicplace
Copy link

I don't know, like my post says it's incomplete and I gave up. Do not attempt unless you're confident you can actually fix the issues and contribute the full tutorial.

@BorysVrublevskyi
Copy link
Author

@logicplace, just like you, I saved my experience and shared it with everyone who is searching for a solution.
Without any logs or error text, distro family where you're compiling this, I can't even imagine what went wrong.

@PrvtN00b

  1. Build it on a PC or laptop. It took me a couple of hours to be done with a high CPU load.
  2. These errors say, that your system missing dependencies (packages) to build it. It could be that OpenWRT does not have them.

Currently I'm using a Keenetic router and Intel Atom-based media server with Linux and CUPS from repo.

@PrvtN00b
Copy link

thi is the lines i´m using, because I´m trying to use CUPS with gutenprint for a canon printer:

git clone https://github.com/lede-project/source

cd source

echo 'src-git printing https://github.com/logicplace/openwrt-printing-packages.git' >> feeds.conf.default


./scripts/feeds update -a && ./scripts/feeds install -a

make menuconfig

make package/cups/compile

@BorysVrublevskyi
Copy link
Author

Currently, I have an openSUSE Leap 15.4 on my laptop. So the result of the execution command make menuconfig was like this:

Checking 'working-make'... ok.
Checking 'case-sensitive-fs'... ok.
Checking 'proper-umask'... ok.
Checking 'gcc'... failed.
Checking 'working-gcc'... ok.
Checking 'g++'... ok.
Checking 'working-g++'... failed.
Checking 'ncurses.h'... failed.
Checking 'git'... ok.
...

This will show you the components that your system does not have (Checking ... failed), so you need to find the package name that contains that component and install it.

You can try to search for it in repos:

# For openSUSE
sudo zypper search COMPONENT_NAME
sudo zypper install MISSING_PACKAGE

# Fedora
sudo dnf search COMPONENT_NAME
sudo dnf install MISSING_PACKAGE

# Debian / Ubuntu
sudo apt update
sudo apt-cache search COMPONENT_NAME
sudo apt install MISSING_PACKAGE

Or Google it.

In my case the result was:

sudo zypper install make gcc glibc gcc-c++ ncurses-devel patch

@Vladdrako
Copy link

https://github.com/Vladdrako/openwrt-printing-packages
Trying to update some stuff) Works fine on my qcom/ipq60xx/linksys-mr7350

@hidasw
Copy link

hidasw commented Jan 7, 2024

is possible to enable tls?
android print service restrict to use tls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment