Hello!
On Tue, Aug 20, 2013 at 3:54 AM, sharepadco wrote:
> This is our first post here - so let's just start by telling how great it is
> to use openresty :) We've been able to write a whole app very quickly, that
> we will hopefully open source soon.
>
I'm really looking forward to your opensourced apps powered by openresty! :)
> Then, we try to replace in nginx.conf the path with a cpath:
>
>> # lua_package_path './src/?.lua;;';
>> lua_package_cpath './build/spserver.a;;';
>
No, .a files are static archives that need to be statically linked
with your main programs (here, it is the "nginx" executable file).
You misread Mike Pall's answer. To quote his original words, "...link
the libmyluafiles.a library into your main program using -lmyluafiles"
You can link your spserver.a by running nginx or openresty's
./configure command like this (warning: untested):
./configure --with-ld-opt="-Wl,-E -L./build -lspserver" ...
And then try calling require() directly in your Lua code, without
configuring the lua_package_cpath directive (which is for loading DSO
only).
> But this does not work, from the error log:
>
>> runtime error: error loading module 'index' from file
>> './build/spserver.a':
>> dlopen(./build/spserver.a, 6): no suitable image found. Did find:
>> ./build/spserver.a: unknown file type
No wonder you're getting this error because you're trying to load
spserver.a as a DSO file.
Regards,
-agentzh