CUPS,即Common Unix Printing System 是一个UNIX系统下的打印管理程序。
移植编译过程:
#!/bin/sh
# 1.下载源码
wget http://www.cups.org/software/1.3.9/cups-1.3.9-source.tar.gz &&
# 2.解压并打开
tar xvzf cups-1.3.9-source.tar.gz && cd cups-1.3.9 &&
# 3.配置
./configure --host=arm-linux --target=arm-linux --build=i686-linux CC=arm-linux-gcc CXX=arm-linux-g++ LD=arm-linux-ld RANLIB=arm-linux-ranlib AR=arm-linux-ar --disable-gnutls --disable-gssapi --disable-dbus --prefix=/ &&
# 4.修改Makefile使其不编译man
sed -i '22s/locale man monitor/locale monitor/' ./Makefile &&
# 5.编译并安装
make && make install DSTROOT=${PWD}/_install &&
echo "cups build install ok!"
部署到目标板子上后,正常情况下启动CUPS:
# /etc/init.d/cups start
cups: started scheduler.
#
# lpinfo -v
network socket
network http
network ipp
network lpd
direct scsi
#
# lpadmin
Usage:
lpadmin [-h server] -d destination
lpadmin [-h server] -x destination
lpadmin [-h server] -p printer [-c add-class] [-i interface] [-m model]
[-r remove-class] [-v device] [-D description]
[-P ppd-file] [-o name=value]
[-u allow:user,user] [-u deny:user,user]
以下是会遇到问题:
1. busybox的PS命令和PC端不一致
# /etc/init.d/cups start
ps: invalid option -- 'a'
BusyBox v1.17.2 (2010-12-30 11:13:11 HKT) multi-call binary.
Usage: ps
Show list of processes
Options:
w Wide output
解决方法:
将/etc/init.d/cups的162行ps ax
改为ps w
改后如下:
pid=`ps w | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
2. 库文件路径不正确
# lpstat
lpstat: error while loading shared libraries: libcups.so.2: cannot open shared object file: No such file or directory
解决方法:
这些库文件存在于/usr/lib64目录下,一种方法是将/usr/lib64也作为运行库目录;另一种方法是将/usr/lib64目录下的内容拷贝到/usr/lib目录下解决问题。cp usr/lib64/* /usr/lib/
3. error while loading shared libraries: libssl.so libcrypto.so.1.0.0
# /etc/init.d/cups start
/usr/sbin/cupsd: error while loading shared libraries: libssl.so.1.0.0: cannot open shared object file: No such file or directory
/usr/sbin/cupsd: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory
cups: unable to start scheduler.
解决方法:将交叉工具链中的库拷贝进来。