vision5/ngx_devel_kit

Compilation issue with --with-http_perl_module

Closed this issue · 5 comments

There is an error when compiling with the embedded perl module for nginx.

The Makefile for perl doesn't include the paths for 3rd party modules, and thus doesn't know where to find ndk_config.h included in ngx_config.h

Embedded Perl doesn't have anything to do with the NDK. You might be including another module that requires the NDK, in which case you need to add -add-module=/path/to/ngx_devel_kit to your ./configure command. ndk_config.h is generated automatically when this is done.

Compiling does fail because by default when using --add-module=/path/to/ngx_devel_kit, it doesn't add that path to the Makefile used for the perl module (src/http/modules/perl/Makefile.PM) which is fairly different than the rest of the compilation process of nginx.

The sources for the perl module include ngx_config.h but don't know how to include ndk_config.h since it's not included in the path.

This is pretty easy to reproduce with a fresh install of nginx. Perl module is not recompiled every single time, so just doing another ./configure might not exhibit the problem if perl is already compiled. I found the issue while deploying.

This seems to fix the issue :

 --- tmp/tmpz_LC57-meld/src/http/modules/perl/Makefile.PL 
 +++ home/mtourne/Dev/nginx/src/http/modules/perl/Makefile.PL 
   @@ -22,6 +22,7 @@
                          "-I ../../../../../src/http/modules " .
                          "-I ../../../../../src/http/modules/perl " .
                          "-I ../../../../../$ENV{NGX_OBJS} " .
+                         "-I ../../../../../objs/addon/ndk/" .
                          ($ENV{NGX_PCRE} =~ /^(YES|NO)/ ? "" :
                              ($ENV{NGX_PCRE} =~ m#^/# ? "-I $ENV{NGX_PCRE} " :
                                   "-I ../../../../../$ENV{NGX_PCRE} ")),

Hi,

Sorry for the delay in responding. I've been away from the computer since my last message.

Ok, I see what you mean. I didn't realise the Perl Makefile was different. Thanks for giving more details.

Thanks for your patch. I think that that is probably the best way of fixing it, because the NDK can involve conditional patching of the base source code, so it needs to include <ndk_config.h> before all the other header files. I'll add this to the next version of the NDK, which I'll release soon.

Please let me know if you find any more issues.

Regards,

Marcus.

Hi,

Just wanted to let you know that the current version of the NDK doesn't have this issue because it no longer patches any of the core code.

Thanks again for letting me know about it.

Cheers,

Marcus.