configure: error: mod_so has been requested but cannot be built on your system 解決辦法

configure: error: mod_so has been requested but cannot be built on your system

openwrt 交叉編譯 apache ,
configure 添加 --enable-so 選項後報錯信息如下:

configure: error: mod_so has been requested but cannot be built on your system

原因分析 :
在編譯目錄查找打印上面錯誤的位置,grep “mod_so has been requested but cannot be built on your system” configure -n

httpd-2.4.28# grep "mod_so has been requested but cannot be built on your system" configure -n
13655:            as_fn_error $? "mod_so has been requested but cannot be built on your system" "$LINENO" 5

在 configure 文件的 第 13655 行:查看其上下文:

cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#include <apr.h>
#if APR_HAS_DSO
YES_IS_DEFINED
#endif

_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  $EGREP "YES_IS_DEFINED" >/dev/null 2>&1; then :
  ac_cv_define_APR_HAS_DSO=yes
else
  ac_cv_define_APR_HAS_DSO=no
fi
rm -f conftest*

CPPFLAGS=$apr_old_cppflags


case "x$enable_so" in
    "xyes")
        if test $ac_cv_define_APR_HAS_DSO = "no"; then
            as_fn_error $? "mod_so has been requested but cannot be built on your system" "$LINENO" 5
        fi
        ;;

可知 configure 腳本檢查了 APR_HAS_DSO 宏定義,沒有定義APR_HAS_DSO 時就會報以上錯誤,
APR_HAS_DSO 位於 apr.h 中,來自 libapr 。

檢查 libapr 的 編譯選項: 位於 openwrt\feeds\packages\libs\apr\Makefile

 CONFIGURE_ARGS += \
        --with-devrandom=/dev/urandom \
        --disable-dso \
        $(call autoconf_bool,CONFIG_IPV6,ipv6)

openwrt 編譯 libapr 時 開啓了 --disable-dso 導致 APR_HAS_DSO 宏未定義

解決辦法:
修改 openwrt\feeds\packages\libs\apr\Makefile , 把 --disable-dso 選項去掉

 CONFIGURE_ARGS += \
        --with-devrandom=/dev/urandom \       
        $(call autoconf_bool,CONFIG_IPV6,ipv6)

從新編譯libapr 後再編譯 apache

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章