Open
Description
I used to take so much time to find the good linker to my reversed application when suddenly I found the command pkg-config --libs "libselinux"
that in accordance with ldd "$(which ls)"
could find the right library linkage from the ldd command.
example:
$ ldd "$(which ls)"
linux-vdso.so.1 (0x00007ffd1258c000)
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f51a542c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f51a5258000)
libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f51a51c0000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f51a51ba000)
/lib64/ld-linux-x86-64.so.2 (0x00007f51a54ae000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f51a5198000)
$ pkg-config --libs "libselinux"
-lselinux
$ apt-cache search selinux
selinux-utils
libselinux1-dev
...
sudo apt install --yes selinux-utils libselinux1-dev
$ gcc -nostartfiles ls.s -o ls-out -l selinux
I suggest to add this trick to the doc.
Assign me to this issue please :)
Best regards.