Am 24.03.19 um 16:17 schrieb George Bassis:
> Hello all!
>
> I have a system written in Tcl 8.5 from which I need to send monitoring data to a RabbitMQ.
Please do not respond off-group, unless you want to discuss private
matter. I'll quote your reply to me here:
> @ChristianGollwitzer: I decided to follow your suggestion. I compiled
> with clang, enabling tcl stubs and got the respective object files. I
> am now trying to statically link the resulting files with ld but
> continuously stumble upon undefined symbols in the resulting so.
> Could you please share the flags you have passed to ld in some
> project where you have managed to create a portable so?
1) Unless you tell your flags and your error message, it is hard to
understand the problem
2) Do not link using ld, link using the compiler.
3) I assume you compiled the C library as a static library, as this is
obviously the precondition. Best would be to compile it without shared
libraries, otherwise for some odd reason, gcc prefers the dynamic
library during the link
So I suggest, to first compile rabbitmq-c with BUILD_SHARED_LIBS=OFF and
BUILD_STATIC_LIBS=ON and with -fPIC. How to get this into the options
with cmake, I don't know. You'll have to figure it out, I'm not good at
cmake. In autoconf, if there is no option for it, you would set
CFLAGS="-fPIC"
Then compile the Tcl interface like this:
gcc -shared -fPIC -I/path/to/C/lib -L/path/to/C/libfile -DUSE_TCL_STUBS
rabbitmq-tcl.c -lrabbit -static-libgcc -ltclstub8.6 -o rabbitmq-tcl.so
Then you should be able to load that into any interpreter, including
tclkits. The -static-libgcc is a gcc specialty, not sure if it is needed
in clang or what the equivalent would be.
Hope this helps,
Christian