Skip to content

Commit 2014dd8

Browse files
committed
bugfix: ensured the 'pcre_version' symbol is preserved as undefined when PCRE is statically linked.
When using `--with-pcre=...`, NGINX is statically linked against libpcre.a. Since `pcre_version()` is unused, its symbol is stripped by the linker. Because lua-resty-core's `resty.core.regex` module needs it, we here ensure that the symbol is entered as undefined in our final binary. This should not be an issue for win32 builds since `--export-all-symbols` is already set.
1 parent 277d382 commit 2014dd8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

config

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,5 +588,27 @@ else
588588
CORE_LIBS="$CORE_LIBS $ngx_module_libs"
589589
fi
590590

591+
# ----------------------------------------
592+
593+
if [ $PCRE != NO -a $PCRE != YES ]; then
594+
# force pcre_version symbol to be undefined when PCRE is statically linked
595+
596+
ngx_feature="force undefined symbols (--undefined)"
597+
ngx_feature_libs="-Wl,--undefined=printf"
598+
ngx_feature_name=
599+
ngx_feature_run=no
600+
ngx_feature_incs="#include <stdio.h>"
601+
ngx_feature_path=
602+
ngx_feature_test='printf("hello");'
603+
604+
. auto/feature
605+
606+
if [ $ngx_found = yes ]; then
607+
CORE_LIBS="$CORE_LIBS -Wl,--undefined=pcre_version"
608+
fi
609+
fi
610+
611+
# ----------------------------------------
612+
591613
#CFLAGS=$"$CFLAGS -DLUA_DEFAULT_PATH='\"/usr/local/openresty/lualib/?.lua\"'"
592614
#CFLAGS=$"$CFLAGS -DLUA_DEFAULT_CPATH='\"/usr/local/openresty/lualib/?.so\"'"

0 commit comments

Comments
 (0)