个性化阅读
专注于IT技术分析

已解决:error: redefinition of ap_hack_apr_allocator_create

Apache Web Server源代码编译总是很有趣。

很少会在全新服务器上首次运行Apache时对其进行编译。

事实是, 这需要很多先决条件, 如果其中任何一个缺少或版本兼容性, 那么你可能必须花费大量时间来修复这些问题。

我正在使用全新的服务器Linux 6.4来安装Apache 2.4.6, 遇到以下错误。

exports.c:1929:
error: redefinition of 'ap_hack_apr_allocator_create'
exports.c:921: note: previous definition of 'ap_hack_apr_allocator_create' was here exports.c:1930:
error: redefinition of 'ap_hack_apr_allocator_destroy'
exports.c:922: note: previous definition of 'ap_hack_apr_allocator_destroy' was here exports.c:1931:
error: redefinition of 'ap_hack_apr_allocator_alloc' exports.c:923: note: previous definition of 'ap_hack_apr_allocator_alloc' was here exports.c:1932:
error: redefinition of 'ap_hack_apr_allocator_free' exports.c:924: note: previous definition of 'ap_hack_apr_allocator_free' was here exports.c:1933:
error: redefinition of 'ap_hack_apr_allocator_owner_set'
exports.c:925: note: previous definition of 'ap_hack_apr_allocator_owner_set' was here exports.c:1934:
error: redefinition of 'ap_hack_apr_allocator_owner_get' exports.c:926: note: previous definition of 'ap_hack_apr_allocator_owner_get' was here exports.c:1935:
error: redefinition of 'ap_hack_apr_allocator_max_free_set' exports.c:927: note: previous definition of 'ap_hack_apr_allocator_max_free_set' was here exports.c:1937:
error: redefinition of 'ap_hack_apr_allocator_mutex_set' exports.c:929: note: previous definition of 'ap_hack_apr_allocator_mutex_set' was here exports.c:1938:
error: redefinition of 'ap_hack_apr_allocator_mutex_get' exports.c:930: note: previous definition of 'ap_hack_apr_allocator_mutex_get' was here exports.c:1944:
error: redefinition of 'ap_hack_apr_atomic_init' exports.c:936: note: previous definition of 'ap_hack_apr_atomic_init' was here exports.c:1945:
error: redefinition of 'ap_hack_apr_atomic_read32' exports.c:937: note: previous definition of 'ap_hack_apr_atomic_read32' was here exports.c:1946:
error: redefinition of 'ap_hack_apr_atomic_set32' exports.c:938: note: previous definition of 'ap_hack_apr_atomic_set32' was here exports.c:1947:
error: redefinition of 'ap_hack_apr_atomic_add32' exports.c:939: note: previous definition of 'ap_hack_apr_atomic_add32' was here exports.c:1948:
error: redefinition of 'ap_hack_apr_atomic_sub32' exports.c:940: note: previous definition of 'ap_hack_apr_atomic_sub32' was here exports.c:1949:
error: redefinition of 'ap_hack_apr_atomic_inc32' exports.c:941: note: previous definition of 'ap_hack_apr_atomic_inc32' was here exports.c:1950:
error: redefinition of 'ap_hack_apr_atomic_dec32' exports.c:942: note: previous definition of 'ap_hack_apr_atomic_dec32' was here exports.c:1951:
error: redefinition of 'ap_hack_apr_atomic_cas32' exports.c:943: note: previous definition of 'ap_hack_apr_atomic_cas32' was here exports.c:1952:
error: redefinition of 'ap_hack_apr_atomic_xchg32' exports.c:944: note: previous definition of 'ap_hack_apr_atomic_xchg32' was here exports.c:1953:
error: redefinition of 'ap_hack_apr_atomic_casptr' exports.c:945: note: previous definition of 'ap_hack_apr_atomic_casptr' was here exports.c:1954:
error: redefinition of 'ap_hack_apr_atomic_xchgptr' exports.c:946: note: previous definition of 'ap_hack_apr_atomic_xchgptr' was here exports.c:1960:
error: redefinition of 'ap_hack_apr_dso_load' exports.c:1085: note: previous definition of 'ap_hack_apr_dso_load' was here exports.c:1961:
error: redefinition of 'ap_hack_apr_dso_unload' exports.c:1086: note: previous definition of 'ap_hack_apr_dso_unload' was here exports.c:1962:
error: redefinition of 'ap_hack_apr_dso_sym' exports.c:1087: note: previous definition of 'ap_hack_apr_dso_sym' was here exports.c:1963:
error: redefinition of 'ap_hack_apr_dso_error' exports.c:1088: note: previous definition of 'ap_hack_apr_dso_error' was here exports.c:1969:
error: redefinition of 'ap_hack_apr_env_get' exports.c:1094: note: previous definition of 'ap_hack_apr_env_get' was here exports.c:1970:
error: redefinition of 'ap_hack_apr_env_set' exports.c:1095: note: previous definition of 'ap_hack_apr_env_set' was here exports.c:1971:
error: redefinition of 'ap_hack_apr_env_delete' exports.c:1096: note: previous definition of 'ap_hack_apr_env_delete' was here exports.c:1976:
error: redefinition of 'ap_hack_apr_strerror' exports.c:1101: note: previous definition of 'ap_hack_apr_strerror' was here export.c:1981:
error: redefinition of 'ap_hack_apr_stat' exports.c:1106: note: previous definition of 'ap_hack_apr_stat' was here exports.c:1982:
error: redefinition of 'ap_hack_apr_dir_open' exports.c:1107: note: previous definition of 'ap_hack_apr_dir_open' was here exports.c:1983:
error: redefinition of 'ap_hack_apr_dir_close' exports.c:1108: note: previous definition of 'ap_hack_apr_dir_close' was here

如果你遇到类似的错误, 可以按照以下步骤进行修复。

在研究了各种参数之后, 我注意到当你的apr-util版本低于1.4.1时会发生这种情况

  • 验证你的apr-util版本。如果找到较低版本, 则必须安装1.4.1或更高版本
  • 从http://mirror.nus.edu.sg/apache/apr/下载apr-util源代码
  • 解压缩下载的文件

如下编译安装

./configure 
make 
make install

默认情况下, 它将安装在/ usr / local / apr / bin / apu-1-config下

现在, 你可以使用新安装的apr-util来压缩apache, 这应该没问题。

./configure --with-apr-util=/usr/local/apr/bin/apu-1-config

有帮助吗?

有兴趣了解更多信息吗?查看此完整的Apache HTTP Server在线课程。

赞(0)
未经允许不得转载:srcmini » 已解决:error: redefinition of ap_hack_apr_allocator_create

评论 抢沙发

评论前必须登录!