For the time being, I am stil working on maintaining MinGW32 Linux Distro. We have now more than 200 packages.

But if I write this ticket tonight this is because I discovered this usage from objdump with its flag -p while I was on the Internet tonight.

That gave me the idea to write a quick function

david@amdgaming:~$ cat Get_Required_DLL.Sh 
_get_missing_dll_at_runtime ()
{
	my_file="${1}"
	local my_path="/opt/MinGW32/i686-w64-mingw32/bin"

	[ ! -f "${my_file}" ] && { echo "not a regular file!"; exit 1; }

	for file in $(objdump -p ${my_file} |grep "DLL Name"|awk '{print $NF}'|sort);
	do  
		[ -f "${my_path}/${file}" ] && echo "${my_path}/${file}" || echo "# not found: ${file}";
	done
}
So here I just need to source this file
source  Get_Required_DLL.Sh
Here are some examples
  • Looking for required DLLs for upx.exe
    david@amdgaming:~$ _get_missing_dll_at_runtime /opt/MinGW32/i686-w64-mingw32/bin/upx.exe 
    # not found: KERNEL32.dll
    /opt/MinGW32/i686-w64-mingw32/bin/libstdc++-6.dll
    /opt/MinGW32/i686-w64-mingw32/bin/libucl-1.dll
    /opt/MinGW32/i686-w64-mingw32/bin/libwinpthread-1.dll
    # not found: msvcrt.dll
    # not found: USER32.dll
    /opt/MinGW32/i686-w64-mingw32/bin/zlib1.dll
    
  • Looking for required DLLs for mediainfo.exe
    david@amdgaming:~$ _get_missing_dll_at_runtime /opt/MinGW32/i686-w64-mingw32/bin/mediainfo.exe
    # not found: KERNEL32.dll
    /opt/MinGW32/i686-w64-mingw32/bin/libgcc_s_sjlj-1.dll
    /opt/MinGW32/i686-w64-mingw32/bin/libstdc++-6.dll
    # not found: msvcrt.dll
    # not found: SHELL32.dll
    /opt/MinGW32/i686-w64-mingw32/bin/zlib1.dll
    
  • Looking for required DLLs for ocspcheck.exe
    david@amdgaming:~$ _get_missing_dll_at_runtime /opt/MinGW32/i686-w64-mingw32/bin/ocspcheck.exe
    # not found: KERNEL32.dll
    /opt/MinGW32/i686-w64-mingw32/bin/libcrypto-42.dll
    /opt/MinGW32/i686-w64-mingw32/bin/libssp-0.dll
    /opt/MinGW32/i686-w64-mingw32/bin/libtls-16.dll
    # not found: msvcrt.dll
    # not found: WS2_32.dll
    
That's a pretty cool function and should make life easier. Later if I want to share some packages then I just need to compress them using upx.exe through wine (I have upx.exe installed in my toolchain)
wineconsole --backend=curses upx.exe --best --strip-relocs=0 *.dll *.exe
Of course there might be some exceptions and some tests need to be performed after that step before sharing any package.