linux使用wkhtmltopdf报错error while loading shared libraries:

简介: 官网提示 linux需要这些动态库。depends on: zlib, fontconfig, freetype, X11 libs (libX11, libXext, libXrender) 在linux上执行 ./wkhtmltopdf –page-size A4 www.baidu.com pdf.pdf 报错   error while loading shared libra
官网提示 linux需要这些动态库。depends on: zlib, fontconfig, freetype, X11 libs (libX11, libXext, libXrender)

在linux上执行

./wkhtmltopdf –page-size A4 www.baidu.com pdf.pdf 报错

 

error while loading shared libraries: libXrender.so.1

root@mag-sit:/home/mag-sit/wkhtmltox/bin# ./wkhtmltopdf –page-size A4 www.baidu.com pdf.pdf
./wkhtmltopdf: error while loading shared libraries: libXrender.so.1: cannot open shared object file: No such file or directory
root@mag-sit:/home/mag-sit/wkhtmltox/bin# cd /usr/lib/
root@mag-sit:/usr/lib# ls
accountsservice    docker.io         gnupg            language-selector   libcwidget.so.3               libisccc.so.90       liblwres.so.90       linux-boot-probes  openssh    policykit-1  rsyslog              systemd                  update-notifier
apt                dpkg              grub             libau.so            libcwidget.so.3.0.0           libisccc.so.90.0.6   liblwres.so.90.0.7   locale             os-prober  pppd         sasl2                tar                      upstart
byobu              eject             grub-legacy      libau.so.2          libdns.so.100                 libisccfg.so.90      libperl.so.5.18      man-db             os-probes  pt_chown     sftp-server          tasksel                  valgrind
command-not-found  gcc               initramfs-tools  libau.so.2.7        libdns.so.100.2.2             libisccfg.so.90.1.0  libperl.so.5.18.2    memtest86+         perl       python2.7    software-properties  tc                       w3m
coreutils          girepository-1.0  insserv          libbind9.so.90      libgirepository-1.0.so.1      libisc.so.95         libxapian.so.22      mime               perl5      python3      ssl                  tmpfiles.d               x86_64-linux-gnu
dbus-1.0           git-core          klibc            libbind9.so.90.0.9  libgirepository-1.0.so.1.0.0  libisc.so.95.5.0     libxapian.so.22.6.3  mysql              pm-utils   python3.4    sudo                 ubuntu-release-upgrader
root@mag-sit:/usr/lib# ^C
root@mag-sit:/usr/lib# apt-get install libXrender*
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libxrender1' for regex 'libXrender*'
Note, selecting 'libxrender1-dbg' for regex 'libXrender*'
Note, selecting 'libxrender-dev' for regex 'libXrender*'
The following extra packages will be installed:
  libpthread-stubs0-dev libx11-dev libx11-doc libxau-dev libxcb1-dev
  libxdmcp-dev x11proto-core-dev x11proto-input-dev x11proto-kb-dev
  x11proto-render-dev xorg-sgml-doctools xtrans-dev
Suggested packages:
  libxcb-doc
The following NEW packages will be installed:
  libpthread-stubs0-dev libx11-dev libx11-doc libxau-dev libxcb1-dev
  libxdmcp-dev libxrender-dev libxrender1 libxrender1-dbg x11proto-core-dev
  x11proto-input-dev x11proto-kb-dev x11proto-render-dev xorg-sgml-doctools
  xtrans-dev
0 upgraded, 15 newly installed, 0 to remove and 121 not upgraded.
Need to get 3,510 kB of archives.
After this operation, 17.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main libxrender1 amd64 1:0.9.8-1build0.14.04.1 [17.9 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/main libpthread-stubs0-dev amd64 0.3-4 [4,068 B]
Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty/main xorg-sgml-doctools all 1:1.11-1 [12.9 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main x11proto-core-dev all 7.0.26-1~ubuntu2 [700 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu/ trusty/main libxau-dev amd64 1:1.0.8-1 [11.1 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu/ trusty/main libxdmcp-dev amd64 1:1.1.1-1 [26.9 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu/ trusty/main x11proto-input-dev all 2.3-1 [139 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu/ trusty/main x11proto-kb-dev all 1.0.6-2 [269 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main xtrans-dev all 1.3.5-1~ubuntu14.04.1 [70.3 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu/ trusty/main libxcb1-dev amd64 1.10-2ubuntu1 [76.6 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu/ trusty/main libx11-dev amd64 2:1.6.2-1ubuntu2 [629 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu/ trusty/main libx11-doc all 2:1.6.2-1ubuntu2 [1,448 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu/ trusty/main x11proto-render-dev all 2:0.11.1-2 [20.1 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main libxrender-dev amd64 1:0.9.8-1build0.14.04.1 [23.8 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main libxrender1-dbg amd64 1:0.9.8-1build0.14.04.1 [62.4 kB]
Fetched 3,510 kB in 6min 22s (9,173 B/s)                                       
Selecting previously unselected package libxrender1:amd64.
(Reading database ... 60309 files and directories currently installed.)
Preparing to unpack .../libxrender1_1%3a0.9.8-1build0.14.04.1_amd64.deb ...
Unpacking libxrender1:amd64 (1:0.9.8-1build0.14.04.1) ...
Selecting previously unselected package libpthread-stubs0-dev:amd64.
Preparing to unpack .../libpthread-stubs0-dev_0.3-4_amd64.deb ...
Unpacking libpthread-stubs0-dev:amd64 (0.3-4) ...
Selecting previously unselected package xorg-sgml-doctools.
Preparing to unpack .../xorg-sgml-doctools_1%3a1.11-1_all.deb ...
Unpacking xorg-sgml-doctools (1:1.11-1) ...
Selecting previously unselected package x11proto-core-dev.
Preparing to unpack .../x11proto-core-dev_7.0.26-1~ubuntu2_all.deb ...
Unpacking x11proto-core-dev (7.0.26-1~ubuntu2) ...
Selecting previously unselected package libxau-dev:amd64.
Preparing to unpack .../libxau-dev_1%3a1.0.8-1_amd64.deb ...
Unpacking libxau-dev:amd64 (1:1.0.8-1) ...
Selecting previously unselected package libxdmcp-dev:amd64.
Preparing to unpack .../libxdmcp-dev_1%3a1.1.1-1_amd64.deb ...
Unpacking libxdmcp-dev:amd64 (1:1.1.1-1) ...
Selecting previously unselected package x11proto-input-dev.
Preparing to unpack .../x11proto-input-dev_2.3-1_all.deb ...
Unpacking x11proto-input-dev (2.3-1) ...
Selecting previously unselected package x11proto-kb-dev.
Preparing to unpack .../x11proto-kb-dev_1.0.6-2_all.deb ...
Unpacking x11proto-kb-dev (1.0.6-2) ...
Selecting previously unselected package xtrans-dev.
Preparing to unpack .../xtrans-dev_1.3.5-1~ubuntu14.04.1_all.deb ...
Unpacking xtrans-dev (1.3.5-1~ubuntu14.04.1) ...
Selecting previously unselected package libxcb1-dev:amd64.
Preparing to unpack .../libxcb1-dev_1.10-2ubuntu1_amd64.deb ...
Unpacking libxcb1-dev:amd64 (1.10-2ubuntu1) ...
Selecting previously unselected package libx11-dev:amd64.
Preparing to unpack .../libx11-dev_2%3a1.6.2-1ubuntu2_amd64.deb ...
Unpacking libx11-dev:amd64 (2:1.6.2-1ubuntu2) ...
Selecting previously unselected package libx11-doc.
Preparing to unpack .../libx11-doc_2%3a1.6.2-1ubuntu2_all.deb ...
Unpacking libx11-doc (2:1.6.2-1ubuntu2) ...
Selecting previously unselected package x11proto-render-dev.
Preparing to unpack .../x11proto-render-dev_2%3a0.11.1-2_all.deb ...
Unpacking x11proto-render-dev (2:0.11.1-2) ...
Selecting previously unselected package libxrender-dev:amd64.
Preparing to unpack .../libxrender-dev_1%3a0.9.8-1build0.14.04.1_amd64.deb ...
Unpacking libxrender-dev:amd64 (1:0.9.8-1build0.14.04.1) ...
Selecting previously unselected package libxrender1-dbg:amd64.
Preparing to unpack .../libxrender1-dbg_1%3a0.9.8-1build0.14.04.1_amd64.deb ...
Unpacking libxrender1-dbg:amd64 (1:0.9.8-1build0.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up libxrender1:amd64 (1:0.9.8-1build0.14.04.1) ...
Setting up libpthread-stubs0-dev:amd64 (0.3-4) ...
Setting up xorg-sgml-doctools (1:1.11-1) ...
Setting up x11proto-core-dev (7.0.26-1~ubuntu2) ...
Setting up libxau-dev:amd64 (1:1.0.8-1) ...
Setting up libxdmcp-dev:amd64 (1:1.1.1-1) ...
Setting up x11proto-input-dev (2.3-1) ...
Setting up x11proto-kb-dev (1.0.6-2) ...
Setting up xtrans-dev (1.3.5-1~ubuntu14.04.1) ...
Setting up libxcb1-dev:amd64 (1.10-2ubuntu1) ...
Setting up libx11-dev:amd64 (2:1.6.2-1ubuntu2) ...
Setting up libx11-doc (2:1.6.2-1ubuntu2) ...
Setting up x11proto-render-dev (2:0.11.1-2) ...
Setting up libxrender-dev:amd64 (1:0.9.8-1build0.14.04.1) ...
Setting up libxrender1-dbg:amd64 (1:0.9.8-1build0.14.04.1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
root@mag-sit:/usr/lib# ls
accountsservice    debug             git-core         klibc              libbind9.so.90.0.9        libgirepository-1.0.so.1.0.0  libisc.so.95.5.0    libxapian.so.22.6.3  mysql      pm-utils     python3.4            sudo        ubuntu-release-upgrader
apt                docker.io         gnupg            language-selector  libcwidget.so.3           libisccc.so.90                liblwres.so.90      linux-boot-probes    openssh    policykit-1  rsyslog              systemd     update-notifier
byobu              dpkg              grub             libau.so           libcwidget.so.3.0.0       libisccc.so.90.0.6            liblwres.so.90.0.7  locale               os-prober  pppd         sasl2                tar         upstart
command-not-found  eject             grub-legacy      libau.so.2         libdns.so.100             libisccfg.so.90               libperl.so.5.18     man-db               os-probes  pt_chown     sftp-server          tasksel     valgrind
coreutils          gcc               initramfs-tools  libau.so.2.7       libdns.so.100.2.2         libisccfg.so.90.1.0           libperl.so.5.18.2   memtest86+           perl       python2.7    software-properties  tc          w3m
dbus-1.0           girepository-1.0  insserv          libbind9.so.90     libgirepository-1.0.so.1  libisc.so.95                  libxapian.so.22     mime                 perl5      python3      ssl                  tmpfiles.d  x86_64-linux-gnu
root@mag-sit:/usr/lib# cd /home/mag-sit/
root@mag-sit:/home/mag-sit# ls
160526_rmFX73kM-1.sql  160526_rmFX73kM-4.sql  data_backup             jdk-7u80-linux-i586.gz  jeewx.war         sanpin              TeamAction_goAdd.jsp       tomcat.keystore          wkhtmltox
160526_rmFX73kM-2.sql  beauty.2016-09-24.log  filemgr-linux64.elf     jdk-7u80-linux-x64.gz   linux_amd64       SanpinAction.class  TeamAction_goAddOrder.jsp  TripDetailService.class  wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
160526_rmFX73kM-3.sql  beauty.log             filemgr-linux64.tar.gz  jeewx                   magvacations.war  tar                 test.java                  upload                   wp20161011.sql
root@mag-sit:/home/mag-sit# cd wkhtmltoxp
bash: cd: wkhtmltoxp: No such file or directory
root@mag-sit:/home/mag-sit# ls
160526_rmFX73kM-1.sql  160526_rmFX73kM-4.sql  data_backup             jdk-7u80-linux-i586.gz  jeewx.war         sanpin              TeamAction_goAdd.jsp       tomcat.keystore          wkhtmltox
160526_rmFX73kM-2.sql  beauty.2016-09-24.log  filemgr-linux64.elf     jdk-7u80-linux-x64.gz   linux_amd64       SanpinAction.class  TeamAction_goAddOrder.jsp  TripDetailService.class  wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
160526_rmFX73kM-3.sql  beauty.log             filemgr-linux64.tar.gz  jeewx                   magvacations.war  tar                 test.java                  upload                   wp20161011.sql
root@mag-sit:/home/mag-sit# cd wkhtmltox
root@mag-sit:/home/mag-sit/wkhtmltox# ls
bin  include  lib  share
root@mag-sit:/home/mag-sit/wkhtmltox# cd bin/
root@mag-sit:/home/mag-sit/wkhtmltox/bin# ls
wkhtmltoimage  wkhtmltopdf
root@mag-sit:/home/mag-sit/wkhtmltox/bin# ./wkhtmltopdf –page-size A4 www.baidu.com pdf.pdf
./wkhtmltopdf: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory
root@mag-sit:/home/mag-sit/wkhtmltox/bin# ^C
root@mag-sit:/home/mag-sit/wkhtmltox/bin# 

 安装完成后再次执行,上面的那条错误没有了。但是又有新的错误!继续安装

./wkhtmltopdf: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory

root@mag-sit:/home/mag-sit/wkhtmltox/bin# apt-get install libfontconfig*
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libfontconfig' for regex 'libfontconfig*'
Note, selecting 'libfontconfig1' for regex 'libfontconfig*'
Note, selecting 'libfontconfig-dev' for regex 'libfontconfig*'
Note, selecting 'libfontconfig1-dbg' for regex 'libfontconfig*'
Note, selecting 'libfontconfig1-dev' for regex 'libfontconfig*'
Note, selecting 'libfontconfig1' instead of 'libfontconfig'
Note, selecting 'libfontconfig1-dev' instead of 'libfontconfig-dev'
The following extra packages will be installed:
  binutils cpp cpp-4.8 fontconfig-config fonts-dejavu-core gcc gcc-4.8
  gcc-4.8-base libasan0 libatomic1 libc-dev-bin libc6 libc6-dev libcloog-isl4
  libexpat1 libexpat1-dev libfreetype6-dev libgcc-4.8-dev libgmp10 libgomp1
  libisl10 libitm1 libmpc3 libmpfr4 libpng12-dev libquadmath0 libstdc++6
  libtsan0 linux-libc-dev manpages-dev pkg-config zlib1g-dev
Suggested packages:
  binutils-doc cpp-doc gcc-4.8-locales gcc-multilib make autoconf automake1.9
  libtool flex bison gdb gcc-doc gcc-4.8-multilib gcc-4.8-doc libgcc1

 安装完成之后 貌似还得弄个字库  要不然生成的pdf乱码了 具体安装方法

 

目录
相关文章
|
3月前
|
存储 监控 安全
在Linux中,⼀个EXT3的文件分区,当使用touch test.file命令创建⼀个新文件时报错,报错的信息是提示磁盘已满,但是采用df -h命令查看磁盘大小时,只使用了,60%的磁盘空间,为什么会出现这个情况?
在Linux中,⼀个EXT3的文件分区,当使用touch test.file命令创建⼀个新文件时报错,报错的信息是提示磁盘已满,但是采用df -h命令查看磁盘大小时,只使用了,60%的磁盘空间,为什么会出现这个情况?
|
1月前
|
Ubuntu Linux Windows
linux 挂载硬盘报错 "mount: unknown filesystem type 'ntfs'"
【10月更文挑战第7天】在Linux系统中挂载硬盘时遇到“mount: unknown filesystem type 'ntfs'”错误,是因为Linux默认可能不支持NTFS文件系统。本文提供了解决方案:安装NTFS-3G软件包以支持NTFS,并检查内核是否已加载NTFS模块。对于Ubuntu/Debian系统,可使用`sudo apt-get install ntfs-3g`命令;对于CentOS/RHEL系统,则需先安装EPEL仓库再安装NTFS-3G。此外,还需确认硬盘设备名正确无误,并创建合适的挂载点目录。
323 2
|
2月前
|
消息中间件 分布式计算 Java
Linux环境下 java程序提交spark任务到Yarn报错
Linux环境下 java程序提交spark任务到Yarn报错
38 5
|
2月前
|
Oracle Java 关系型数据库
Linux下JDK环境的配置及 bash: /usr/local/java/bin/java: cannot execute binary file: exec format error问题的解决
如果遇到"exec format error"问题,文章建议先检查Linux操作系统是32位还是64位,并确保安装了与系统匹配的JDK版本。如果系统是64位的,但出现了错误,可能是因为下载了错误的JDK版本。文章提供了一个链接,指向Oracle官网上的JDK 17 Linux版本下载页面,并附有截图说明。
Linux下JDK环境的配置及 bash: /usr/local/java/bin/java: cannot execute binary file: exec format error问题的解决
|
2月前
|
Linux 编译器 开发工具
快速在linux上配置python3.x的环境以及可能报错的解决方案(python其它版本可同样方式安装)
这篇文章介绍了在Linux系统上配置Python 3.x环境的步骤,包括安装系统依赖、下载和解压Python源码、编译安装、修改环境变量,以及常见安装错误的解决方案。
89 1
|
3月前
|
Ubuntu Linux 编译器
在ubantu/linux系统出现parse error(语法错误)
本文讨论了在Ubuntu/Linux系统中遇到"parse error"(语法错误)的问题,并提供了将非声明语句移动到所有声明语句下方以解决该问题的解决方案。
在ubantu/linux系统出现parse error(语法错误)
|
3月前
|
Java Linux Shell
【Azure 应用服务】部署Jar到App Service for Linux,因启动命令路径配置错误而引起:( Application Error 问题
【Azure 应用服务】部署Jar到App Service for Linux,因启动命令路径配置错误而引起:( Application Error 问题
|
3月前
|
Oracle Java 关系型数据库
简单记录在Linux上安装JDK环境的步骤,以及解决运行Java程序时出现Error Could not find or load main class XXX问题
本文记录了在Linux系统上安装JDK环境的步骤,并提供了解决运行Java程序时出现的"Error Could not find or load main class XXX"问题的方案,主要是通过重新配置和刷新JDK环境变量来解决。
123 0
|
Ubuntu Linux iOS开发
Calibre的Linux安装error:libxcb-xinerama0及解决方法
Calibre的Linux安装error:libxcb-xinerama0及解决方法
1029 0
Calibre的Linux安装error:libxcb-xinerama0及解决方法
|
16天前
|
运维 安全 Linux
Linux中传输文件文件夹的10个scp命令
【10月更文挑战第18天】本文详细介绍了10种利用scp命令在Linux系统中进行文件传输的方法,涵盖基础文件传输、使用密钥认证、复制整个目录、从远程主机复制文件、同时传输多个文件和目录、保持文件权限、跨多台远程主机传输、指定端口及显示传输进度等场景,旨在帮助用户在不同情况下高效安全地完成文件传输任务。
112 5