Bug #74711 [Com]: wrong libraries linked to SAPI

From: Date: Thu, 08 Jun 2017 14:31:35 +0000
Subject: Bug #74711 [Com]: wrong libraries linked to SAPI
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209417@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74711&edit=1

 ID:                 74711
 Comment by:         spam2 at rhsoft dot net
 Reported by:        martijn at openbsd dot org
 Summary:            wrong libraries linked to SAPI
 Status:             Open
 Type:               Bug
 Package:            Dynamic loading
 Operating System:   OpenBSD (probably irrelevant)
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

"When building PHP with shared modules I found that php wouldn't startup any more when
removing one of the modules and dependencies of the system" - how is that a bug? when you
remove sharde libraries software is linked to you break that software

hence package managers was invited and when you try to remove such dependencies when you built PHP
as package it would suggest to remove PHP or just say "No"


Previous Comments:
------------------------------------------------------------------------
[2017-06-08 14:05:36] martijn at openbsd dot org

Description:
------------
When building PHP with shared modules I found that php wouldn't startup any more when removing
one of the modules and dependencies of the system (in this case ext/odbc).

This is because libiodbc is linked into the different SAPIs:
$ ldd ./php
./php:
        Start            End              Type Open Ref GrpRef Name
        00000a9e0f800000 00000a9e0ff02000 exe  2    0   0      ./php
        00000aa0c76d5000 00000aa0c7927000 rlib 0    1   0      /usr/local/lib/libiodbc.so.3.16
        00000aa0f976d000 00000aa0f997b000 rlib 0    4   0      /usr/lib/libpthread.so.23.0
        00000aa102095000 00000aa1023ab000 rlib 0    1   0      /usr/lib/libstdc++.so.57.0
        00000aa087c66000 00000aa087e8d000 rlib 0    3   0      /usr/lib/libm.so.10.0
        00000aa0e1e2e000 00000aa0e2044000 rlib 0    2   0      /usr/lib/libz.so.5.0
        00000aa03e983000 00000aa03ebc7000 rlib 0    1   0      /usr/local/lib/libpcre.so.3.0
        00000aa06c91f000 00000aa06cc81000 rlib 0    1   0      /usr/local/lib/libxml2.so.15.2
        00000aa0458a5000 00000aa045aca000 rlib 0    2   0      /usr/local/lib/liblzma.so.2.1
        00000aa089fd8000 00000aa08a2d7000 rlib 0    2   0      /usr/local/lib/libiconv.so.6.0
        00000aa0ec06b000 00000aa0ec2bd000 rlib 0    1   0      /usr/lib/libssl.so.43.3
        00000aa0fbff1000 00000aa0fc3bb000 rlib 0    2   0      /usr/lib/libcrypto.so.41.2
        00000aa0b473e000 00000aa0b4a0b000 rlib 0    1   0      /usr/lib/libc.so.89.5
        00000aa085600000 00000aa085600000 rtld 0    1   0      /usr/libexec/ld.so

I traced the problem via Makefile target BUILD_CLI which include EXTRA_LIBS, which has this extra
library added.

When looking around in the configure file I found that EXTRA_LIBS is a concatenation of $EXTRA_LIBS
$DLIBS $LIBS.
Adding some debugging found me that LIBS is the culprit in this case.

Continuing my search I found that LIBS is used in quite a few places throughout the m4 files and
that most of the time they save the value in a tempvar and restore it later, but I did find that the
PHP_ADD_LIBRARY macro in aclocal.m4 and acinclude.m4 contains LIBS as the 5th argument. This in my
opinion is the most likely cause for not unsetting LIBS.

I tried to change the name LIBS to BLAHLIBS, but that breaks the libxml checks.

Issue found in php 5.6.30, 7.0.19 and 7.1.5

Test script:
---------------
./configure --disable-rpath --disable-static --enable-inline-optimization --enable-shared
--program-suffix=-7.1 --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php-7.1
--with-pear=/usr/local/share/php-7.1 --with-pic --enable-filter --enable-hash
--enable-libxml=/usr/local --enable-session --with-mhash=/usr/local --with-openssl
--with-pcre-regex=/usr/local --with-zlib --with-apxs2=/usr/local/sbin/apxs2 --enable-cgi
--enable-cli --disable-phpdbg --enable-fpm --with-fpm-user=www --with-fpm-group=www
--enable-bcmath=shared --with-bz2=shared,/usr/local --enable-calendar=shared --enable-ctype=shared
--with-curl=shared,/usr/local --enable-dba=shared --with-gdbm=/usr/local --enable-dom=shared
--with-enchant=shared --enable-exif=shared --enable-fileinfo=shared --enable-ftp=shared
--with-gd=shared --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-zlib-dir=/usr
--with-freetype-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6 --with-gettext=shared,/usr/local
--with-gmp=s!
 hared,/usr/local --with-iconv=shared,/usr/local --with-imap=shared,/usr/local --with-imap-ssl
--enable-intl=shared --with-icu-dir=/usr/local --enable-json=shared --with-ldap=shared,/usr/local
--with-ldap-sasl=/usr/local --enable-mbstring=shared --with-onig=/usr/local
--with-mcrypt=shared,/usr/local --enable-mysqlnd=shared --with-mysqli=shared,mysqlnd
--with-iodbc=shared,/usr/local --enable-opcache --enable-pcntl=shared --enable-pdo=shared
--with-pdo-dblib=shared,/usr/local --with-pdo-mysql=shared,mysqlnd
--with-pdo-pgsql=shared,/usr/local --with-pdo-sqlite=shared,/usr/local
--with-pgsql=shared,/usr/local --enable-phar=shared --enable-posix=shared
--with-pspell=shared,/usr/local --with-readline=shared --enable-shmop=shared,/usr/local
--enable-simplexml=shared --with-snmp=shared,/usr/local --enable-soap=shared,/usr/local
--enable-sockets=shared --with-sqlite3=shared,/usr/local --enable-sysvmsg=shared
--enable-sysvsem=shared --enable-sysvshm=shared --with-tidy=shared,/usr/loca!
 l --enable-tokenizer=shared --enable-wddx=shared --enable-xml=!
 shared --enable-xmlreader=shared --with-xmlrpc=shared --enable-xmlwriter=shared --with-xsl=shared
--enable-zip=shared,/usr/local --prefix=/usr/local --sysconfdir=/etc --mandir=/usr/local/man
--infodir=/usr/local/info --localstatedir=/var --disable-silent-rules --disable-gtk-doc CFLAGS=-O2
-pipe -I/usr/local/include -pthread YACC=/usr/bin/yacc

make

ldd sapi/cli/php



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=74711&edit=1


Thread (3 messages)

« previous php.bugs (#209417) next »