I used the default luarocks in my ubuntu distro, "apt-get install luarocks".
Then I proceeded to install luasocket through luarocks: "luarocks install luasocket".
This compiled the C support libraries for luasocket into a shared library "/usr/local/lib/lua/5.1/socket/core.so". I verified this by running "gdb lua", running the lua interpreter, issuing the "require 'socket'" command, Ctrl+C and back in gdb "info sharedlibrary".
The core.so library is linked so that it contains unresolved symbols from the lua runtime, then whatever executable loads that .so, the loader looks for those lua runtime functions in the executable and binds them to the .so.
Then I proceeded to install luasocket through luarocks: "luarocks install luasocket".
This compiled the C support libraries for luasocket into a shared library "/usr/local/lib/lua/5.1/socket/core.so". I verified this by running "gdb lua", running the lua interpreter, issuing the "require 'socket'" command, Ctrl+C and back in gdb "info sharedlibrary".
The core.so library is linked so that it contains unresolved symbols from the lua runtime, then whatever executable loads that .so, the loader looks for those lua runtime functions in the executable and binds them to the .so.