Disallow the linker to ingore shared libraries during linking

In some cases when the renderdoccmd/qrenderdoc is linked the linker
ignores the libEGL.so and only uses the librenderdoc.so.
This is because the renderdoc shared library provides the
same symbols as the libEGL.so. However we need to keep the
libEGL.so as we are using RTLD_NEXT in the renderdoc shared
library.
This commit is contained in:
Peter Gal
2017-04-17 02:39:29 -07:00
committed by Baldur Karlsson
parent 386c830b1d
commit 081f65dff1
2 changed files with 8 additions and 0 deletions
+1
View File
@@ -96,6 +96,7 @@ win32 {
} else {
QT += x11extras
DEFINES += RENDERDOC_PLATFORM_POSIX RENDERDOC_PLATFORM_LINUX RENDERDOC_WINDOWING_XLIB RENDERDOC_WINDOWING_XCB
QMAKE_LFLAGS += '-Wl,--no-as-needed'
contains(QMAKE_CXXFLAGS, "-DRENDERDOC_SUPPORT_GL") {
# Link against GL
+7
View File
@@ -8,6 +8,7 @@ elseif(ANDROID)
list(APPEND sources renderdoccmd_android.cpp)
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
list(APPEND libraries PRIVATE -llog -landroid)
set(LINKER_FLAGS "-Wl,--no-as-needed")
elseif(UNIX)
list(APPEND sources renderdoccmd_linux.cpp)
@@ -32,14 +33,20 @@ elseif(UNIX)
if(ENABLE_XLIB AND ENABLE_XCB)
list(APPEND libraries PRIVATE -lX11-xcb)
endif()
# Make sure that for the target executable we don't throw away
# any shared libraries.
set(LINKER_FLAGS "-Wl,--no-as-needed")
endif()
if(ANDROID)
set(CMAKE_SHARED_LINKER_FLAGS "${LINKER_FLAGS}")
add_library(renderdoccmd SHARED ${sources})
else()
set(CMAKE_SKIP_BUILD_RPATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH "$ORIGIN/:$ORIGIN/../lib/")
set(CMAKE_EXE_LINKER_FLAGS "${LINKER_FLAGS}")
add_executable(renderdoccmd ${sources})
endif()