交叉编译CUPS

最近研究下如何交叉编译 CUPS,期间碰到很多编译上的问题,google一下,也没有见到详细的关于交叉编译cups的文档。自己根据网上的一些帖子,一点一点的研究编译中出 现的问题,今天终于完成了。这里就说下交叉编译CUPS的过程和当中遇到的问题。

一:交叉编译环境
    我使用的是gcc-4.1.1,制作交叉编译环境用到了如下的文件:
    binutils-2.16.1   Download URLftp://ftp.gnu.org
    gdb-6.5           Download URLftp://ftp.gnu.org
    gcc-3.3.6         Download URLftp://ftp.gnu.org
    glibc-2.3.2       Download URLftp://ftp.gnu.org
    linux-2.6.24      Download URLhttp://www.kernel.org
    linux-libc-headers-2.6.12.0   Download URLhttp://ep09.pld-linux.org/~mmazur/linux-libc-headers/
    使用crosstool-0.43工具进行编译,生成我的交叉编译环境。(从http://kegel.com/crosstool下载 crosstool-0.43)

二:CUPS版本
    cups-1.3.9-source.tar.gz
    Download URLhttp://www.cups.org/software.php

三: 步骤
    1、交叉编译工具放置位置
       1.1 将交叉编译工具目录(4.1.1,一般而言,交叉编译目录以GCC版本号命名)放置到/usr/local/arm/下面(如果没有arm目录,则新建 之);
       1.2 编辑/etc/profile文件,加入/usr/local/arm/4.1.1/bin的路径
           pathmunge /usr/local/arm/4.1.1/bin

           然后,执行source /etc/profile或者重新启动电脑,使得相关路径添加到PATH中。

    2、解压cups到一个目录中(您可以自己指定);

    3、cd cups-1.3.9/,进入cups目录;

    4、configure,指令如下:
       ./configure CC=/usr/local/arm/4.1.1/bin/arm-linux-gcc CXX=/usr/local/arm/4.1.1/bin/arm-linux-g++ LD=/usr/local/arm/4.1.1/bin/arm-linux-ld RANLIB=/usr/local/arm/4.1.1/bin/arm-linux-ranlib AR=/usr/local/arm/4.1.1/bin/arm-linux-ar --target=arm-linux --host=arm-linux --build=i686-linux --disable-gnutls --disable-gssapi --disable-dbus --prefix=/
       执行完成之后,会生成一个Makedefs文件,这个名称给Makefile使用。头文件和库文件的修改,都在这个文件中进行。Makefile文件在 configure过程中,不会自动生成,它是不变的。

       在configure的过程中遇到很多问题。现在说下我解决的方法:

       问题1:库连接错误(找不到xxx库)
       /usr/local/arm/4.1.1/bin/../lib/gcc/arm-linux/4.1.1/../../../../arm-linux/bin/ld: cannot find -lgnutls
       我本想交叉编译gnutls,生成相关的库,但是交叉编译gnutls失败,网上暂时也找不到gnutls交叉编译库的内容,所以这个暂时放在一边。

       修改方法:
       添加编译选项:--disable-gnutls(含义:使得gnutls选项无效)

       在文件Makedefs文件中,SSLLIBS         =       -lgnutls表示需要SSL库支持。

       问题2:
       In file included from cupsd.h:121,
                        from auth.c:57:
       cert.h:28: error: expected specifier-qualifier-list before 'krb5_ccache'
       In file included from cupsd.h:127,
                        from auth.c:57:
       job.h:60: error: expected specifier-qualifier-list before 'krb5_ccache'
       In file included from auth.c:57:
       cupsd.h:164: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'KerberosContext'
       auth.c: In function 'cupsdAuthorize':
       auth.c:561: error: 'cupsd_cert_t' has no member named 'ccache'
       make[1]: *** [auth.o] 错误 1
       make: *** [all] 错误 1

       这个应该是头文件的问题。这个问题与gssapi有关,暂时没有解决。可以查看Makedefs文件中的
       LIBGSSAPI       =       -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv -ldl
       改行说明需要gssapi库的支持。

       解决方法:--disable-gssapi

       问题3:
       /usr/local/arm/4.1.1/bin/../lib/gcc/arm-linux/4.1.1/../../../../arm-linux/bin/ld: skipping incompatible /lib/libdbus-1.so when searching for -ldbus-1
       /usr/local/arm/4.1.1/bin/../lib/gcc/arm-linux/4.1.1/../../../../arm-linux/bin/ld: cannot find -ldbus-1

       与问题一类似。
       在Makedefs文件中,CUPSDLIBS       =         -L/lib -ldbus-1表示cups库支持。
       解决方法:--disable-dbus

       这里对问题的解决,主要是对相关库的连接属性进行修改,后期将对这个库的编译作一个研究,并加入进来,使得CUPS的编译更加完整。实际上,在将cups 移植到开发板的时候,部分功能可以不要,当然相关库也可以不用,使用--disable选项可以取消某些库的使用。

    5、make
       5.1 修改Makefile文件,将
       DIRS    =       cups backend berkeley cgi-bin filter locale man monitor \
                       notifier $(PDFTOPS) scheduler systemv test \
                       $(PHPDIR) \
                       conf data doc $(FONTS) ppd templates
       修改为:

       DIRS    =       cups backend berkeley cgi-bin filter locale monitor \
                       notifier $(PDFTOPS) scheduler systemv test \
                       $(PHPDIR) \
                       conf data doc $(FONTS) ppd templates

       取消对man文件编译。否则会出现如下的错误:
       Compiling mantohtml.c...
       Converting man pages to HTML...
           cancel.1.gz...
       /bin/sh: line 2: ./mantohtml: cannot execute binary file
           cups-config.1.gz...
       /bin/sh: line 2: ./mantohtml: cannot execute binary file
           cupstestdsc.1.gz...
       /bin/sh: line 2: ./mantohtml: cannot execute binary file
           cupstestppd.1.gz...
       /bin/sh: line 2: ./mantohtml: cannot execute binary file
           lp.1.gz...
       /bin/sh: line 2: ./mantohtml: cannot execute binary file
           lpoptions.1.gz...
       /bin/sh: line 2: ./mantohtml: cannot execute binary file
           lppasswd.1.gz...
       /bin/sh: line 2: ./mantohtml: cannot execute binary file
           lpq.1.gz...
       /bin/sh: line 2: ./mantohtml: cannot execute binary file
           lprm.1.gz...
       /bin/sh: line 2: ./mantohtml: cannot execute binary file
           lpr.1.gz...
       /bin/sh: line 2: ./mantohtml: cannot execute binary file
           lpstat.1.gz...
       /bin/sh: line 2: ./mantohtml: cannot execute binary file
       make[1]: *** [html] 错误 126
       make: *** [all] 错误 1

       做完修改后,make可以正常进行。
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Building on: linux-g++ (x86_64, CPU features: mmx sse sse2) Building for: linux-aarch64-gnu-g++ (arm64, CPU features: neon) Target compiler: gcc 6.3.1 Configuration: cross_compile use_gold_linker compile_examples enable_new_dtags largefile neon precompile_header shared rpath release c++11 c++14 concurrent dbus reduce_exports stl Build options: Mode ................................... release Optimize release build for size ........ no Building shared libraries .............. yes Using C standard ....................... C11 Using C++ standard ..................... C++14 Using ccache ........................... no Using gold linker ...................... yes Using new DTAGS ........................ yes Using precompiled headers .............. yes Using LTCG ............................. no Target compiler supports: NEON ................................. yes Build parts ............................ libs Qt modules and options: Qt Concurrent .......................... yes Qt D-Bus ............................... yes Qt D-Bus directly linked to libdbus .... no Qt Gui ................................. yes Qt Network ............................. yes Qt Sql ................................. yes Qt Testlib ............................. yes Qt Widgets ............................. yes Qt Xml ................................. yes Support enabled for: Using pkg-config ....................... yes udev ................................... no Using system zlib ...................... yes Qt Core: DoubleConversion ....................... yes Using system DoubleConversion ........ no GLib ................................... no iconv .................................. yes ICU .................................... no Tracing backend ........................ Logging backends: journald ............................. no syslog ............................... no slog2 ................................ no Using system PCRE2 ..................... no Qt Network: getifaddrs() ........................... yes IPv6 ifname ............................ yes libproxy ............................... no Linux AF_NETLINK ....................... yes OpenSSL ................................ yes Qt directly linked to OpenSSL ........ no OpenSSL 1.1 ............................ no DTLS ................................... yes SCTP ................................... no Use system proxies ..................... yes Qt Gui: Accessibility .......................... yes FreeType ............................... yes Using system FreeType ................ no HarfBuzz ............................... yes Using system HarfBuzz ................ no Fontconfig ............................. no Image formats: GIF .................................. yes ICO .................................. yes JPEG ................................. yes Using system libjpeg ............... yes PNG .................................. yes Using system libpng ................ no EGL .................................... no OpenVG ................................. no OpenGL: Desktop OpenGL ....................... no OpenGL ES 2.0 ........................ no OpenGL ES 3.0 ........................ no OpenGL ES 3.1 ........................ no OpenGL ES 3.2 ........................ no Vulkan ................................. no Session Management ..................... yes Features used by QPA backends: evdev .................................. yes libinput ............................... no INTEGRITY HID .......................... no mtdev .................................. no tslib .................................. no xkbcommon .............................. no X11 specific: XLib ................................. no EGL on X11 ........................... no QPA backends: DirectFB ............................... no EGLFS .................................. no LinuxFB ................................ yes VNC .................................... yes Mir client ............................. no Qt Sql: SQL item models ........................ yes Qt Widgets: GTK+ ................................... no Styles ................................. Fusion Windows Qt PrintSupport: CUPS ................................... no Qt Sql Drivers: DB2 (IBM) .............................. no InterBase .............................. no MySql .................................. no OCI (Oracle) ........................... no ODBC ................................... no PostgreSQL ............................. no SQLite2 ................................ no SQLite ................................. yes Using system provided SQLite ......... no TDS (Sybase) ........................... no Qt Testlib: Tester for item models ................. yes Qt SerialBus: Socket CAN ............................. yes Socket CAN FD .......................... yes Qt QML: QML network support .................... yes QML debugging and profiling support .... yes QML sequence object .................... yes QML list model ......................... yes QML XML http request ................... yes QML Locale ............................. yes QML delegate model ..................... yes Qt Quick: Direct3D 12 ............................ no AnimatedImage item ..................... yes Canvas item ............................ yes Support for Qt Quick Designer .......... yes Flipable item .......................... yes GridView item .......................... yes ListView item .......................... yes TableView item ......................... yes Path support ........................... yes PathView item .......................... yes Positioner items ....................... yes Repeater item .......................... yes ShaderEffect item ...................... yes Sprite item ............................ yes Qt Scxml: ECMAScript data model for QtScxml ...... yes Qt Gamepad: SDL2 ................................... no Qt 3D: Assimp ................................. yes System Assimp .......................... no Output Qt3D Job traces ................. no Output Qt3D GL traces .................. no Use SSE2 instructions .................. no Use AVX2 instructions .................. no Aspects: Render aspect ........................ yes Input aspect ......................... yes Logic aspect ......................... yes Animation aspect ..................... yes Extras aspect ........................ yes Qt 3D Renderers: OpenGL Renderer ........................ yes Qt 3D GeometryLoaders: Autodesk FBX ........................... no Qt Wayland Client ........................ no Qt Wayland Compositor .................... no Qt Bluetooth: BlueZ .................................. no BlueZ Low Energy ....................... no Linux Crypto API ....................... no WinRT Bluetooth API (desktop & UWP) .... no Qt Sensors: sensorfw ............................... no Qt Quick Controls 2: Styles ................................. Default Fusion Imagine Material Universal Qt Quick Templates 2: Hover support .......................... yes Multi-touch support .................... yes Qt Positioning: Gypsy GPS Daemon ....................... no WinRT Geolocation API .................. no Qt Location: Qt.labs.location experimental QML plugin . yes Geoservice plugins: OpenStreetMap ........................ yes HERE ................................. yes Esri ................................. yes Mapbox ............................... yes MapboxGL ............................. no Itemsoverlay ......................... yes QtXmlPatterns: XML schema support ..................... yes Qt Multimedia: ALSA ................................... no GStreamer 1.0 .......................... no GStreamer 0.10 ......................... no Video for Linux ........................ yes OpenAL ................................. no PulseAudio ............................. no Resource Policy (libresourceqt5) ....... no Windows Audio Services ................. no DirectShow ............................. no Windows Media Foundation ............... no Qt Tools: QDoc ................................... no Qt WebEngine: Embedded build ......................... yes Pepper Plugins ......................... no Printing and PDF ....................... no Proprietary Codecs ..................... no Spellchecker ........................... yes Native Spellchecker .................... no WebRTC ................................. no Use System Ninja ....................... no Geolocation ............................ yes WebChannel support ..................... yes Use v8 snapshot ........................ yes Kerberos Authentication ................ no Building v8 snapshot supported ......... yes Use ALSA ............................... no Use PulseAudio ......................... no Optional system libraries used: re2 .................................. no icu .................................. no libwebp, libwebpmux and libwebpdemux . no opus ................................. no ffmpeg ............................... no libvpx ............................... no snappy ............................... no glib ................................. no zlib ................................. yes minizip .............................. no libevent ............................. no jsoncpp .............................. no protobuf ............................. no libxml2 and libxslt .................. no lcms2 ................................ no png .................................. no JPEG ................................. no harfbuzz ............................. no freetype ............................. no x11 .................................. no Required system libraries: fontconfig ........................... no dbus ................................. no nss .................................. no khr .................................. no glibc ................................ yes Required system libraries for qpa-xcb: libdrm ............................... no xcomposite ........................... no xcursor .............................. no xi ................................... no xrandr ............................... no xtst ................................. no Note: Also available for Linux: linux-clang linux-icc

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值