Bug #74149 [Com]: SAPI application linking to PHP static library can't call zend_signal_startup()
| From: | l at p dot com | Date: | Fri, 19 May 2017 22:58:19 +0000 |
| Subject: | Bug #74149 [Com]: SAPI application linking to PHP static library can't call zend_signal_startup() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-209197@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74149&edit=1
ID: 74149
Comment by: l at p dot com
Reported by: sathya at laufers dot net
Summary: SAPI application linking to PHP static library can't
call zend_signal_startup()
Status: Closed
Type: Bug
Package: Compile Failure
Operating System: GNU/Linux
PHP Version: 7.1.2
Block user comment: N
Private report: N
New Comment:
wewef .i.
Previous Comments:
------------------------------------------------------------------------
[2017-03-09 07:44:55] krakjoe@php.net
Automatic comment on behalf of krakjoe
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8599ce4f18758d4aeff494366d884d4bb7dac2a2
Log: Fix bug #74149 static embed SAPI linkage error
------------------------------------------------------------------------
[2017-02-22 15:12:59] sathya at laufers dot net
Description:
------------
A C++ SAPI application linking to PHP 7.1 compiled as static embedded SAPI library can't
compile as the mandatory function "zend_signal_startup()" is not wrapped in 'extern
"C" {' and therefore not accessible. This is the same issue as in "Bug
#71041". I'm creating a new bug report, because Zend signals are now enabled by default
and even with disabling them using "--disable-zend-signals" it doesn't work (see
"additional remark").
Regarding the comment in the other bug report:
> The only place that this function should be called is in the SAPI layer, since all usable
> SAPI's are distributed with PHP, there doesn't seem to be a legitimate need to export the
> symbol.
I don't agree. Most people using the static embedded library to integrate PHP into their
programs will stumble upon this problem.
Additional remark:
Using the configure option "--disable-zend-signals" the program compiles but crashes with
signal 6 as "zend_signal_activate()" is still being called by
"php_request_startup()" - but with uninitialized variables:
#0 0x00007f25f672f428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1 0x00007f25f673102a in __GI_abort () at abort.c:89
#2 0x000000000044cb21 in Debug::safe_abort () at DeathHandler.cpp:387
#3 Debug::DeathHandler::HandleSignal (sig=<optimized out>, secret=0x7f25ef19c100) at
DeathHandler.cpp:573
#4 <signal handler called>
#5 0x000000000069c717 in memcpy (__len=1040, __src=0x12f2720 <global_orig_handlers>,
__dest=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/string3.h:53
#6 zend_signal_activate () at /usr/src/user/php-7.1.2/Zend/zend_signal.c:313
#7 0x000000000060309f in php_request_startup () at /usr/src/user/php-7.1.2/main/main.c:1640
Test script:
---------------
<?php
//Not applicable
?>
Expected result:
----------------
Successful linking of PHP 7.1 static embedded library.
Actual result:
--------------
Error during linking:
libscriptengine.a(libscriptengine_a-php_sapi.o): In function `php_xxx_init()':
xxx/php_sapi.cpp:1787: undefined reference to `zend_signal_startup()'
collect2: error: ld returned 1 exit status
make[2]: *** [xxx] Fehler 1
Makefile:635: die Regel für Ziel âxxxâ scheiterte
make[1]: *** [all-recursive] Fehler 1
make: *** [all] Fehler 2
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74149&edit=1