Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
I need someone who's more experienced in Linux than me.
I'd like to try making MCServer use the Lua library as a shared object, instead of linking it statically. However, I have no idea:
1, How to install the shared library
2, How to find the library's name
I have installed luarocks, which uses Lua and most definitely has the lua shared library somewhere, but how do I find it?
Thanks in advance.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
I have found out how luarocks work on linux in the meantime - the luarocks' shared libraries use symbols exported from the lua executable itself. The problem for MCServer is that it doesn't export those lua symbols by default, and the only way I found to export the lua symbols is to export *all* symbols. That, however, makes the executable quite large, among other things. Anyone know of a better solution? I need something like __declspec(dllexport) in MSVC; I've tried the __attribute__((visibility("default"))) but it doesn't seem to work.
Posts: 254
Threads: 16
Joined: Oct 2013
Thanks: 3
Given 20 thank(s) in 18 post(s)
I must be using a different version of luarocks than you, because there are no shared libs in the download I got. It just has scripts in it. Do you have a link to the version you are using?
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
12-03-2013, 02:51 AM
(This post was last modified: 12-03-2013, 02:51 AM by xoft.)
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.
Posts: 254
Threads: 16
Joined: Oct 2013
Thanks: 3
Given 20 thank(s) in 18 post(s)
ok. That makes more sense. So its luasocket that has the .so, not luarocks.
Posts: 4,628
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 post(s)
12-03-2013, 07:40 AM
(This post was last modified: 12-03-2013, 07:46 AM by NiLSPACE.)
I think you can use "-" to exclude things from the search. For example: "rdynamic -dynamic gcc"
I think you can even work with quotes.
Posts: 254
Threads: 16
Joined: Oct 2013
Thanks: 3
Given 20 thank(s) in 18 post(s)
"rdynamic" is available on Mac OSX