tengine
tengine copied to clipboard
Failure to build when `/etc/resolv.conf` is missing (e.g. with Mock)
In general, the build is 100% failing when /etc/resolv.conf
is absent. See error below.
A specific way to reproduce this is to build a Tengine package with Mock.
Mock allows building RPMs in a clean environment. However, Tengine build fails because it relies on /etc/resolv.conf
and the
related define is not set because the file is not present:
In file included from src/core/ngx_core.h:55,
from src/core/ngx_resolver.c:9:
src/core/ngx_resolver.c: In function 'ngx_resolver_create':
src/core/ngx_resolver.c:283:41: error: 'NGX_RESOLVER_FILE' undeclared (first use in this function); did you mean 'T_NGX_RESOLVER_FILE'?
ngx_str_t default_file = ngx_string(NGX_RESOLVER_FILE);
^~~~~~~~~~~~~~~~~
src/core/ngx_string.h:40:38: note: in definition of macro 'ngx_string'
#define ngx_string(str) { sizeof(str) - 1, (u_char *) str }
^~~
src/core/ngx_resolver.c:283:41: note: each undeclared identifier is reported only once for each function it appears in
ngx_str_t default_file = ngx_string(NGX_RESOLVER_FILE);
^~~~~~~~~~~~~~~~~
src/core/ngx_string.h:40:38: note: in definition of macro 'ngx_string'
#define ngx_string(str) { sizeof(str) - 1, (u_char *) str }
^~~
How to reproduce it
- install
mock
in an RPM distro - attempt to build RPM for Tengine
- build always fails with error above because
/etc/resolv.conf
is not there, and thusNGX_RESOLVER_FILE
is undefined
Alternative way reproduce it
- Delete
/etc/resolve.conf
- attempt to build normally
- build fails same as above
PR with fixes will follow.