diff options
author | João Valverde <j@v6e.pt> | 2023-01-25 21:41:55 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2023-01-29 23:38:00 +0000 |
commit | 7a346c398a911a9883cc67f12542f04f87a21ee8 (patch) | |
tree | 35435d2da3fee421fa02e00b3de0176489b96a9d /wsutil | |
parent | 43e530e94d6f6f3a5d757527ba7bc466faf02cbc (diff) |
Enable rpathification and working relocation on Linux
Dumpcap depends on wsutil.so. The path to the shared library
is encoded in the RPATH (or RUNPATH) property of ELF binaries.
This is currently an absolute path on most Unixy systems.
Dumpcap could not be made to work with a relative RPATH because it
uses elevated privileges and some loaders will ignore relative
RPATHs and non-standard paths under those circumstances, because of
(justified) security concerns.
To enable relocation of the program we link dumpcap statically
with wsutil instead.
This provides a fully working relocatable installation on Linux
and other platforms that support relative RPATHs.
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/CMakeLists.txt | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/wsutil/CMakeLists.txt b/wsutil/CMakeLists.txt index 08e16ee37a..002e11bfbb 100644 --- a/wsutil/CMakeLists.txt +++ b/wsutil/CMakeLists.txt @@ -333,6 +333,38 @@ install(TARGETS wsutil ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) +add_library(wsutil_static STATIC + ${WSUTIL_FILES} + $<TARGET_OBJECTS:wmem> +) + +target_compile_definitions(wsutil_static PRIVATE + ENABLE_STATIC + BUILD_WSUTIL +) + +target_link_libraries(wsutil_static + PUBLIC + ${GLIB2_LIBRARIES} + ${GMODULE2_LIBRARIES} + ${GNUTLS_LIBRARIES} + ${PCRE2_LIBRARIES} + ${GCRYPT_LIBRARIES} + PRIVATE + ${APPLE_CORE_FOUNDATION_LIBRARY} + ${CMAKE_DL_LIBS} + ${M_LIBRARIES} + ${WIN_IPHLPAPI_LIBRARY} + ${WIN_WS2_32_LIBRARY} +) + +target_include_directories(wsutil_static + SYSTEM PUBLIC + ${GCRYPT_INCLUDE_DIRS} + ${GNUTLS_INCLUDE_DIRS} + ${PCRE2_INCLUDE_DIRS} +) + add_executable(test_wsutil EXCLUDE_FROM_ALL test_wsutil.c ) |