交叉编译poppler过程中遇到的坑(编译过程中混合cmake和make安装各种库)

本文只针对poppler-cpp部分。

编译poppler需要的库:libjpeg.so, libpng.so, libtiff.so, liblcms2.so, libopenjpeg.so,libfreetype.so, libfontconfig.so,libiconv.so基本就以上这些。

编译遇到以下问题:

/....../bin/ld: warning: libpng16.so.16, needed by /work/gcc-linaro-5.3.1-2016.05-i686_arm-linux-gnueabihf/arm-linux-gnueabihf/lib/libfontconfig.so.1, not found (try using -rpath or -rpath-link)
...
error....

在cmake的配置文件中加入如下

SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 
SET(CMAKE_INSTALL_RPATH "/xxxx/lib")

出现以下片段

原因是没有安装指定 freetype,jpeg,png库我重新安装了一下openjpeg库之后此问题得到解决。

出现以下片段:

原因:application程序库编译的时候是通过共享 1.5.30版本编译,但是链接到了1.6.38

解决方法:删除高版本库,重新编译openjpeg库(要链接到1.5.30库文件),然后再重新编译poppler库(注意查看配置信息链接到的库版本),之后重新编译demo程式。

若找不到 png.h 头文件可通过在 .cmake 文件中添加此变量

SET(PNG_PNG_INCLUDE_DIR "/xxxx/include/libpng15")
SET(CMAKE_SYSTEM_NAME "Linux")

set(CMAKE_FIND_ROOT_PATH /xxx/)
set(CMAKE_INSTALL_PREFIX /xxx/ CACHE PATH "Install path prefix,prepended onto install directories")

SET(CMAKE_C_COMPILER "/xxx/bin/arm-linux-gnueabihf-gcc")
SET(CMAKE_CXX_COMPILER "/xxx/bin/arm-linux-gnueabihf-g++")
SET(CMAKE_CXX_STANDARD 11)

include_directories(/xxx/include /xxx/include /usr/include)

link_directories(/xxx/lib)
link_directories(/xxx/xxx/lib)
link_directories(/xxx/libc/lib)
link_directories(xxx/lib)
set(CMAKE_LIBRARY_PATH "/xxx/lib" "/xxx/xxx/lib" "/xxx/libc")

SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 
SET(CMAKE_INSTALL_RPATH "/xxx/lib")

add_compile_options(-lpthread)
add_compile_options(-liconv)
add_compile_options(-lfreetype)
add_compile_options(-lpng)


option(ENABLE_XPDF_HEADERS "Install unsupported xpdf headers." OFF)
option(BUILD_GTK_TESTS "Whether compile the GTK+ test programs." OFF)
option(BUILD_QT5_TESTS "Whether compile the Qt5 test programs." OFF)
option(BUILD_CPP_TESTS "Whether compile the CPP test programs." OFF)
option(ENABLE_SPLASH "Build the Splash graphics backend." ON)
option(ENABLE_UTILS "Compile poppler command line utils." ON)
option(ENABLE_CPP "Compile poppler cpp wrapper." ON)
option(ENABLE_GLIB "Compile poppler glib wrapper." OFF)
option(ENABLE_GOBJECT_INTROSPECTION "Whether to generate GObject introspection." ON)
option(ENABLE_GTK_DOC "Whether to generate glib API documentation." OFF)
option(ENABLE_QT5 "Compile poppler qt5 wrapper." OFF)
set(ENABLE_LIBOPENJPEG "none" CACHE STRING " Use libopenjpeg for JPX streams. Possible values: openjpeg2, unmaintained, none. 'unmaintained' gives you the internal unmaintained decoder. Use at your own risk. 'none' compiles no JPX decoder at all. Default: openjpeg2")
set(ENABLE_CMS "lcms2" CACHE STRING "Use color management system. Possible values: lcms2, none. 'none' disables color management system.")
set(ENABLE_DCTDECODER "none" CACHE STRING "Use libjpeg for DCT streams. Possible values: libjpeg, unmaintained, none. will use libjpeg if available or fail if not. 'unmaintained' gives you the internal unmaintained decoder. Use at your own risk. 'none' compiles no DCT decoder at all. Default: libjpeg")
option(WITH_JPEG "Search for JPEG package" OFF)
option(WITH_NSS3 "Search for NSS3 package" OFF)
option(WITH_TIFF "Search for TIFF package" OFF)


option(ENABLE_LIBCURL "Build libcurl based HTTP support." OFF)
option(ENABLE_ZLIB "Build with zlib." OFF)
option(ENABLE_ZLIB_UNCOMPRESS "Use zlib to uncompress flate streams (not totally safe)." OFF)
option(SPLASH_CMYK "Include support for CMYK rasterization." OFF)
option(USE_FIXEDPOINT "Use fixed point arithmetic in the Splash backend" OFF)
option(USE_FLOAT "Use single precision arithmetic in the Splash backend" OFF)
option(BUILD_SHARED_LIBS "Build poppler as a shared library" ON)

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值