【问题标题】:Compile nginx 1.8.1 with http_perl_module使用 http_perl_module 编译 nginx 1.8.1
【发布时间】:2016-02-02 20:27:32
【问题描述】:

我需要帮助在我的 Mac 上使用 perl_module 编译 nginx:

System Software Overview:

  System Version: OS X 10.11.1 (15B42)
  Kernel Version: Darwin 15.0.0
  Boot Volume: Macintosh HD
  Boot Mode: Normal
  Computer Name: Philipp
  User Name: XXXXXXX XXXXXXXX (philipp)
  Secure Virtual Memory: Enabled
  Time since boot: 4 days 22:46

我配置nginx用PCRE和PERL编译,即:

./configure --with-pcre=/Users/philipp/downloads/pcre-8.38 --with-http_perl_module --prefix=/servers/nginx 

配置状态的输出:

checking for perl
 + perl version: This is perl 5, version 18, subversion 2 (v5.18.2)
   built for darwin-thread-multi-2level
 + perl interpreter multiplicity found

如果我执行 make 我会遇到以下错误:

ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我google了一下,找到了export KERNEL_BITS=64的提示,没有解决问题。关于如何用 perl 编译 nginx 的任何建议。在没有 --with-http_perl_module 选项的情况下编译成功,但在这种情况下,我不能在 nginx.conf 中使用 perl(当然:))。

更新:

我无法用 perl 编译 nginx。我最终使用了一个预编译的包,这有点让人不满意,因为现在我必须处理很多我不喜欢的包。无论如何,如果有人有解决方案,我会很高兴知道。

【问题讨论】:

    标签: macos perl nginx compiler-errors


    【解决方案1】:

    我不确定这是否是题外话,但因为它是关于在nginx 中使用perl(我这样做,而且很棒)。

    我在尝试构建此模块时遇到了类似的问题。它的根源是我没有得到正确的 LD 标志。

    执行此操作的最简单方法 - IMO - 是从包中安装 nginx,运行 nginx -V 并查看使用了哪些标志 - 将它们全部复制并包含附加内容。 (并检查它还没有在你的发行版中构建 - 它在我的,我认为这是一个 Centos 7.2 包 - 我手头没有它,但我不确定它是否一定会有所帮助)

    您可能还需要安装一个新的perl 版本才能使用它。

    【讨论】:

    • 非常感谢您提供的信息。我使用自制软件安装了一个新的 perl 版本,但它只为我当前的用户安装它,即仅桶装(参见,例如,link)。即使我尝试链接它,它似乎仍然使用另一个 perl 版本。所以我仍然有同样的问题:(
    【解决方案2】:
     --with-pcre=../modules/pcre-8.38
     --with-openssl=../modules/openssl-1.0.2g
     --prefix=/usr/local/nginx
     --with-http_perl_module
     --with-http_ssl_module
     --with-http_addition_module
     --with-http_sub_module
     --with-http_realip_module
     --with-http_stub_status_module
     --with-cc-opt='-I /usr/local/include'
     --with-ld-opt='-L /usr/local/lib -L/usr/local/opt/perl518/lib'
    

    我遇到了同样的问题。经过大约3个小时的挖掘,终于解决了。这是我的配置文件,我安装了perl518brew 位于/usr/local/opt/perl518/lib,并使用最新版本的nginx 源代码nginx version: nginx/1.10.0

    事情似乎正如@Sobrique 所说的那样发生了,你需要给予正确的--with-ld-opt--with-cc-opt

    important,在./configure 之后,DO NOT 立即执行makevi ./objs/Makefile 并将openssl 配置从'./config' 修改为'./Configure darwin-x86_64-cc',以便它可以在x86_64 mod 中构建openssl。

    希望对你有帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-20
      • 2012-03-21
      • 1970-01-01
      • 2016-05-27
      • 2011-09-18
      • 1970-01-01
      • 2017-07-22
      • 2012-08-03
      相关资源
      最近更新 更多