1

I need help compiling nginx with the perl_module on my Mac:

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

I configure nginx to be compiled with PCRE and PERL, i.e.,:

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

The output of the configure states:

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

If I execute make I run into the following error:

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

I googled and found a hint to export KERNEL_BITS=64, which did not solve the problem. Any suggestions on how to compile nginx with perl. The compilation succeeds without the --with-http_perl_module option, but in that case I cannot use perl in the nginx.conf (of course :)).

UPDATE:

I was not able to compile nginx with perl. I ended up using a pre-compiled package, which is kind of unsatisfying, because now I have to deal with a lot of packages I don't like. Anyways, if someone has a solution I'd be more than happy to know.

Philipp
  • 1,289
  • 1
  • 16
  • 37

2 Answers2

1

I'm not sure if this is offtopic or not, but as it's about using perl within nginx (which I do, and is awesome).

I had a similar problem when trying to build this module. The root of it was that I hadn't got the right LD flags.

The easiest way of doing this - IMO - is install nginx from a package, run nginx -V and see what flags were used - copy them all, and include the extras. (And check it wasn't already build in your distribution - it was in mine, which I think was a Centos 7.2 package - I don't have it to hand, but I'm not sure it would necessarily help)

You may also need to install a new perl version, to go with it though.

Sobrique
  • 52,974
  • 7
  • 60
  • 101
  • Thank you a lot for the information. I installed a new perl version using homebrew, but it only installs it for my current user, i.e., keg-only (see, e.g., [link](http://stackoverflow.com/questions/17015285/understand-homebrew-and-keg-only-dependencies)). Even if I try to link it, it still seems to use another perl version. So I'm still having the same problems :( – Philipp Feb 03 '16 at 22:32
0
 --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'

I got the same problem. after about 3 hours digging with this, finally solved. This is my configure file, i installed perl518 with brew located in /usr/local/opt/perl518/lib, and use the newest nginx source code of version nginx version: nginx/1.10.0.

Things seems happend as @Sobrique said, you need to give the right --with-ld-opt & --with-cc-opt.

important, after ./configure, DO NOT doing make immediately, vi ./objs/Makefile and modify openssl config from './config' to './Configure darwin-x86_64-cc' so that it can build openssl in x86_64 mod.

Hope it can help you!

xxmyjk
  • 1
  • 1