When we were doing STATICC we were linking libdw dynamically, still requiring many dependencies. THis switches to libbfd, which should massively reduce the number of required libraries.

This commit is contained in:
Deukhoofd 2021-03-26 13:37:01 +01:00
parent 12f643a80e
commit 47ee3a0295
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 6 additions and 3 deletions

View File

@ -5,6 +5,7 @@ project(Arbutils)
add_compile_options(-Wall -Wextra -Werror)
# We like new stuff, so set the c++ standard to c++20.
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
option(WINDOWS "Whether the build target is Windows or not." OFF)
option(SHARED "Whether we should build a shared library, instead of a static one." OFF)
@ -49,7 +50,7 @@ endif()
set(LINKS)
if (NOT WINDOWS AND PRETTYTRACES)
set(LINKS ${LINKS} -ldw)
set(LINKS ${LINKS} -lbfd -ldl)
ADD_DEFINITIONS(-DPRETTYTRACES=1)
endif()
if (SIGNAL_HANDLING)
@ -58,7 +59,9 @@ endif()
# If we want to link the C and C++ library statically, link those as well.
if (STATICC)
set(LINKS ${LINKS} -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread)
message("Linking dependencies statically.")
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")
set(LINKS -static-libgcc -static-libstdc++ -Wl,-Bstatic -lm -lstdc++ -lpthread -Wl,-Bdynamic ${LINKS})
endif(STATICC)
target_link_libraries(Arbutils ${LINKS})

View File

@ -3,7 +3,7 @@
#if !WINDOWS
#if PRETTYTRACES
#define BACKWARD_HAS_DW 1
#define BACKWARD_HAS_BFD 1
#endif
#include "../extern/backward.hpp"
#endif