Skip to content

Instantly share code, notes, and snippets.

@errzey
Last active August 30, 2017 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save errzey/4563084e39f9a891bdc2dc3ea8b5e05d to your computer and use it in GitHub Desktop.
Save errzey/4563084e39f9a891bdc2dc3ea8b5e05d to your computer and use it in GitHub Desktop.
stupid shell script that tries to find a specific symbol in libs.
#!/usr/bin/env bash
# runs through your ld paths and looks for a symbol
# passed as the first argument
#
# example:
#
# $ ./lz.findsymbol.sh xcb_big_requests_id
# /usr/lib/x86_64-linux-gnu/libcairo.a
# /usr/lib/x86_64-linux-gnu/libxcb.a
symbol=$1
for dir in `cat /etc/ld.so.conf.d/* | grep -v '#'`
do
for file in $dir/*.a
do
nm --defined-only -g -C $file 2>/dev/null | grep -q $symbol && \
echo $dir/`basename $file`
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment