From 0e5b1a8fa7740bfb8a36fcd8d7d9c4bba916bef2 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Tue, 14 Feb 2012 16:15:40 +0100 Subject: [PATCH 1/2] Allow to LD_PRELOAD (any) library just for singularity-do-not-run-directly This adds support for running: AI_PRELOAD="/path/to/libfoo.so" ./singularity Note that setting and exporting LD_PRELOAD there doesn't work, because then those libs are loaded for every executable that is being run after, including the plugins. This patch also removes the use of tcmalloc from the plugins... Before it exported LD_PRELOAD, using tcmalloc for all the command line tools up till and including running the singularity binary, as well as for the plugins. Now, it only preloads the tcmalloc libraries for singularity-do-not-run-directly. --- indra/newview/linux_tools/wrapper.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh index 64f14a7c8..a20e94283 100755 --- a/indra/newview/linux_tools/wrapper.sh +++ b/indra/newview/linux_tools/wrapper.sh @@ -57,6 +57,11 @@ #export LL_WRAPPER='gdb --args' #export LL_WRAPPER='valgrind --smc-check=all --error-limit=no --log-file=secondlife.vg --leak-check=full --suppressions=/usr/lib/valgrind/glibc-2.5.supp --suppressions=secondlife-i686.supp' +## - This allows one to set an arbitrary value for LD_PRELOAD. +## It won't work if LL_TCMALLOC is set because that uses it's +## own value of LD_PRELOAD. +#export AI_PRELOAD='/path/to/libmemleak.so' + ## - Avoids an often-buggy X feature that doesn't really benefit us anyway. export SDL_VIDEO_X11_DGAMOUSE=0 @@ -96,6 +101,12 @@ cd "${RUN_PATH}" ## subprocesses that care. export SAVED_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" +SL_ENV= + +if [ -n "$AI_PRELOAD" ]; then + SL_ENV='LD_PRELOAD="$AI_PRELOAD" ' +fi + if [ -n "$LL_TCMALLOC" ]; then tcmalloc_libs='/usr/lib/libtcmalloc.so.0 /usr/lib/libstacktrace.so.0 /lib/libpthread.so.0' all=1 @@ -107,7 +118,7 @@ if [ -n "$LL_TCMALLOC" ]; then if [ $all != 1 ]; then echo 'Cannot use tcmalloc libraries: components missing' 1>&2 else - export LD_PRELOAD=$(echo $tcmalloc_libs | tr ' ' :) + SL_ENV='LD_PRELOAD="$(echo $tcmalloc_libs | tr '"' '"' :)" ' if [ -z "$HEAPCHECK" -a -z "$HEAPPROFILE" ]; then export HEAPCHECK=${HEAPCHECK:-normal} fi @@ -119,10 +130,10 @@ BINARY_TYPE=$(expr match "$(file -b bin/$VIEWER_BINARY)" '\(.*executable\)') QPP=qt4/plugins/imageformats/ if [ "${BINARY_TYPE}" == "ELF 64-bit LSB executable" ]; then QTPLUGINS=/usr/lib64/$QPP:/lib64/$QPP:/usr/local/lib64/$QPP - export SL_ENV='LD_LIBRARY_PATH="`pwd`"/lib64:"`pwd`"/lib32:$QTPLUGINS:"${LD_LIBRARY_PATH}"' + SL_ENV+='LD_LIBRARY_PATH="`pwd`/lib64:`pwd`/lib32:$QTPLUGINS:$LD_LIBRARY_PATH"' else QTPLUGINS=/usr/lib/$QPP:/lib/$QPP:/usr/local/lib/$QPP - export SL_ENV='LD_LIBRARY_PATH="`pwd`"/lib:$QTPLUGINS:"${LD_LIBRARY_PATH}"' + SL_ENV+='LD_LIBRARY_PATH="`pwd`/lib:$QTPLUGINS:$LD_LIBRARY_PATH"' fi export SL_CMD='$LL_WRAPPER bin/$VIEWER_BINARY' From 42518dbfaa36e08bc1f415107d1a4621f5a56d01 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Wed, 15 Feb 2012 20:22:41 +0100 Subject: [PATCH 2/2] This fixes a compile error under certain conditions for me. --- indra/newview/pipeline.h | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 47e7b963e..0cfd64350 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -45,6 +45,7 @@ #include "llgl.h" #include "lldrawable.h" #include "llrendertarget.h" +#include "llfasttimer.h" #include