Skip to content

Instantly share code, notes, and snippets.

@andreibosco
Created December 22, 2013 13:31
Show Gist options
  • Select an option

  • Save andreibosco/8082602 to your computer and use it in GitHub Desktop.

Select an option

Save andreibosco/8082602 to your computer and use it in GitHub Desktop.
how to link to an unknown library

http://stackoverflow.com/questions/16587828/how-to-link-an-unknown-library

You could use nm to list the symbols defined in the system libraries in order to find which one contains your missing symbol :

find /usr/lib/ -type f -name \*.a \
  -exec nm -gAC --defined-only {} 2> /dev/null \; \
    | grep \ XIQueryVersion

Which outputs:

/usr/lib/x86_64-linux-gnu/libXi.a:XIQueryVersion.o:00000110 T XIQueryVersion

Then you know you have to link libXi.a, of course you can adjust the library path and symbol name, and that would only work if you already have the right library in your system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment