Windows 下静态链接、正常工作的 readline 库?
我们正在开发一个 C++ 软件包,它依赖于 GNU readline 库,并且通常使用 gcc 进行构建(至少需要版本 4)。现在我们想将其移植到 Windows,获得一个静态链接版本,我们可以重新分发该版本,而无需用户编译。
我尝试了几种方法:
- 使用 Cygwin 构建(不使用提供的 readline 与
-mno-cygwin
或 MinGW 编译器相结合), - 使用 MinGW 和 GnuWin32 的 readline 构建(未解决对 stat64 的依赖关系,其中我无法解决),
- 使用 MinGW 构建并从源代码构建 readline 和所需的 pdcurses(最有前途的方法,获得静态二进制文件!但获得的交互式 shell 行为不正确,例如退格键未可视化)。
我们有什么想法可以让其中一种方法发挥作用吗?
We're developing a C++ software package which depends on the GNU readline library and we usually build using gcc (requiring at least version 4). Now we would like to port this to Windows, obtaining a statically linked version which we can redistribute without requiring compilation by users.
I've tried several approaches:
- Building using Cygwin (no go with the provided readline combined with
-mno-cygwin
or a MinGW compiler), - Building using MinGW and readline from GnuWin32 (unresolved dependencies to stat64, which I could not resolve),
- Building using MinGW and building readline and required pdcurses from source (most promising approach, got to a static binary! But the obtained interactive shell behaved incorrectly, e.g. backspace was not visualized).
Any ideas how we might get one of the approaches to work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
经过类似的挫折后,我刚刚使用 MinGW-w64。以下是我的做法:
dev 目录的布局:
为 32 位版本设置一些环境变量:
termcap 1.3.1。
运行配置脚本:
编辑 termcap.c 并修复顶部的几行。我的看起来像这样:
tparam.c
修改 Makefile:
之后调用 make install 并且它应该编译而不会出现警告或错误。
readline 6.2
在调用之前设置与 termcap 相同的 CPPFLAGS 和 LDFLAGS 变量:
编辑 Makefile:
make install 现在应该编译并安装 readline!
如果您想要 64 位库,请将 i686-w64-mingw32 替换为 x86_64-w64-mingw32,将 local32 替换为 local64 >。
After similar frustrations, I have just now compiled both a 32bit and 64bit version of libreadline 6.2 using MinGW-w64. Here's my how I did it:
Layout of my dev directory:
Set some environment variables for the 32 bit build:
termcap 1.3.1.
Run the configure script:
Edit termcap.c and fix up a few lines at the top. Mine looks like this:
and tparam.c
Modify the Makefile:
After that call make install and it should compile without warnings or errors.
readline 6.2
Set the same CPPFLAGS and LDFLAGS variables as with termcap before calling:
Edit the Makefile:
make install should now compile and install readline!
If you want a 64bit library, replace i686-w64-mingw32 with x86_64-w64-mingw32 and local32 with local64.
查看 MinGWEditLine 库
主要的 readline 功能是针对本机 Windows 控制台实现的。 BSD 许可证。
Check out MinGWEditLine library
Main readline functions are implemented for the native Windows console. BSD license.
gnuwin32 有一个 readline 端口: http://gnuwin32.sourceforge.net/packages/readline.htm< /a>
对于非 GPL 项目,libedit 具有更可接受的许可 [使用 BSD 许可]
gnuwin32 has a port of readline: http://gnuwin32.sourceforge.net/packages/readline.htm
for non-GPL projects, libedit has a more acceptable licensing [uses BSD licensing]
现在有一个 cygwin 的 readline 发行版,它对我有用。包名称为
libreadline-devel
There is now a cygwin distribution of readline, which worked for me. The package name is
libreadline-devel