[Linux] CentOS7에서 HTML to PDF 실행시 Error

/etc/centos-release:CentOS Linux release 7.6.1810 (Core) 

/etc/os-release:NAME="CentOS Linux"

/etc/os-release:VERSION="7 (Core)"

/etc/os-release:ID="centos"

/etc/os-release:ID_LIKE="rhel fedora"

/etc/os-release:VERSION_ID="7"

/etc/os-release:PRETTY_NAME="CentOS Linux 7 (Core)"

/etc/os-release:ANSI_COLOR="0;31"

/etc/os-release:CPE_NAME="cpe:/o:centos:centos:7"

/etc/os-release:HOME_URL="https://www.centos.org/"

/etc/os-release:BUG_REPORT_URL="https://bugs.centos.org/"

/etc/os-release:CENTOS_MANTISBT_PROJECT="CentOS-7"

/etc/os-release:CENTOS_MANTISBT_PROJECT_VERSION="7"

/etc/os-release:REDHAT_SUPPORT_PRODUCT="centos"

/etc/os-release:REDHAT_SUPPORT_PRODUCT_VERSION="7"

/etc/redhat-release:CentOS Linux release 7.6.1810 (Core) 

/etc/system-release:CentOS Linux release 7.6.1810 (Core) 


/usr/local/bin/wkhtmltopdf: error while loading shared libraries: libpng16.so.16: cannot open shared object file: No such file or directory



Fix error loading shared libraries: libpng16.so.16: cannot open shared object file

You can easily install libpng by building from source on a Linux system. I’ll be performing the installation to fix “error loading shared libraries: libpng16.so.16: cannot open shared object file” on a CentOS 7 system. But first we’ll need to install build tools.

# CentOS / Amazon Linux / Oracle Linux
sudo yum -y groupinstall "Development Tools"

# Ubuntu / Debian
sudo apt-get update
sudo apt-get install build-essential

Confirm make and gcc tools are installed.

$ gcc --version
gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-12)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ make --version
GNU Make 3.82
Built for x86_64-koji-linux-gnu
Copyright (C) 2010  Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Then download the latest release of libpng from sourceforge.

wget https://sourceforge.net/projects/libpng/files/libpng16/1.6.37/libpng-1.6.37.tar.gz

Extract the file once downloaded:

tar xvf libpng-1.6.37.tar.gz

Run the configure command inside the directory created after file extraction.

cd libpng-1.6.37/
./configure

Run make command after success in the previous command execution.

make

Finally install libpng library in your Linux system.

$ sudo make install

Here is my successful installation message.

....
make  install-data-hook
make[3]: Entering directory `/home/ec2-user/libpng-1.6.37'
+ cd /usr/local/include
+ for f in pnglibconf.h png.h pngconf.h
+ rm -f pnglibconf.h
+ ln -s libpng16/pnglibconf.h pnglibconf.h
+ for f in pnglibconf.h png.h pngconf.h
+ rm -f png.h
+ ln -s libpng16/png.h png.h
+ for f in pnglibconf.h png.h pngconf.h
+ rm -f pngconf.h
+ ln -s libpng16/pngconf.h pngconf.h
+ cd /usr/local/lib/pkgconfig
+ rm -f libpng.pc
+ ln -s libpng16.pc libpng.pc
make[3]: Leaving directory `/home/ec2-user/libpng-1.6.37'
make[2]: Leaving directory `/home/ec2-user/libpng-1.6.37'
make[1]: Leaving directory `/home/ec2-user/libpng-1.6.37'

After installation you should be able to locate libpng16.so.16 file.

$ sudo find / -name libpng16.so.16
/usr/local/lib/libpng16.so.16
/home/ec2-user/libpng-1.6.37/.libs/libpng16.so.16

You can then continue to build the application that depends on libpng library.

 

0
0
이 글을 페이스북으로 퍼가기 이 글을 트위터로 퍼가기 이 글을 카카오스토리로 퍼가기 이 글을 밴드로 퍼가기
captcha
자동등록방지 숫자입력

기타

번호 제목 글쓴이 날짜 조회수
73 [시간] 시간과 관련한 정보가 필요하면 최고관리자 09-18 1,458
72 [Docker compose] Can not find a suitable configuration 에러 원인 최고관리자 09-15 1,483
71 [Docker] CentOS 7 에 Docker를 설치해 보자. 최고관리자 09-14 2,160
70 [소스 컴파일] 컴파일관련 용어를 살펴보자. 최고관리자 09-13 1,610
69 [PHP] 언어 최고관리자 08-18 989
68 [관심] 개발을 오래한 사람이면 공감되는 내용이 많을 것입니다. 최고관리자 08-18 804
67 [VS] code-server를 통해 어디에서든 PC환경으로 개발하자 최고관리자 08-18 775
66 [Mac] Capture Screen Image 폴더 지정 하기 최고관리자 08-02 837
65 [IntelliJ] 여러파일의 이름을 한번에 바꾸는 Plugin 최고관리자 07-29 1,636
64 [모니터] 용도/크기/화질 천차만별! 나한테 맞는 모니터 고르는 법! 최고관리자 07-23 785
63 윈도우 hosts 파일 수정 최고관리자 05-09 977
62 [HTML] image map을 활용한 영역클릭 최고관리자 04-27 879
61 [Linux] CentOS 7에서의 gcc upgrade 최고관리자 08-28 2,772
60 [Linux] wkhtmltopdf error가 해결되지 않을 경우 확인 최고관리자 08-27 1,566
59 [Linux] CentOS7에서 HTML to PDF 실행시 Error 최고관리자 08-27 2,331
58 [Linux] Html to PDF 설치하기 최고관리자 08-27 1,643
57 [Linus] RPM 패키지 관리를 위한 DNF 명령 최고관리자 08-27 1,234
56 [Intellij] 노란줄 Found duplicated code in 해결방법 최고관리자 08-26 1,458
55 [Linux] CentOS sendmail 설치 및 테스트 최고관리자 08-18 3,038
54 [Linux] Console에서 메일보내기 테스트시 EOF(EOT)입력은 어떻게?? 최고관리자 08-18 1,448