2010-03-03 56 views
0

我在FreeBSD上安裝了Apache 2的mod_mono,當Apache嘗試加載mod_mono.so模塊時,出現以下錯誤。如何在FreeBSD上找不到strndup時修復mod_mono的版本?

不能/usr/local/apache/modules/mod_mono.so 加載 到服務器: /usr/local/apache/modules/mod_mono.so: 未定義的符號 「strndup」

我爲Apache設置的前綴是/ usr/local/apache,我已經有了PHP和其他模塊。我發現在/ usr/include的roken.h中引用了strndup,並且我嘗試了以下添加來配置命令,但它不起作用。

--libdir =/usr/lib目錄--includedir =/usr/include目錄

我也試過......

--with-單PREFIX =/USR

我不知道接下來要做什麼。它似乎沒有mod_mono有很多構建選項。由於Mono和XSP都成功構建,我只需要mod_mono即可運行。

我欣賞任何提示,以使其工作。通過實現它

回答

0

添加strndup:

ifdef HAVE_CONFIG_H 
# include <config.h> 
#endif 
#if !_LIBC 
# include "strndup.h" 
#endif 

#include <stdlib.h> 
#include <string.h> 

#if !_LIBC 
# include "strnlen.h" 
# ifndef __strnlen 
# define __strnlen strnlen 
# endif 
#endif 

#undef __strndup 
#if _LIBC 
# undef strndup 
#endif 

#ifndef weak_alias 
# define __strndup strndup 
#endif 

char * 
__strndup (s, n) 
    const char *s; 
    size_t n; 
{ 
    size_t len = __strnlen (s, n); 
    char *new = malloc (len + 1); 

    if (new == NULL) 
    return NULL; 

    new[len] = '\0'; 
    return memcpy (new, s, len); 
} 
#ifdef libc_hidden_def 
libc_hidden_def (__strndup) 
#endif 
#ifdef weak_alias 
weak_alias (__strndup, strndup) 
#endif 
相關問題