test libraries without ‘make install’

Quick oneliner to export LD_LIBRARY_PATH containing all the pathnames that brings a shared library (.so) file in, so the lazy ones like myself can sometimes risk running/testing software that uses these libraries without issuing a ‘make install’.

There are probably more clever/elegant ways to do that, but whatever:

export LD_LIBRARY_PATH=$(for j in \
  $(for i in \
    $(find . -name '*.so'); \
    do dirname $i; done | sort | uniq);\
  do readlink -f $j; done |\
  awk '{ printf "%s:", $0 }')

Leave a Reply