zoukankan      html  css  js  c++  java
  • mupdf arm 交叉编译记录

    老板催着要开发板上pdf转位图的库,mupdf看了一下应该合适,网上没有交叉编译的资料,可能是太简单了,这里做个mupdf交叉编译的记录。

    MuPDF is a Free and open source software library written in C that implements a PDF and XPS parsing and rendering engine. It is used primarily to render pages into bitmaps, but also provides support for other operations such as searching and listing the table of contents and hyperlinks.

    可以去官网http://mupdf.com/downloads/选择mupdf-*-source.tar.gz版本下载源码。

    将对应源码放在~/tmp目录下。解压,进入源码目录,看到源码下边有makefile和makerules,这里makefile是根据makerules来对源码进行配置和编译的。我们要交叉编译自然要设置交叉编译链。

    查看makerules如下:

    # Configuration for the Makefile
    
    OS ?= $(shell uname)
    OS := $(OS:MINGW%=MINGW)
    OS := $(OS:Windows_NT=MINGW)
    OS := $(OS:Darwin=MACOS)
    
    # The following section is an example of how to simply do cross-compilation
    # using these Makefiles. It builds for a beagleboard running ARM linux,
    # compiling on windows with the CodeSourcery G++ compilers.
    # Invoke this as:
    #      make OS=beagle-cross build=release
    # This does rely on the generated directory being populated with the cmap
    # files etc first. Either:
    #   1) do 'make generate' first (this relies on you having an appropriate host
    #   base C compiler set up - such as you would have on unix or in windows
    #   cygwin)
    #   2) do a non cross compile build (e.g. windows in MSVC) first.
    #   3) download the generated files from mupdf.com.
    
    ifeq "$(OS)" "beagle-cross"
    CC = arm-none-linux-gnueabi-gcc
    LD = arm-none-linux-gnueabi-gcc
    AR = arm-none-linux-gnueabi-ar
    CFLAGS += -O3 -mfpu=neon -mcpu=cortex-a8 -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant
    CROSSCOMPILE=yes
    endif

    这里开始通过OS的值来确定编译链,然后中见的注释部分提示了如何设置OS的值来编译mupdf的源码,这里可以看到我们要用的交叉编译链是arm-none-linux-gnueabi-*,但是我的编译链是arm-arago-linux-gnueabi-*,因此修改之,将ifeq "$(OS)" "beagle-cross" 下边的三个none全部改为改为arago即可。

    ifeq "$(OS)" "beagle-cross"
    CC = arm-arago-linux-gnueabi-gcc
    LD = arm-arago-linux-gnueabi-gcc
    AR = arm-arago-linux-gnueabi-ar

    执行

    make OS=beagle-cross build=release

    提示错误,重新看下makerules里边的注释,要求先执行make generate后,因此
    make generate
    make OS=beagle-cross build=release

    静等即可在./bulid/release目录下边看到编译好的libmupdf.a
  • 相关阅读:
    Java实现简单的图片浏览器
    ArrayList源码笔记
    JZ12 数值的整数次方算法笔记
    TCP的三次握手与四次挥手学习笔记
    Deepin安装LAMP环境
    Deepin安装Mysql(解决"没有可安装候选"问题)
    流行的Linux系统合集
    Win10超简单安装,菜鸡钊的装机经验分享
    Java入门(七)之面向对象-划重点
    Java入门(六)之常用的类
  • 原文地址:https://www.cnblogs.com/pang1567/p/4083740.html
Copyright © 2011-2022 走看看