SWIG generated code fails to run on PHP 5.3.2 undefined symbol: zend_error_noreturn

旧城冷巷雨未停 提交于 2019-12-07 02:10:18

问题


I have a library that I have been using successfully with PHP 5.1.6 with the help of some wrapper code generated by SWIG (v1.3.40).

I have just upgraded to PHP 5.3.2 and I am seeing the following error:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/myLib_php.so' - /usr/lib/php/modules/myLib_php.so: undefined symbol: zend_error_noreturn in Unknown on line 0 

On investigation it appears that the wrapper code produced by SWIG (myLib_wrap.c) includes calls to the PHP function: zend_error_noreturn and that this function isn't available in PHP 5.3.2?

Has anyone seen this issue before? Things seem to work if I manually update the generated code so that instead of calling zend_error_noreturn it just calls zend_error. Is this approach safe?


回答1:


PHP had a change recently that only defined the zend_error_noreturn symbol as a symbol alias for zend_error if building with GCC version 3 or greater, whereas previously it had also defined the symbol if using GCC 2.

The symbol alias is just an optimisation attempt in PHP that offers no benefit whatsoever, and it should really have been dropped by whoever had revisited that part of the engine recently. In other build cases it's just #defined as zend_error.

Replacing zend_error_noreturn calls by zend_error is safe.



来源:https://stackoverflow.com/questions/2556113/swig-generated-code-fails-to-run-on-php-5-3-2-undefined-symbol-zend-error-noret

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!