【发布时间】:2017-08-02 04:38:30
【问题描述】:
我在 Windows 上使用 gcc-6.3.0 和 gcc-gnat-6.3.0 在 MinGW64 (MSYS2) 中编译了一个 Linux 软件。我想组装一个包含所有必要文件的安装程序包或 zip 文件。目标机器需要 MinGW 的哪些部分?
我不想发布完整的 MSYS2/MinGW64,因为它有 3 GiB!可执行文件只有 10 MiB。
我也不会要求用户安装 MSYS2 和 MinGW64,因为在 Windows 机器上安装它是一场噩梦。包管理器(pacman)对普通用户不友好/不可用。
编辑 1:
通常,MinGW64 不在我的 PATH 中。我有一个脚本来添加它,具体取决于所选的 MinGW 版本 32 与 64。用于编译程序的 GCC 来自 mingw32 或 mingw64 目录。
我将二进制文件复制到一个单独的目录:C:\Tools\GHDL\0.34dev-mingw64-llvm\bin
我使用ldd.exe 来检查可执行文件:
C:\msys64\usr\bin\ldd.exe C:\Tools\GHDL\0.34dev-mingw64-llvm\bin\ghdl.exe
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x77020000)
kernel32.dll => /c/Windows/system32/kernel32.dll (0x76f00000)
KERNELBASE.dll => /c/Windows/system32/KERNELBASE.dll (0x7fefcf20000)
ADVAPI32.dll => /c/Windows/system32/ADVAPI32.dll (0x7fefd6a0000)
msvcrt.dll => /c/Windows/system32/msvcrt.dll (0x7fefd130000)
sechost.dll => /c/Windows/SYSTEM32/sechost.dll (0x7feff310000)
RPCRT4.dll => /c/Windows/system32/RPCRT4.dll (0x7fefe450000)
SHELL32.dll => /c/Windows/system32/SHELL32.dll (0x7fefe580000)
SHLWAPI.dll => /c/Windows/system32/SHLWAPI.dll (0x7fefe120000)
GDI32.dll => /c/Windows/system32/GDI32.dll (0x7fefda60000)
USER32.dll => /c/Windows/system32/USER32.dll (0x76e00000)
LPK.dll => /c/Windows/system32/LPK.dll (0x7fefd110000)
USP10.dll => /c/Windows/system32/USP10.dll (0x7fefd5d0000)
C:\msys64\usr\bin\ldd.exe C:\Tools\GHDL\0.34dev-mingw64-llvm\bin\ghdl1-llvm.exe
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x77020000)
kernel32.dll => /c/Windows/system32/kernel32.dll (0x76f00000)
KERNELBASE.dll => /c/Windows/system32/KERNELBASE.dll (0x7fefcf20000)
??? => ??? (0x6fe40000)
libstdc++-6.dll => /c/Program Files/gettext-iconv/libstdc++-6.dll (0x6fc40000)
libgcc_s_sjlj-1.dll => /c/Program Files/gettext-iconv/libgcc_s_sjlj-1.dll (0x6cec0000)
msvcrt.dll => /c/Windows/system32/msvcrt.dll (0x7fefd130000)
libwinpthread-1.dll => /c/Program Files/gettext-iconv/libwinpthread-1.dll (0x64940000)
USER32.dll => /c/Windows/system32/USER32.dll (0x76e00000)
GDI32.dll => /c/Windows/system32/GDI32.dll (0x7fefda60000)
LPK.dll => /c/Windows/system32/LPK.dll (0x7fefd110000)
USP10.dll => /c/Windows/system32/USP10.dll (0x7fefd5d0000)
我假设,第一个可执行文件 ghdl.exe 没问题,因为它只引用 Windows DLL。第二个可执行文件ghdl1-llvm.exe 有四个特殊条目:
libstdc++-6.dll => /c/Program Files/gettext-iconv/libstdc++-6.dlllibgcc_s_sjlj-1.dll => /c/Program Files/gettext-iconv/libgcc_s_sjlj-1.dlllibwinpthread-1.dll => /c/Program Files/gettext-iconv/libwinpthread-1.dll??? => ???
问题:
- 第一个意思是说,用户需要一个 C++ 包吗?这是 VC++ 6.0 可再发行版吗?
否则,Linux 上有一个 gettext 包... -
我编译了ghdl,它是用Ada编写的,带有llvm后端。我希望还有两个依赖项,例如在 Linux 上:
- llvm 3.8
- libgnat 6.3.0
OTOH,GHDL 也有一个
libgrt.a文件。如何从该文件中读取依赖项?
编辑 2:
哦,我认为编辑 1 中存在绑定错误。
如果我在 MinGW64 控制台中运行 ldd,我会看到 gettext 绑定到其他文件...
例如libstdc++-6.dll => /mingw64/bin/libstdc++-6.dll (0x6fc40000)
【问题讨论】:
标签: ghdl llvm windows package installation mingw-w64 msys2