سؤال

I'm currently building a shared object library that use a combination of static and dynamic linking to other libraries. One of the libraries that I want to dynamically link to is librt. However if -lrt is added to the set of arguments passed to libtool, then I don't end up with the necessary reference to library, e.g. output from ldd:

linux-vdso.so.1 =>  (0x00007fff5273b000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f5cd720f000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5cd6e50000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f5cd6c39000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f5cd693d000)
/lib64/ld-linux-x86-64.so.2 (0x00007f5cd779d000)

However if I hack the generated libtool script and add -lrt to the set of postdeps then I get the appropriate linking:

linux-vdso.so.1 =>  (0x00007fffb91ff000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f1f5ae23000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1f5aa64000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f1f5a84d000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f1f5a645000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1f5a349000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1f5b3b1000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1f5a12b000)
هل كانت مفيدة؟

المحلول

Answer found.

export LIBS=-lrt
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top