Skip to content

Instantly share code, notes, and snippets.

@michalfapso
Created June 16, 2021 12:24
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 michalfapso/70082d5a07a3ffc785018e127637a246 to your computer and use it in GitHub Desktop.
Save michalfapso/70082d5a07a3ffc785018e127637a246 to your computer and use it in GitHub Desktop.

To know which dll libraries need to be bundled with your application, the safest way is to profile your app at runtime, because some libraries may be loaded just at runtime (e.g. Qt plugins). We use MSYS2 (https://www.msys2.org/) for compiling our apps with GCC and MSYS2 contains the strace package which we use here to get a list of loaded dll libraries:

/usr/bin/strace ANY_APP.exe 2>&1 \
| tee out.log \
| grep -a -E '^--- Process .* loaded .*\.dll' \
| cut -d' ' -f 5- \
| sed 's/\.dll.*/.dll/' \
| sort -u

Explanation:

  • store full output to out.log
  • take just lines with dll loading messages
  • take columns starting with the file path
  • remove everything after .dll
  • sort and keep only unique paths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment