解决方案 1(感谢 Apache 的 Jeff Trawick)

解决方案 1(感谢 Apache 的 Jeff Trawick)

我遇到一个问题,即 apache 无法找到在 apache 进程中加载​​的库(mod_wsgi)中引用的某些符号。

当我启动 apache 进程时,出现此错误。

root [zibal]% ./usr/local/apache2/bin/apachectl restart
httpd: Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf:
Cannot load /usr/local/apache2/modules/mod_wsgi.so into server: 

rtld:0712-001 Symbol ap_cleanup_scoreboard was referenced from module /usr/local/apache2/modules/mod_wsgi.so(), but a runtime definition of the symbol was not found.

rtld: 0712-001 Symbol ap_accept_lock_mech was referenced from module /usr/local/apache2/modules/mod_wsgi.so(), but a runtime definition of the symbol was not found

我将 nm 命令的输出粘贴在 apache 可执行文件上,这些符号似乎存在。

root [zibal]% nm ./usr/local/apache2/bin/httpd | grep  ap_accept_lock_mech
ap_accept_lock_mech  D   536880332
ap_accept_lock_mech  d   536900392           4
ap_accept_lock_mech:G879 -           0

root [zibal]% nm ./usr/local/apache2/bin/httpd | grep ap_cleanup_scoreboard
.ap_cleanup_scoreboard T   268613428         212
ap_cleanup_scoreboard D   536890068
ap_cleanup_scoreboard d   536890068          12
ap_cleanup_scoreboard d   536899972           4
ap_cleanup_scoreboard:F385 -        2976

请指导。

答案1

解决方案 1(感谢 Apache 的 Jeff Trawick)

将源 tar 包解压到目录中.....cd 进入该目录

找到文件 include/mpm_common.h

将 extern apr_lockmech_e ap_accept_lock_mech; 更改为 AP_DECLARE_DATA extern apr_lockmech_e ap_accept_lock_mech;

找到文件 include/scoreboard.h

将 apr_status_t ap_cleanup_scoreboard(void *d); 更改为 AP_DECLARE(apr_status_t) ap_cleanup_scoreboard(void *d);

然后发出以下命令 ./configure make

完成此步骤后,将在服务器目录中创建一个 httpd.exp 文件,并在当前目录中创建一个 httpd 文件

删除 httpd

编辑 server/httpd.exp 并为 ap_accept_lock_mech 添加一行

make make install (以 root 身份)

然后从 Source Tarball 构建 mod_wsgi 3.3

解决方案 2(感谢 Graham Dumpleton)

不要改变 Apache 代码中的任何内容。

进入 mod_wsgi.c 源代码并更改:

   /*
    * Cleanup the Apache scoreboard to ensure that any
    * shared memory segments or memory mapped files not
    * available to code in daemon processes.
    */

   ap_cleanup_scoreboard(0);

如果 0

   /*
    * Cleanup the Apache scoreboard to ensure that any
    * shared memory segments or memory mapped files not
    * available to code in daemon processes.
    */

   ap_cleanup_scoreboard(0);

万一

然后寻找:

如果!定义(AP_ACCEPT_MUTEX_TYPE)

sconfig->锁机制 = ap_accept_lock_mech;

别的

sconfig->锁机制 = APR_LOCK_DEFAULT;

万一

并将其更改为:

定义 AP_ACCEPT_MUTEX_TYPE 1

如果!定义(AP_ACCEPT_MUTEX_TYPE)

sconfig->锁机制 = ap_accept_lock_mech;

别的

sconfig->锁机制 = APR_LOCK_DEFAULT;

万一

然后构建 mod_wsgi

相关内容