remove libvlib from libvlibmemoryclient libs 39/14739/3
authorMatthew Smith <mgsmith@netgate.com>
Fri, 7 Sep 2018 22:14:30 +0000 (17:14 -0500)
committerDamjan Marion <dmarion@me.com>
Tue, 11 Sep 2018 08:42:47 +0000 (08:42 +0000)
commit0be66e160f480dd325882409bfefdf042dfe6d1c
tree4347bd73b153a62647ca1d2470a6461c46a8196c
parent58f50f1bb64e962e5628e2c1867e07f238036c7b
remove libvlib from libvlibmemoryclient libs

On CentOS 7, having libvlibmemoryclient link libvlib causes
a SEGV when a program or library is run which links against
libvlibmemoryclient and dlopen() is called. This is because
dlopen() executes any functions with __attribute((constructor))
set. The VLIB_CLI_COMMAND macro creates CLI registration
functions that have this attribute set. So CLI registration
functions end up being run by applications which are clients
of the VPP API.

This doesn't occur on ubuntu 16.04, because ld seems to
omit shared libraries that were listed on the command line
if they are not used to resolve any symbols.

Removing the link to libvlib on vlibmemoryclient to fix this
problem results in another problem. Tests of libvcl_preload
fail when running 'make test'. This happens because
libvcl_preload calls dlopen but does not link against libdl.
When libvlibmemoryclient had libvlib linked, these errors
did not occur since libvlib links libdl. Adjusted the build
of libvcl_preload to explicitly link libdl.

Change-Id: I271ba2f9226ce1602e1f6c1525f3b093bb0345ed
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
src/vcl/CMakeLists.txt
src/vlibmemory/CMakeLists.txt