Opened 7 years ago

Last modified 3 years ago

#1463 accepted defect

Build in --builddir throws error on nginx.h

Reported by: asymetrixs@… Owned by:
Priority: blocker Milestone:
Component: nginx-core Version: 1.13.x
Keywords: builddir compile Cc:
uname -a: SunOS host 5.10 Generic_150401-50 i86pc i386 i86pc
nginx -V: nginx version: nginx/1.13.8 (i386-sun-solaris2.10) build by gcc .3.0 (GCC) build with OpenSSL 1.0.2k 26 Jan 2017 TLS SNI support enabled configure arguments: --build-i386-sun-solaris2.10 --prefix=/foo/bar --sbin-path=/foo/bar/bin/nginx --conf-path=/foo/bar/etc/nginx/nginx.conf --with-cc=/foo/bar/bin/gcc --with-cpp=/foo/bar/bin/cpp --with-ld-opt='-L /foo/bar/lib' --with-cc-opt='-I /foo/bar/include' --with-threads --with-stream_ssl_module --with-stream --with-stream_ssl_prepared_module --with-http_ssl_module --with-http_v2_module --with-http_addition_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-hhtp_degradation_module --with-http_slice_module --with-http_stub_satutus_module --with-http_perl_module --with-perl=/foo/bar/bin/perl --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --modules-path=/foo/bar/libexec/ngnx --lock-path=/var/run/nginx.lock --pid-path=/var/run/nginx.pid --builddir=/home/user/build

Description

When building with --builddir, an error is thrown during compilation.

> [...]
> Running Mkbootstrap for nginx ()
> chmod 644 "nginx.bs"
> "/foo/bar/perl5/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- nginx.bs blib/arch/auto/nginx/nginx.bs 644
> gmake[2]: *** No rule to make target `../../../../../src/core/nginx.h', needed by `nginx.c'. Stop.
> gmake[2]: Leaving directory `/home/user/build/src/http/modules/perl'
> gmake[1]: *** [/home/user/build//src/http/modules/perl/blib/arch/auto/nginx/nginx.so] Error 2
> gmake[1]: Leaving directory `/home/user/nginx-1.13.8'
> gmake: *** [build] Errror 2

gmake --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.

gcc --version
gcc (GCC) 5.3.0

cpp --version
cpp (GCC) 5.3.0

Change History (2)

comment:1 by Maxim Dounin, 7 years ago

Status: newaccepted

Seems to be a problem in the perl module, it only handles builddir in the nginx sources directory (so relative paths are the same as in default objs/). A quick and dirty fix would be (mostly untested):

diff --git a/auto/lib/perl/make b/auto/lib/perl/make
--- a/auto/lib/perl/make
+++ b/auto/lib/perl/make
@@ -39,6 +39,7 @@ cat << END                              
 			NGX_PM_LDFLAGS="$NGX_LD_OPT \$(NGX_PM_LDFLAGS)" \\
 			NGX_INCS="$CORE_INCS $NGX_OBJS $HTTP_INCS" \\
 			NGX_DEPS="\$(CORE_DEPS) \$(HTTP_DEPS)" \\
+			NGX_PWD="`pwd`" \\
 		$NGX_PERL Makefile.PL \\
 			LIB=$NGX_PERL_MODULES \\
 			INSTALLSITEMAN3DIR=$NGX_PERL_MODULES_MAN
diff --git a/src/http/modules/perl/Makefile.PL b/src/http/modules/perl/Makefile.PL
--- a/src/http/modules/perl/Makefile.PL
+++ b/src/http/modules/perl/Makefile.PL
@@ -19,12 +19,12 @@ WriteMakefile(
     LDDLFLAGS         => "$ENV{NGX_PM_LDFLAGS}",
 
     INC               => join(" ", map {
-                             m#^/# ? "-I $_" : "-I ../../../../../$_"
+                             m#^/# ? "-I $_" : "-I $ENV{NGX_PWD}/$_"
                          } (split /\s+/, $ENV{NGX_INCS})),
 
     depend => {
         'nginx.c'     => join(" ", map {
-                             m#^/# ? $_ : "../../../../../$_"
+                             m#^/# ? $_ : "$ENV{NGX_PWD}/$_"
                          } (split(/\s+/, $ENV{NGX_DEPS}),
                             "src/http/modules/perl/ngx_http_perl_module.h"))
     },

comment:2 by Maxim Dounin, 5 years ago

See also #1874.

Note: See TracTickets for help on using tickets.