Open Rafael-BL opened 9 years ago
ok - that is just master, no changes yet?
so run configure like so:
sh autogen.sh
./configure --with-posix --with-xenomai --with-lttng
that should result in a config.h define and make flags:
grep LTTNG *
config.h:#define HAVE_LTTNG_UST /**/
...
Makefile.inc:HAVE_LTTNG_UST = yes
Makefile.inc:LTTNG_UST_LIBS = -L/usr/local/lib -llttng-ust -ldl
Makefile.inc:LTTNG_UST_CFLAGS = -I/usr/local/include
....
so the HAVE_LTTNG_UST would be used for say conditional compilation of trace points
now the rtapi code will be compiled already with the LTTNG_UST_CFLAGS, see here and linked with LTTNG_UST_LIBS here
so not sure what is missing?
The only thing which needs twisting is how you get the -rpath flag properly added when linking libexec/rtapi_app_<flavor>
for now, add in rtap/Submakefile:
LIBUST_LIB_DIR := /usr/local/lib
RTAPI_APP_RPATH+=-Wl,-rpath,$(LIBUST_LIB_DIR)
now delete libexec/rtapi_app* and run make V=1
so you see the options being passed:
Linking rtapi_app_xenomai
g++ -Wl,-rpath,/home/mah/machinekit-tutorial/rtlib/xenomai -Wl,-rpath,/home/mah/machinekit-tutorial/lib -Wl,-rpath,/usr/local/lib \
-o ../libexec/rtapi_app_xenomai objects/rtapi/xenomai/rtapi_app.o objects/rtapi/xenomai/rtapi_compat.o objects/rtapi/xenomai/rtapi_hexdump.o objects/rtapi/xenomai/rtapi_support.o ../lib/liblinuxcncini.so.0 ../lib/liblinuxcncshm.so ../lib/libmtalk.so.0 ../lib/liblinuxcnc-pb2++.so.0 ../lib/librtapi_math.so.0 -lalchemy -Wl,--wrap=main -Wl,--dynamic-list=/usr/lib/dynlist.ld -lcopperplate -L/usr/lib -lcobalt -lpthread -lrt \
-lprotobuf -pthread -lpthread -L/usr/local/lib -lczmq -lzmq -lavahi-common -lavahi-client -L/usr/local/lib -llttng-ust -ldl -lstdc++ -ldl -luuid
make[1]: Leaving directory '/home/mah/machinekit-tutorial/src'
You now need to run 'sudo make setuid' in order to run in place.
make: Leaving directory '/home/mah/machinekit-tutorial/src'
now let's investigate if the right thing happened:
mah@nwheezy:~/machinekit-tutorial/src$ ldd ../libexec/rtapi_app_xenomai
linux-gate.so.1 (0xb7775000)
liblinuxcncini.so.0 => /home/mah/machinekit-tutorial/lib/liblinuxcncini.so.0 (0xb776e000)
liblinuxcncshm.so.0 => /home/mah/machinekit-tutorial/lib/liblinuxcncshm.so.0 (0xb776a000)
libmtalk.so.0 => /home/mah/machinekit-tutorial/lib/libmtalk.so.0 (0xb774d000)
liblinuxcnc-pb2++.so.0 => /home/mah/machinekit-tutorial/lib/liblinuxcnc-pb2++.so.0 (0xb7541000)
librtapi_math.so.0 => /home/mah/machinekit-tutorial/lib/librtapi_math.so.0 (0xb753a000)
libalchemy.so.0 => /usr/lib/libalchemy.so.0 (0xb7506000)
libcopperplate.so.0 => /usr/lib/libcopperplate.so.0 (0xb74f7000)
libcobalt.so.2 => /usr/lib/libcobalt.so.2 (0xb74da000)
libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xb74be000)
librt.so.1 => /lib/i386-linux-gnu/i686/cmov/librt.so.1 (0xb74b5000)
libprotobuf.so.9 => /usr/lib/i386-linux-gnu/libprotobuf.so.9 (0xb738a000)
libczmq.so.3 => /usr/local/lib/libczmq.so.3 (0xb72d3000)
libzmq.so.3 => /usr/lib/i386-linux-gnu/libzmq.so.3 (0xb726e000)
libavahi-common.so.3 => /usr/lib/i386-linux-gnu/libavahi-common.so.3 (0xb725f000)
libavahi-client.so.3 => /usr/lib/i386-linux-gnu/libavahi-client.so.3 (0xb724b000)
liblttng-ust.so.0 => /usr/local/lib/liblttng-ust.so.0 (0xb71fe000)
libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xb71f8000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb7106000)
libuuid.so.1 => /lib/i386-linux-gnu/libuuid.so.1 (0xb7100000)
libm.so.6 => /lib/i386-linux-gnu/i686/cmov/libm.so.6 (0xb70ba000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb709d000)
libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xb6ef2000)
libjansson.so.4 => /usr/lib/i386-linux-gnu/libjansson.so.4 (0xb6ee3000)
/lib/ld-linux.so.2 (0xb7778000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb6ec6000)
libpgm-5.1.so.0 => /usr/lib/libpgm-5.1.so.0 (0xb6e70000)
libsodium.so.13 => /usr/lib/i386-linux-gnu/libsodium.so.13 (0xb6df1000)
libdbus-1.so.3 => /lib/i386-linux-gnu/libdbus-1.so.3 (0xb6d99000)
liblttng-ust-tracepoint.so.0 => /usr/local/lib/liblttng-ust-tracepoint.so.0 (0xb6d88000)
liburcu-bp.so.3 => /usr/local/lib/liburcu-bp.so.3 (0xb6d81000)
liburcu-cds.so.3 => /usr/local/lib/liburcu-cds.so.3 (0xb6d7a000)
liburcu-common.so.3 => /usr/local/lib/liburcu-common.so.3 (0xb6d75000)
mah@nwheezy:~/machinekit-tutorial/src$
yes! let's also have a look at the rpath:, read this and man ld
for the rpath option:
$ readelf -d ../libexec/rtapi_app_xenomai |grep RPATH
0x0000000f (RPATH) Library rpath: [/home/mah/machinekit-tutorial/rtlib/xenomai:/home/mah/machinekit-tutorial/lib:/usr/local/lib]
so the /usr/local/lib directory was correctly added, meaning the binary will load shared libs from there even if it is setuid (which rtapiapp* is)
dont hesitate to ask any questions!
when it all works I'll fix up the rpath handling in rtapi/Submakefile so it's all automatic
Hi,
I basically need to make is to that all of LTTng's librairies are linked with machinekit. Those librairies are located in "/usr/local/lib" which is a directory that is not searched by machinekit for librairies.
Ideally, those librairies would be linked if the configure option "--with-lttng" is chosen before the "make" process. I also tried opening them with a "dlopen" call but it requires the application to be linked with "-ldl" which, when I try to do so, gives me an error.
Any help would be appreciated, Rafael