I've compiled tgstation's implementation of an interface to boost::regex on a debian system, but I cannot get Byond to see the library, no matter where I place the .so file.
Detailed info -
repository for interface:https://github.com/optimumtact/byond-regex
Compilation steps for library
g++ -c -m32 -Wall -lstdc++ -lboost_regex -fPIC -o bygex.o main.cpp
g++ bygex.o -m32 -shared -o libbygex.so
I tested this by compiling client.cpp ( a test file )
g++ client.cpp -m32 -lstdc++ -lboost_regex -L. -lbygex
Outputted a.out file executed cleanly as I would expect
file correctly reports an elf32 binary, so the compilation steps seem fine
user@machine:~/byond-regex$ file libbygex.so
libbygex.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=4ab0775c871dc249cfade278951088551fc9e348, not stripped
The calling code uses a define, which I have set as
LIBREGEX_LIBRARY "bygex.so"
and the calls look similar too
call(LIBREGEX_LIBRARY, "regEx_compare")
However, when I place the libbygex.so in /usr/local/byond/bin and run DD with the following command it runtimes with an error about being unable to call it.
DreamDaemon tgstation.dmb 45000 -trusted -logself
Then in the log file
runtime error: Unable to load library bygex.so
proc name: replacetext (/proc/replacetext)
My first thought was to create a softlink to bygex.so from libbygex.so based on earlier threads I saw here about how byond loads .so's, but this approach had no luck, I then also tried to put the library in a local bin and set + export LD_LIBRARY_PATH, however this also met with zero success.
Is anyone able to shed any light on what the heck I'm doing wrong here?
You can grab the .so from here if it will help
http://www.xeon.pw/~francis/bygex.so
ID:1884648
Jun 28 2015, 4:07 pm
|
|
Place it alongside the DMB in question, and set
LIBREGEX_LIBRARY "bygex.so" Alternatively, place it within /usr/lib or such so it's on the ldpath. |
Tried your first suggestion, unfortunately no dice and the error remains the same
runtime error: Unable to load library bygex.so I'll try the /usr/lib steps next Thanks for the help |
Ah, I wonder if it's owing to the fact you've dynamically linked boost_regex into it? Although I'd have thought that if boost_regex was installed as a 32 bit so for your compilation, it would be on the ldpath and resolve okay anyway.
|
This is getting a little bit weird now
LD_LIBRARY_PATH="/home/user/tgstation" export LD_LIBRARY_PATH then stracing DreamDaemon strace DreamDaemon tgstation.dmb 45000 -trusted -logself 2>&1 | grep '^open(".*\.so"' Shows it finds the shared lib open("/home/user/tgstation/bygex.so", O_RDONLY|O_CLOEXEC) = 4 However the log still contains bygex runtime errors! user@machine:~/tgstation$ grep 'bygex' tgstation.log runtime error: Unable to load library bygex.so source file: bygex.dm,55 runtime error: Unable to load library bygex.so source file: bygex.dm,55 Does anyone have any thoughts? Edit: I'll check to see if boost's 32 bit libraries are on the ldpath as well |
Well I figured it out, and its a bit of facepalm
I forgot to link boost_regex in when actually generating the .so Thanks for your help, even though I was running down the wrong path Stephen001 For reference, correct invocation is g++ bygex.o -m32 -lstdc++ -lboost_regex -shared -o bygex.so |
Hey Optimumtact, i have a question for you, im trying to host on tg too, and i dont know where do i find this libbygex.so to move, can you help me with it?
EDIT: nevermind, i found it |
https://github.com/optimumtact/byond-regex
in case anyone else is looking. It's been superseded as of 510 by the built in regex anyway. |
+ #define LIBREGEX_LIBRARY "/home/user/tgstation/bin/bygex.so"
Ensured file was in place at that address
Still no luck, same error in logs
runtime error: Unable to load library /home/user/tgstation/bin/bygex.so
proc name: replacetext (/proc/replacetext)