Web lists-archives.com

Re: Distributing program compiled with gcc on Cygwin to Windows users




On Sun, Oct 14, 2018, 4:20 PM <hackerwiz@xxxxxxxxxxxxxx> wrote:

> Hello,
>
> I have a program that uses X11/Motif and runs fine, within Cygwin/X on the
> PC it was compiled on.
>
> What is the *minimum* required set of Cygwin libs and any other files I
> need to distribute along with, it to end-users who may just have Windows
> (and not Cygwin) installed?
>
> I appreciate your help.
>
> "ldd " on my program gives these dependencies listed below:
>
> thanks
> -Ron
>
>   ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll (0x77370000)
>         KERNEL32.DLL => /cygdrive/c/WINDOWS/System32/KERNEL32.DLL
> (0x75570000)
>         KERNELBASE.dll => /cygdrive/c/WINDOWS/System32/KERNELBASE.dll
> (0x74940000)
>         cygstdc++-6.dll => /usr/bin/cygstdc++-6.dll (0x5c630000)
>         cyggcc_s-1.dll => /usr/bin/cyggcc_s-1.dll (0x68c50000)
>         cygwin1.dll => /usr/bin/cygwin1.dll (0x61000000)
>         libtcl8.6.dll => /usr/bin/libtcl8.6.dll (0x58660000)
>         cygX11-6.dll => /usr/bin/cygX11-6.dll (0x695e0000)
>         cygXm-4.dll => /usr/bin/cygXm-4.dll (0x68a00000)
>         cygXpm-4.dll => /usr/bin/cygXpm-4.dll (0x69560000)
>         cygXt-6.dll => /usr/bin/cygXt-6.dll (0x694b0000)
>         cygperl5_26.dll => /usr/bin/cygperl5_26.dll (0x5d3b0000)
>         cygz.dll => /usr/bin/cygz.dll (0x5b8b0000)
>         cygxcb-1.dll => /usr/bin/cygxcb-1.dll (0x5bc90000)
>         cygfontconfig-1.dll => /usr/bin/cygfontconfig-1.dll (0x67480000)
>         cygiconv-2.dll => /usr/bin/cygiconv-2.dll (0x61a20000)
>         cygjpeg-8.dll => /usr/bin/cygjpeg-8.dll (0x60c20000)
>         cygpng16-16.dll => /usr/bin/cygpng16-16.dll (0x5d600000)
>         cygXext-6.dll => /usr/bin/cygXext-6.dll (0x69810000)
>         cygXft-2.dll => /usr/bin/cygXft-2.dll (0x69720000)
>         cygXmu-6.dll => /usr/bin/cygXmu-6.dll (0x69590000)
>         cygICE-6.dll => /usr/bin/cygICE-6.dll (0x6fea0000)
>         cygSM-6.dll => /usr/bin/cygSM-6.dll (0x69970000)
>         cygcrypt-0.dll => /usr/bin/cygcrypt-0.dll (0x68790000)
>         cygXau-6.dll => /usr/bin/cygXau-6.dll (0x698f0000)
>         cygXdmcp-6.dll => /usr/bin/cygXdmcp-6.dll (0x69830000)
>         cygexpat-1.dll => /usr/bin/cygexpat-1.dll (0x67e70000)
>         cygfreetype-6.dll => /usr/bin/cygfreetype-6.dll (0x66950000)
>         cygXrender-1.dll => /usr/bin/cygXrender-1.dll (0x69520000)
>         cyguuid-1.dll => /usr/bin/cyguuid-1.dll (0x5c8b0000)
>         cygbz2-1.dll => /usr/bin/cygbz2-1.dll (0x689a0000)
>         cygintl-8.dll => /usr/bin/cygintl-8.dll (0x64640000)
>         utwin.dll => /cygdrive/c/builds/solaris32/2018/2004-ut/utwin.dll
> (0x64c00000)
>         USER32.dll => /cygdrive/c/WINDOWS/System32/USER32.dll (0x73c50000)
>         win32u.dll => /cygdrive/c/WINDOWS/System32/win32u.dll (0x75650000)
>         mfc140d.dll => /cygdrive/c/WINDOWS/SYSTEM32/mfc140d.dll
> (0x63d20000)
>         ADVAPI32.dll => /cygdrive/c/WINDOWS/System32/ADVAPI32.dll
> (0x76dc0000)
>         GDI32.dll => /cygdrive/c/WINDOWS/System32/GDI32.dll (0x74f20000)
>         msvcrt.dll => /cygdrive/c/WINDOWS/System32/msvcrt.dll (0x74510000)
>         gdi32full.dll => /cygdrive/c/WINDOWS/System32/gdi32full.dll
> (0x770a0000)
>         sechost.dll => /cygdrive/c/WINDOWS/System32/sechost.dll
> (0x74f50000)
>         msvcp_win.dll => /cygdrive/c/WINDOWS/System32/msvcp_win.dll
> (0x758e0000)
>         ucrtbase.dll => /cygdrive/c/WINDOWS/System32/ucrtbase.dll
> (0x757c0000)
>         RPCRT4.dll => /cygdrive/c/WINDOWS/System32/RPCRT4.dll (0x747d0000)
>         COMDLG32.dll => /cygdrive/c/WINDOWS/System32/COMDLG32.dll
> (0x74cc0000)
>         SspiCli.dll => /cygdrive/c/WINDOWS/System32/SspiCli.dll
> (0x73c30000)
>         combase.dll => /cygdrive/c/WINDOWS/System32/combase.dll
> (0x76e40000)
>         CRYPTBASE.dll => /cygdrive/c/WINDOWS/System32/CRYPTBASE.dll
> (0x73c20000)
>         bcryptPrimitives.dll =>
> /cygdrive/c/WINDOWS/System32/bcryptPrimitives.dll (0x75760000)
>         ??? => ??? (0x3840000)
>         shcore.dll => /cygdrive/c/WINDOWS/System32/shcore.dll (0x754e0000)
>         ole32.dll => /cygdrive/c/WINDOWS/System32/ole32.dll (0x75960000)
>         SHLWAPI.dll => /cygdrive/c/WINDOWS/System32/SHLWAPI.dll
> (0x75670000)
>         OLEAUT32.dll => /cygdrive/c/WINDOWS/System32/OLEAUT32.dll
> (0x74da0000)
>         SHELL32.dll => /cygdrive/c/WINDOWS/System32/SHELL32.dll
> (0x75a70000)
>         VCRUNTIME140D.dll =>
> /cygdrive/c/WINDOWS/SYSTEM32/VCRUNTIME140D.dll (0x6f700000)
>         IMM32.dll => /cygdrive/c/WINDOWS/System32/IMM32.dll (0x74b30000)
>         cfgmgr32.dll => /cygdrive/c/WINDOWS/System32/cfgmgr32.dll
> (0x75020000)
>         ucrtbased.dll => /cygdrive/c/WINDOWS/SYSTEM32/ucrtbased.dll
> (0x63ba0000)
>         windows.storage.dll =>
> /cygdrive/c/WINDOWS/System32/windows.storage.dll (0x73de0000)
>         lmgr327b.dll =>
> /cygdrive/c/builds/solaris32/2018/2004-ut/lmgr327b.dll (0x10000000)
>         kernel.appcore.dll =>
> /cygdrive/c/WINDOWS/System32/kernel.appcore.dll (0x77210000)
>         COMCTL32.dll =>
> /cygdrive/c/WINDOWS/WinSxS/x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.17134.285_none_41037de2450e52da/COMCTL32.dll
> (0x701f0000)
>         profapi.dll => /cygdrive/c/WINDOWS/System32/profapi.dll
> (0x74f00000)
>         UxTheme.dll => /cygdrive/c/WINDOWS/SYSTEM32/UxTheme.dll
> (0x71c80000)
>         powrprof.dll => /cygdrive/c/WINDOWS/System32/powrprof.dll
> (0x75060000)
>         NETAPI32.dll => /cygdrive/c/WINDOWS/SYSTEM32/NETAPI32.dll
> (0x72c50000)
>         FLTLIB.DLL => /cygdrive/c/WINDOWS/System32/FLTLIB.DLL (0x75010000)
>         WINSPOOL.DRV => /cygdrive/c/WINDOWS/SYSTEM32/WINSPOOL.DRV
> (0x72070000)
>         bcrypt.dll => /cygdrive/c/WINDOWS/SYSTEM32/bcrypt.dll (0x73460000)
>         PROPSYS.dll => /cygdrive/c/WINDOWS/SYSTEM32/PROPSYS.dll
> (0x72540000)
>         IPHLPAPI.DLL => /cygdrive/c/WINDOWS/SYSTEM32/IPHLPAPI.DLL
> (0x723b0000)
>
> Sent with [ProtonMail](https://protonmail.com) Secure Email.


Hello,

You can tell GCC to statically compile your binaries. However I usually
only do this for very simple programs that do not have many dependencies.
With complicated dependency chains it is possible to get to a place where
library X or Y *demands* dynamic loading and you are left trying to gather
the libraries.

To gather the libraries you can parse the output of ldd. I think there is
another program that will print out a dependency *tree* that is harder to
to parse but has options that generate more easily machine readable.

I have used the above for a ramdisk based system. It was easier than
statically compiling everything. I lost the code I think or I'd pass it
along.


Also consider installing Cygwin on the target system. It is a more
realistic solution even for automated deployments.

Cheers,
    R0b0t1

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple