Package: mingw-ldd
mingw-lddLists dependencies of a PE (exe/dll) file.FeaturesMimics ldd outputAllows to specify dll lookup pathsHas no hardcoded dll lookup pathsMakes sure the dependencies are of the same CPU architectureSorts the output by dll nameCan also print per-dep or tree outputsUses multiprocessing to speed up the dll lookupNote that the arguments do not mimic ldd arguments.UsageThe script can be installed from PyPi:pipinstallmingw_ldd
mingw-ldd--helpThe script can be used stanalone, given you havepefileinstalled:sudoapt-getinstallpython3-pefile
./mingw_ldd/mingw_ldd.py--helpor:sudoapt-getinstallvirtualenv
virtualenv-p/usr/bin/python3env
./env/bin/pipinstall-rrequirements.txt
./env/bin/python3./mingw_ldd/mingw_ldd.py--helpThemingw_ldd.pyscript file is self-contained and can be easily copied into other project's codebase.Example$mingw-ldd.py-h
usage:mingw_ldd.py[-h][--output-format{ldd-like,per-dep-list,tree}]--dll-lookup-dirsDLL_LOOKUP_DIR[DLL_LOOKUP_DIR...][--disable-multiprocessing]PE_FILELdd-like output:$./mingw-ldd.py/home/nurupo/qtox/workspace/i686/qtox/release/libtoxcore.dll\--dll-lookup-dirs/usr/lib/gcc/i686-w64-mingw32/*-posix\/usr/i686-w64-mingw32/lib\/home/nurupo/qtox/workspace/i686/qtox/releaseadvapi32.dll=>notfoundiphlpapi.dll=>notfoundkernel32.dll=>notfoundlibgcc_s_sjlj-1.dll=>/usr/lib/gcc/i686-w64-mingw32/9.3-posix/libgcc_s_sjlj-1.dlllibopus-0.dll=>/home/nurupo/qtox/workspace/i686/qtox/release/libopus-0.dlllibsodium-23.dll=>/home/nurupo/qtox/workspace/i686/qtox/release/libsodium-23.dlllibvpx.dll=>/home/nurupo/qtox/workspace/i686/qtox/release/libvpx.dlllibwinpthread-1.dll=>/usr/i686-w64-mingw32/lib/libwinpthread-1.dllmsvcrt.dll=>notfounduser32.dll=>notfoundws2_32.dll=>notfoundPer-dep-list output:$./mingw-ldd.py/home/nurupo/qtox/workspace/i686/qtox/release/libtoxcore.dll\--output-formatper-dep-list\--dll-lookup-dirs/usr/lib/gcc/i686-w64-mingw32/*-posix\/usr/i686-w64-mingw32/lib\/home/nurupo/qtox/workspace/i686/qtox/release
/home/nurupo/qtox/workspace/i686/qtox/release/libopus-0.dllKERNEL32.dll=>notfoundlibgcc_s_sjlj-1.dll=>/usr/lib/gcc/i686-w64-mingw32/9.3-posix/libgcc_s_sjlj-1.dllmsvcrt.dll=>notfound
/home/nurupo/qtox/workspace/i686/qtox/release/libsodium-23.dllADVAPI32.dll=>notfoundKERNEL32.dll=>notfoundlibgcc_s_sjlj-1.dll=>/usr/lib/gcc/i686-w64-mingw32/9.3-posix/libgcc_s_sjlj-1.dllmsvcrt.dll=>notfoundUSER32.dll=>notfound
/home/nurupo/qtox/workspace/i686/qtox/release/libtoxcore.dllIPHLPAPI.DLL=>notfoundKERNEL32.dll=>notfoundlibgcc_s_sjlj-1.dll=>/usr/lib/gcc/i686-w64-mingw32/9.3-posix/libgcc_s_sjlj-1.dlllibopus-0.dll=>/home/nurupo/qtox/workspace/i686/qtox/release/libopus-0.dlllibsodium-23.dll=>/home/nurupo/qtox/workspace/i686/qtox/release/libsodium-23.dlllibvpx.dll=>/home/nurupo/qtox/workspace/i686/qtox/release/libvpx.dlllibwinpthread-1.dll=>/usr/i686-w64-mingw32/lib/libwinpthread-1.dllmsvcrt.dll=>notfoundWS2_32.dll=>notfound
/home/nurupo/qtox/workspace/i686/qtox/release/libvpx.dllKERNEL32.dll=>notfoundlibgcc_s_sjlj-1.dll=>/usr/lib/gcc/i686-w64-mingw32/9.3-posix/libgcc_s_sjlj-1.dlllibwinpthread-1.dll=>/usr/i686-w64-mingw32/lib/libwinpthread-1.dllmsvcrt.dll=>notfound
/usr/i686-w64-mingw32/lib/libwinpthread-1.dllKERNEL32.dll=>notfoundmsvcrt.dll=>notfound
/usr/lib/gcc/i686-w64-mingw32/9.3-posix/libgcc_s_sjlj-1.dllKERNEL32.dll=>notfoundlibwinpthread-1.dll=>/usr/i686-w64-mingw32/lib/libwinpthread-1.dllmsvcrt.dll=>notfoundTree output:$./mingw-ldd.py/home/nurupo/qtox/workspace/i686/qtox/release/libtoxcore.dll\--output-formattree\--dll-lookup-dirs/usr/lib/gcc/i686-w64-mingw32/*-posix\/usr/i686-w64-mingw32/lib\/home/nurupo/qtox/workspace/i686/qtox/release
/home/nurupo/qtox/workspace/i686/qtox/release/libtoxcore.dll
├──IPHLPAPI.DLL=>notfound
├──KERNEL32.dll=>notfound
├──libgcc_s_sjlj-1.dll=>/usr/lib/gcc/i686-w64-mingw32/9.3-posix/libgcc_s_sjlj-1.dll
│├──KERNEL32.dll=>notfound
│├──libwinpthread-1.dll=>/usr/i686-w64-mingw32/lib/libwinpthread-1.dll
││├──KERNEL32.dll=>notfound
││└──msvcrt.dll=>notfound
│└──msvcrt.dll=>notfound
├──libopus-0.dll=>/home/nurupo/qtox/workspace/i686/qtox/release/libopus-0.dll
│├──KERNEL32.dll=>notfound
│├──libgcc_s_sjlj-1.dll=>/usr/lib/gcc/i686-w64-mingw32/9.3-posix/libgcc_s_sjlj-1.dll
││├──KERNEL32.dll=>notfound
││├──libwinpthread-1.dll=>/usr/i686-w64-mingw32/lib/libwinpthread-1.dll
│││├──KERNEL32.dll=>notfound
│││└──msvcrt.dll=>notfound
││└──msvcrt.dll=>notfound
│└──msvcrt.dll=>notfound
├──libsodium-23.dll=>/home/nurupo/qtox/workspace/i686/qtox/release/libsodium-23.dll
│├──ADVAPI32.dll=>notfound
│├──KERNEL32.dll=>notfound
│├──libgcc_s_sjlj-1.dll=>/usr/lib/gcc/i686-w64-mingw32/9.3-posix/libgcc_s_sjlj-1.dll
││├──KERNEL32.dll=>notfound
││├──libwinpthread-1.dll=>/usr/i686-w64-mingw32/lib/libwinpthread-1.dll
│││├──KERNEL32.dll=>notfound
│││└──msvcrt.dll=>notfound
││└──msvcrt.dll=>notfound
│├──msvcrt.dll=>notfound
│└──USER32.dll=>notfound
├──libvpx.dll=>/home/nurupo/qtox/workspace/i686/qtox/release/libvpx.dll
│├──KERNEL32.dll=>notfound
│├──libgcc_s_sjlj-1.dll=>/usr/lib/gcc/i686-w64-mingw32/9.3-posix/libgcc_s_sjlj-1.dll
││├──KERNEL32.dll=>notfound
││├──libwinpthread-1.dll=>/usr/i686-w64-mingw32/lib/libwinpthread-1.dll
│││├──KERNEL32.dll=>notfound
│││└──msvcrt.dll=>notfound
││└──msvcrt.dll=>notfound
│├──libwinpthread-1.dll=>/usr/i686-w64-mingw32/lib/libwinpthread-1.dll
││├──KERNEL32.dll=>notfound
││└──msvcrt.dll=>notfound
│└──msvcrt.dll=>notfound
├──libwinpthread-1.dll=>/usr/i686-w64-mingw32/lib/libwinpthread-1.dll
│├──KERNEL32.dll=>notfound
│└──msvcrt.dll=>notfound
├──msvcrt.dll=>notfound
└──WS2_32.dll=>notfoundPerformanceThe performance might be a bit slower than expected due topefilesometimes taking up to few seconds to parse a dll.
We try to mitigate this by multiprocessing pefile's parsing.
Using the most up to datepefileshould help too.
Specifically, the current version ofpefileon PyPi -- version 2019.4.18, is noticeably faster than the version 2018.8.8 packaged in Debian Buster.If the performance is an issue, you could give these projects a try:ntldd- a cross-platform ldd-like program written in CDependency Walker- a freeware Windows GUI application that displays PE dependenciesDisclaimerThis project is not affiliated with MinGW, the name "mingw-ldd" is used primarely to facilitate online search discoverability as MinGW suit is missing ldd.LicenseMIT