Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

php 7.4 gd requires libiconv #36

Open
glensc opened this issue Aug 1, 2019 · 5 comments
Open

php 7.4 gd requires libiconv #36

glensc opened this issue Aug 1, 2019 · 5 comments

Comments

@glensc
Copy link
Contributor

glensc commented Aug 1, 2019

/usr/lib/php/7.4/modules # php -m
PHP Warning:  PHP Startup: Unable to load dynamic library 'gd' (tried: /usr/lib/php/7.4/modules/gd (Error loading shared library /usr/lib/php/7.4/modules/gd: No such file or directory), /usr/lib/php/7.4/modules/gd.so (Error relocating /usr/lib/php/7.4/modules/gd.so: libiconv: symbol not found)) in Unknown on line 0

To reproduced:

$ docker run --rm -it phpearth/php:7.4-cli sh

/ # apk add php7.4-gd
/ # php -m|grep -i gd
PHP Warning:  PHP Startup: Unable to load dynamic library 'gd' (tried: /usr/lib/php/7.4/modules/gd (Error loading shared library /usr/lib/php/7.4/modules/gd: No such file or directory), /usr/lib/php/7.4/modules/gd.so (Error relocating /usr/lib/php/7.4/modules/gd.so: libiconv: symbol not found)) in Unknown on line 0
/ #

cc @petk

@glensc
Copy link
Contributor Author

glensc commented Aug 13, 2019

gnu-libiconv is installed:

/ # apk list --installed|grep libiconv
gnu-libiconv-1.15-r101 x86_64 {gnu-libiconv} (LGPL) [installed]
/ #

ldd can't also load:

/ # ldd /usr/lib/php/7.4/modules/gd.so 2>&1 |grep iconv
Error relocating /usr/lib/php/7.4/modules/gd.so: libiconv: symbol not found
Error relocating /usr/lib/php/7.4/modules/gd.so: libiconv_open: symbol not found
Error relocating /usr/lib/php/7.4/modules/gd.so: libiconv_close: symbol not found
/ #

so it's missing -liconv when at link stage:

/ # apk add binutils
OK: 51 MiB in 78 packages
/ # objdump -p /usr/lib/php/7.4/modules/gd.so|grep NEEDED
  NEEDED               libz.so.1
  NEEDED               libpng16.so.16
  NEEDED               libwebp.so.7
  NEEDED               libjpeg.so.8
  NEEDED               libXpm.so.4
  NEEDED               libfreetype.so.6
  NEEDED               libc.musl-x86_64.so.1
/ #

@RodzynDev
Copy link

So, how to install missing libs to use gd extension? @glensc

@glensc
Copy link
Contributor Author

glensc commented Jun 28, 2020

@RodzynBWA I have not solved this problem. I just stopped using this project, it is unmaintained.

@mclueppers
Copy link

If you try to build packages for Alpine 3.12 the solution is to not use the embedded libgd library.

# apk add libgd
# ./configure \
...
--with-external-gd
...

# php -i | grep gd
/build $ php -i | grep gd
Configure Command =>  './configure'  '--build=x86_64-alpine-linux-musl' '--host=x86_64-alpine-linux-musl' '--prefix=/usr' '--program-suffix=7.4' '--libdir=/usr/lib/php/7.4' '--includedir=/usr/include/php/7.4' '--datadir=/usr/share/php/7.4' '--localstatedir=/var' '--with-layout=GNU' '--sysconfdir=/etc/php/7.4' '--with-config-file-path=/etc/php/7.4' '--with-config-file-scan-dir=/etc/php/7.4/conf.d' '--with-pic' '--with-pear=/usr/share/php/7.4' '--disable-short-tags' '--enable-bcmath=shared' '--with-bz2=shared' '--enable-calendar=shared' '--enable-ctype=shared' '--with-curl=shared' '--enable-dba=shared' '--with-db4' '--with-dbmaker=shared' '--with-gdbm' '--enable-dom=shared' '--enable-exif=shared' '--enable-fileinfo=shared' '--enable-ftp=shared' '--enable-gd=shared' '--with-freetype' '--disable-gd-jis-conv' '--with-jpeg' '--with-webp' '--with-xpm' '--with-external-gd' '--with-gettext=shared' '--with-gmp=shared' '--with-iconv=shared' '--with-imap=shared' '--with-imap-ssl' '--enable-intl=shared' '--with-icu-dir=/usr' '--enable-json=shared' '--with-ldap=shared' '--with-ldap-sasl' '--with-libedit' '--enable-libxml' '--with-libxml-dir=/usr' '--enable-mbstring=shared' '--with-mysqli=shared,mysqlnd' '--with-mysql-sock=/run/mysqld/mysqld.sock' '--enable-mysqlnd=shared' '--enable-opcache=shared' '--with-openssl=shared' '--with-system-ciphers' '--with-kerberos' '--enable-pcntl=shared' '--with-pcre-regex=/usr' '--enable-pdo=shared' '--with-pdo-dblib=shared' '--with-pdo-mysql=shared,mysqlnd' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-pgsql=shared' '--with-pdo-sqlite=shared,/usr' '--with-pgsql=shared' '--enable-phar=shared' '--enable-posix=shared' '--with-pspell=shared' '--without-readline' '--enable-session=shared' '--enable-shmop=shared' '--enable-simplexml=shared' '--with-snmp=shared' '--enable-soap=shared' '--enable-sockets=shared' '--with-sodium=shared' '--with-password-argon2' '--with-sqlite3=shared,/usr' '--enable-sysvmsg=shared' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--with-tidy=shared' '--enable-tokenizer=shared' '--with-unixODBC=shared,/usr' '--enable-xml=shared' '--enable-xmlreader=shared' '--with-xmlrpc=shared' '--enable-xmlwriter=shared' '--with-xsl=shared' '--with-zip=shared' '--with-zlib=shared' '--enable-phpdbg' '--enable-phpdbg-webhelper' '--enable-fpm' '--with-fpm-user=www-data' '--with-fpm-group=www-data' '--enable-embed' 'build_alias=x86_64-alpine-linux-musl' 'host_alias=x86_64-alpine-linux-musl'
Additional .ini files parsed => /etc/php/7.4/conf.d/00_gd.ini
gd
gd.jpeg_ignore_warning => 1 => 1

# php -i
...
gd

GD Support => enabled
GD headers Version => 2.3.0
GD library Version => 2.3.0
FreeType Support => enabled
FreeType Linkage => with freetype
GIF Read Support => enabled
GIF Create Support => enabled
JPEG Support => enabled
PNG Support => enabled
WBMP Support => enabled
XPM Support => enabled
XBM Support => enabled
WebP Support => enabled
BMP Support => enabled
TGA Read Support => enabled

Directive => Local Value => Master Value
gd.jpeg_ignore_warning => 1 => 1
...

I hope it helps

@glensc
Copy link
Contributor Author

glensc commented Dec 9, 2020

You can probably just ditch this project and use packages from alpine own repositories:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants