Hi all,
I've been trying to get to the bottom of why even a minimal PHP build (any 5.x or 7 release, or a fresh e.g. 7.0 branch checkout after buildconf) creates .a versions of all shared extensions in addition to .so modules.
I've narrowed it down to opcache:
$ ./configure --disable-all
...
checking whether to build shared libraries... yes
checking whether to build static libraries... no
versus
$ ./configure --disable-all --enable-opcache=shared
...
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
but I cannot figure out why this is happening (both on OS X and Ubuntu 14.04).
Is this intentional? Related to opcache's "can only be built shared" status? But why would that trigger static builds? Or is it a bug?
I've been wading through config.m4s, generated configures etc but still haven't found the reason; any pointers or explanations would be much appreciated!
Cheers,
David
Hi,
David Zuelke wrote:
Is this intentional? Related to opcache's "can only be built shared" status? But why would that trigger static builds? Or is it a bug?
While we're at it, why is Opcache still built as shared? Does something
prevent it being statically-linked?
Thanks.
--
Andrea Faulds
https://ajf.me/
Hi,
David Zuelke wrote:
Is this intentional? Related to opcache's "can only be built shared" status? But why would that trigger static builds? Or is it a bug?
While we're at it, why is Opcache still built as shared? Does something prevent it being statically-linked?
I remember something about PCRE and whether or not that's linked statically or not. Can't find it right now.
Either way, it'd be great if someone in-the-know could chime in on this matter ;)
David
Hi,
David Zuelke wrote:
Is this intentional? Related to opcache's "can only be built shared" status? But why would that trigger static builds? Or is it a bug?
While we're at it, why is Opcache still built as shared? Does something prevent it being statically-linked?
I remember something about PCRE and whether or not that's linked statically or not. Can't find it right now.
Either way, it'd be great if someone in-the-know could chime in on this matter ;)
Just a little bump... anyone got any idea here?
Thanks!
Hi,
David Zuelke wrote:
Is this intentional? Related to opcache's "can only be built shared" status? But why would that trigger static builds? Or is it a bug?
While we're at it, why is Opcache still built as shared? Does something prevent it being statically-linked?
I remember something about PCRE and whether or not that's linked statically or not. Can't find it right now.
Either way, it'd be great if someone in-the-know could chime in on this matter ;)
Just a little bump... anyone got any idea here?
Thanks!
And another bump... anyone from Zend maybe?
Morning David,
To confirm it was something to do with opcache, I removed opcache from
the source tree:
krakjoe@fiji:/usr/src/php-src$ ./configure --disable-all | grep static
checking if cc static flag -static works... yes
checking whether to build static libraries... yes
That's pretty strange, it doesn't seem connected to opcache, at least
on my os (ubuntu).
So I try this, still no opcache in tree:
krakjoe@fiji:/usr/src/php-src$ ./configure --disable-all
--disable-static | grep static
checking if cc static flag -static works... yes
checking whether to build static libraries... yes
So I dig around in configure ... and find this:
enable_shared=yes
enable_static=yes
case $php_sapi_module in
shared)
enable_static=no
case $with_pic in
yes)
standard_libtool_flag='-prefer-pic'
;;
no)
standard_libtool_flag='-prefer-non-pic'
;;
esac
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -avoid-version -module"
;;
*)
standard_libtool_flag='-prefer-non-pic -static'
if test -z "$PHP_MODULES" && test -z "$PHP_ZEND_EX"; then
enable_shared=no
fi
;;
esac
Unconditionally setting enable_static here makes --enable-static be
ignored.
Over to someone else who understands why this is the case ...
Cheers
Joe
Hi,
David Zuelke wrote:
Is this intentional? Related to opcache's "can only be built shared"
status? But why would that trigger static builds? Or is it a bug?While we're at it, why is Opcache still built as shared? Does
something prevent it being statically-linked?I remember something about PCRE and whether or not that's linked
statically or not. Can't find it right now.Either way, it'd be great if someone in-the-know could chime in on this
matter ;)Just a little bump... anyone got any idea here?
Thanks!
And another bump... anyone from Zend maybe?
While we're at it, why is Opcache still built as shared? Does
something
prevent it being statically-linked?
The reason for this is that opcache is no "PHP module" but a "Zend
Extension" and we simply don't have an initialization mechanism for
static Zend Extensions. Such a mechanism would require to create an
extension list, similar to the module list in main/internal_functions.c
from the build system (see configure.in and .win32/build/confutils.js)
and then invoke them somewhere around
zend_startup_extensions_mechanism(), zend_startup_extensions() and
zend_shutdown_extensions().
Should be quite straight forward to do (for somebody willing to dig into
both, autofoo and our Windows build system)
johannes