As a slight hack, reference glXWaitGL to pull in libGL in the right order

* Basically we want libGL to be loaded second, after librenderdoc. This is
  in order to make sure dlsym(RTLD_NEXT) can work.
* This can be done just by order in the ld command. Unfortunately since
  renderdoccmd links directly against librenderdoc (rather than LD_PRELOAD)
  any symbols exported by librenderdoc resolve, so unless we reference a
  function that isn't exported by librenderdoc, libGL won't be linked in
  at all.
* I realise this is probably a horrible hack, but it works for now.
This commit is contained in:
baldurk
2014-06-07 13:50:26 +01:00
parent 53d6f422be
commit 772fd94336
2 changed files with 13 additions and 3 deletions
+2 -2
View File
@@ -5,9 +5,9 @@ MACROS=-DLINUX \
-DRENDERDOC_EXPORTS \
-DGIT_COMMIT_HASH='"'$$(git rev-parse HEAD)'"' \
-DRENDERDOC_VERSION_STRING='"0.20"'
CFLAGS=-c -Wall -Werror -fPIC $(MACROS) -I.
CFLAGS=-c -Wall -Werror -fPIC $(MACROS) -I../renderdoc/
CPPFLAGS=-std=c++11 -g -Wno-unused -Wno-unknown-pragmas -Wno-reorder
LDFLAGS=-L../renderdoc -lrenderdoc
LDFLAGS=-L../renderdoc -lrenderdoc -lGL
OBJECTS=linux_specific.o
all: bin/renderdoccmd
+11 -1
View File
@@ -23,9 +23,19 @@
******************************************************************************/
#include <stdio.h>
#include <replay/renderdoc.h>
// symbol defined in libGL but not librenderdoc.
// Forces link of libGL after renderdoc (otherwise all symbols would
// be resolved and libGL wouldn't link, meaning dlsym(RTLD_NEXT) would fai
extern "C" void glXWaitGL();
int main()
{
puts("foo");
RENDERDOC_SpawnReplayHost(NULL);
volatile bool never_run = false;
if(never_run) glXWaitGL();
return 0;
}