> On 25 Feb 2016, at 05:55, Yichun Zhang (agentzh) <age...@gmail.com> wrote:
>
> Hello!
>
> On Mon, Feb 22, 2016 at 6:01 AM, Andrei Belov wrote:
>>
>>
>> I also realized that in case when there is no ngx_devel_kit at ngx-lua compile time, the "set_by_lua" and "set_by_lua_file" directives will be unavailable.
>>
>
> Yeah, these directives as well as the ndk.set_var.* Lua API depend on
> NDK. These features are gone when you build ngx_lua without NDK.
Thanks for confirming this.
>
>> I'm trying to understand whether it's possible to convert ngx_devel_kit to a dynamic module - but from what I see, it does not make sense due to compile-time dependency.
>>
>
> Well, patches welcome :) I think it's technically possible.
I was able to build latest nginx with ngx_devel_kit and lua-nginx-module dynamically (both from current github heads) with the following patch:
https://github.com/simpl/ngx_devel_kit/pull/11
ndk_http_module.so provides enough set of needed symbols:
$ nm ndk_http_module.so | fgrep ndk_set
000000000000135b T ndk_set_var
000000000000181d t ndk_set_var_code
0000000000001330 T ndk_set_var_core
0000000000001450 t ndk_set_var_data_code
000000000000107d t ndk_set_var_filter_value
0000000000001378 t ndk_set_var_hash_code
000000000000176a T ndk_set_var_multi_value
00000000000019ca t ndk_set_var_multi_value_code
00000000000016e9 T ndk_set_var_multi_value_core
00000000000018ea t ndk_set_var_multi_value_data_code
0000000000000ef0 t ndk_set_var_name
00000000000017f0 T ndk_set_var_value
0000000000001b73 t ndk_set_var_value_code
000000000000178e T ndk_set_var_value_core
0000000000001aa4 t ndk_set_var_value_data_code
0000000000000ed0 t ndk_set_variable_value_space
so, ngx_http_lua_module.so includes "set_by_lua*" functions:
$ nm ngx_http_lua_module.so | fgrep set_by_lua
0000000000022eb6 T ngx_http_lua_filter_set_by_lua_file
0000000000022fbd T ngx_http_lua_filter_set_by_lua_inline
0000000000023170 T ngx_http_lua_set_by_lua
0000000000021f52 T ngx_http_lua_set_by_lua_block
0000000000023099 T ngx_http_lua_set_by_lua_file
0000000000022cde t ngx_http_lua_set_by_lua_init
I did it all successfully under CentOS 6.7. Previously, I spent some time trying to make it work under OS X (10.11.3) with luajit 2.0.4 from MacPorts, but had no luck due to extra flags introduced here:
https://github.com/openresty/lua-nginx-module/blob/master/config#L102
Disabling those flags allowed me to build .so objects without issues, but nginx was not able to start with the "failed to initialize Lua VM" error.
I suppose this is something you are aware of :) just shared my findings here.