building binaries with static objects
| From: | Andone, Bogdan | Date: | Mon, 16 Nov 2015 13:45:03 +0000 |
| Subject: | building binaries with static objects | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-89234@lists.php.net to get a copy of this message | ||
Hi guys,
Does anybody know why PHP sources are compiled as shared objects only on linux, meaning that libtool
is adding -fPIC -DPIC flags during compilation?
Shared objects are mandatory for building libphp7 library and module extensions, but why are they
used for building binaries like php-fpm, php-cgi or php?
I just observed that binaries built with static objects are ~1% quicker at runtime for real live
workloads like WordPress. Despite the fact that binary size is higher than the current version,
there is a visible gain in terms of reduction of instructions retired per request and iTLB loads and
misses..
I am wondering if it is possible to have static compilation enabled by default in the Makefile. I
managed to do it by brute force as I am not an expert in libtool and auto tools (I tried to play
with -enable-static flag but with no luck...). Not sure if current behavior is by intent or just a
miss; or what constraints have to be considered for portability reasons for other non linux
platforms.
Kind Regards,
Bogdan Andone