[英]Apache2 mod_jk segfaults with OS X Mavericks
I upgraded to Mavericks just yesterday, and had to reinstall mod_jk for my development environment. 我昨天刚升级到Mavericks,不得不为我的开发环境重新安装mod_jk。 Compiling it from source was a bit of a pain.
从源代码编译它有点痛苦。 I found this page on a previously-asked question about mod_jk on OS X, but there were a couple extra hoops I had to jump through.
我在OS X上发现了一个关于mod_jk的先前问题的 这个页面 ,但是还有一些额外的箍我不得不跳过。 For some reason, apxs thinks that gcc lives at:
出于某种原因,apxs认为gcc生活在:
/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc
But that exact folder doesn't exist; 但是那个确切的文件夹不存在; I had to symlink the existing
XcodeDefault.xctoolchain
directory: 我不得不对现有的
XcodeDefault.xctoolchain
目录进行符号链接:
sudo ln -s XcodeDefault.xctoolchain/ OSX10.9.xctoolchain
Then I tried running configure: 然后我尝试运行configure:
./configure CFLAGS='-arch x86_64' APXSLDFLAGS='-arch x86_64' --with-apxs=/usr/sbin/apxs
However, configure failed because it couldn't find <stdio.h>
, so I symlinked the OS X 10.9 toolchain as so: 但是,配置失败,因为找不到
<stdio.h>
,所以我将OS X 10.9工具链符号链接为:
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/ /usr/include
I was able to then compile and install the module by running sudo make install -f Makefile.apxs
in the apache-2.0 subdirectory. 然后我可以通过在apache-2.0子目录中运行
sudo make install -f Makefile.apxs
来编译和安装模块。 However, when I started up Apache via sudo apachectl start
, it immediately crashes with a segfault: 但是,当我通过
sudo apachectl start
Apache sudo apachectl start
,它立即崩溃了一个段错误:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff875fb866 __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff8b8a435c pthread_kill + 92
2 libsystem_c.dylib 0x00007fff92480bba abort + 125
3 libsystem_c.dylib 0x00007fff92480d31 abort_report_np + 181
4 libsystem_c.dylib 0x00007fff924a48c5 __chk_fail + 48
5 libsystem_c.dylib 0x00007fff924a48d5 __chk_fail_overlap + 16
6 libsystem_c.dylib 0x00007fff924a4906 __chk_overlap + 49
7 libsystem_c.dylib 0x00007fff924a4ad1 __strcpy_chk + 64
8 mod_jk.so 0x0000000105a0c631 jk_map_get_int + 225
9 mod_jk.so 0x0000000105a1f7f1 jk_get_worker_maintain_time + 33
10 mod_jk.so 0x0000000105a17683 wc_open + 755
11 mod_jk.so 0x0000000105a2f13f init_jk + 1151
12 mod_jk.so 0x0000000105a28b7e jk_post_config + 1566
13 httpd 0x000000010568b7d5 ap_run_post_config + 133
14 httpd 0x00000001056947c7 main + 2567
15 libdyld.dylib 0x00007fff9176e5fd start + 1
Has anyone had success compiling/running mod_jk with Mavericks yet? 有没有人用小牛队成功编译/运行mod_jk了? Is there something I'm missing or not doing quite right?
有什么东西我缺少或做得不对吗?
The aforementioned bug reported against Tomcat has a proposed patch which is likely to be applied soon. 针对Tomcat报告的上述错误有一个建议的补丁,可能很快就会应用。 Feel free to use any of the patches described in that bug -- they will all work.
随意使用该bug中描述的任何补丁 - 它们都可以工作。
Download latest Tomcat Connectors source from tomcat.apache.org/download-connectors.cgi 从tomcat.apache.org/download-connectors.cgi下载最新的Tomcat Connectors源代码
Per https://issues.apache.org/bugzilla/show_bug.cgi?id=55696 change the method below in ./native/common/jk_maps.c to what you see here: 根据https://issues.apache.org/bugzilla/show_bug.cgi?id=55696将./native/common/jk_maps.c中的方法更改为您在此处看到的内容:
int jk_map_get_int(jk_map_t *m, const char *name, int def)
{
const char *rc;
int int_res;
rc = jk_map_get_string(m, name, NULL);
if(NULL == rc) {
int_res = def;
} else {
size_t len = strlen(rc);
int multit = 1;
if (len) {
char buf[100];
char *lastchar;
strncpy(buf, rc, 100);
lastchar = buf + len - 1;
if ('m' == *lastchar || 'M' == *lastchar) {
*lastchar = '\0';
multit = 1024 * 1024;
}
else if ('k' == *lastchar || 'K' == *lastchar) {
*lastchar = '\0';
multit = 1024;
}
int_res = multit * atoi(buf);
}
else
int_res = def;
}
return int_res;
}
Install command line tools 安装命令行工具
xcode-select --install xcode-select --install
Create missing symlink 创建缺少的符号链接
sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain
cd ./native cd ./native
./configure CFLAGS='-arch x86_64' APXSLDFLAGS='-arch x86_64' --with-apxs=/usr/sbin/apxs ./configure CFLAGS =' - arch x86_64'APXSLDFLAGS =' - arch x86_64' - with-apxs = / usr / sbin / apxs
chmod 755 scripts/build/instdso.sh chmod 755 scripts / build / instdso.sh
make 使
sudo make install sudo make install
WORKAROUND - NOT A SOLUTION 解决方法 - 不是解决方案
I am encountering the same thing and was unable to get mod_jk to run inside of Apache. 我遇到了同样的事情,无法让mod_jk在Apache内部运行。
As an alternative to simply get it to work locally and keep moving forward, I changed a few of the apache directives around to use mod_proxy_ajp instead. 作为一种替代方法,只需让它在本地工作并继续前进,我改变了一些apache指令,改为使用mod_proxy_ajp 。
LoadModule proxy_module libexec/apache2/mod_proxy.so
LoadModule proxy_ajp_module libexec/apache2/mod_proxy_ajp.so
ProxyPassMatch ^(/.*\.(jsp|json))$ ajp://localhost:8009/$1
ProxyPass /aircharge ajp://localhost:8009/aircharge
...
Since the AJP protocol is still being used, the same connector for Tomcat can be used without modification. 由于仍在使用AJP协议,因此可以使用相同的Tomcat连接器而无需修改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.