Shared libraries
Your buildfile must tell the build process to include in the image all of the shared objects required by the drivers you'll be running.
Including shared objects
All drivers require at least the standard C library shared object
(libc.so). Since the shared object search order looks in
/proc/boot, you don't have to do anything special.
Just specify the name of the shared object on a line by itself; this means include
this file
.
To include the runtime linker, we create a process manager symbolic link to it in /proc/boot/.
# include the C shared library and GCC's low-level runtime library
libc.so
libgcc_s.so.1
/usr/lib/ldqnx-64.so.2=ldqnx-64.so.2
Automatically
You can use the mkifs
autoso attribute to list all shared libraries needed by the binaries
specified in your buildfile, or even to automatically add them to your IFS image.
For more information, see Adding missing shared libraries automatically
in the
OS Image Buildfiles
chapter of this guide, and the mkifs
autoso attribute in the QNX OS
Utilities Reference.
Determining which shared objects you need
There are several ways to determine which shared objects you need to include in your system image.
On the target
On the target system, you can use the ldd utility, or the DL_DEBUG environment variable.
list dynamic dependencies) utility lists the shared objects required by the program you specify. For example:
# ldd usr/bin/ssh
./usr/bin/ssh:
libcrypto.so.3 => /proc/boot/libcrypto.so.3 (0x27a8d3c000)
libz.so.2 => /proc/boot/libz.so.2 (0x27a91a1000)
libsocket.so.4 => /proc/boot/libsocket.so.4 (0x27a91bd000)
libregex.so.1 => /proc/boot/libregex.so.1 (0x27a92c 0b000)
libc.so.6 => /proc/boot/libc.so.6 (0x27a921e000)
libgcc_s.so.1 => /proc/boot/libgcc_s.so.1 (0x27a92d1000)
# export DL_DEBUG=libs
# ping 10.42.110.235
load_object: attempt load of libsocket.so.3
load_elf64: loaded lib at addr b8200000(text) b822bccc(data)
dlopen("nss_files.so.0",513)
load_object: attempt load of nss_files.so.0
dlopen: Library cannot be found
dlopen("nss_dns.so.0",513)
load_object: attempt load of nss_dns.so.0
dlopen: Library cannot be found
For more information about the values for DL_DEBUG, see the entry for dlopen() in the QNX OS C Library Reference.
On the host
NEEDED
. For example:
$ ntox86_64-objdump -x x86_64/usr/bin/ping | grep NEEDED
NEEDED libsocket.so.3
NEEDED libc.so.6
The ping executable needs libsocket.so.3 and libc.so.6.
$ ntox86_64-objdump -x x86_64/lib/libsocket.so.3 | grep NEEDED
NEEDED libc.so.6
$ ntox86_64-objdump -x x86_64/lib/libc.so.6 | grep NEEDED
The libsocket.so.3 shared object needs only libc.so.6, which, in turn, needs nothing.
Automatically
As explained above, the mkifs
autoso attribute lets you list all shared libraries needed by the
binaries in your IFS image, or automatically add them to it.
For more information, see the Adding missing shared libraries automatically
section
in this guide, and the mkifs autoso attribute in the Utilities Reference.