|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-11-10 18:46 UTC] basant dot kukreja at gmail dot com
Description: ------------ On Fedora 11, by default gcc uses "-fvisibility=hidden", When we compile it for Sun Web Server using following configure options, php compiles fine. './configure' '--with-nsapi=<server_path>' '--with-zlib' '--prefix=/usr/local' But when we start the web server, we get the following error : failure: CORE2253: Error running Init function load-modules: dlsym for php5_init failed (<path>/lib/libphp5.so: undefined symbol: php5_init) failure: server initialization failed Expected result: ---------------- Server should be able to load php correctly. Actual result: -------------- Sun Web Server fails to start because of unexported symbols. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 08:00:01 2025 UTC |
Here is the snipp from gcc man page : <man gcc> " -fvisibility=default|internal|hidden|protected ... For those adding visibility support to existing code, you may find #pragma GCC visibility of use. This works by you enclosing the declarations you wish to set visibility for with (for example) #pragma GCC visibility push(hidden) and #pragma GCC visibility pop. ... " Pusing default visibility before including nsapi.h (and popping after) would help in compiling and loading php correctly with nsapi servers. Here is the patch against recent php 5.3 svn -------------------------------------------- Index: sapi/nsapi/nsapi.c =================================================================== --- sapi/nsapi/nsapi.c (revision 290447) +++ sapi/nsapi/nsapi.c (working copy) @@ -66,7 +66,9 @@ /* * NSAPI includes */ +#pragma GCC visibility push(default) #include "nsapi.h" +#pragma GCC visibility pop #define NSLS_D struct nsapi_request_context *request_context #define NSLS_DC , NSLS_D --------------------------------------------Thanks Jani for your suggestion. Based on your suggestion, I have revised the patch. Here is the new patch : --------------------------------------------- Index: sapi/nsapi/nsapi.c =================================================================== --- sapi/nsapi/nsapi.c (revision 290447) +++ sapi/nsapi/nsapi.c (working copy) @@ -67,6 +67,11 @@ * NSAPI includes */ #include "nsapi.h" +/* fix for gcc4 visibility issue */ +#ifndef PHP_WIN32 +# undef NSAPI_PUBLIC +# define NSAPI_PUBLIC PHPAPI +#endif #define NSLS_D struct nsapi_request_context *request_context #define NSLS_DC , NSLS_D ------------------------------------------- With this patch, when I preprocess the file, on linux I get following for php5_init : int __attribute__ ((visibility("default"))) php5_init(pblock *pb, Session *sn, Request *rq) ------------------------------------------- The above correctly export the symbols.