Windows下静态链接,正确工作的readline库?

我们正在开发一个依赖于GNU readline库的C ++软件包,我们通常使用gcc构建(至少要求版本4)。现在我们想将它移植到Windows,获得一个静态链接的版本,我们可以重新分发,而无需用户编译。 我尝试了几种方法: 使用Cygwin构建(不使用提供的readline与
-mno-cygwin
或MinGW编译器结合使用), 使用MinGW和GnuWin32的readline构建(未解析的依赖关系到stat64,我无法解析), 使用MinGW构建并从源代码构建readline和必需的pdcurses(最有希望的方法,得到一个静态二进制文件!但是获得的交互式shell表现不正确,例如退格架没有可视化)。 我们如何获得其中一种工作方法的想法?     
已邀请:
在类似的挫折之后,我刚刚使用MinGW-w64编译了32位和64位版本的libreadline 6.2。这是我的表现方式: 我的开发目录的布局:
c:devmsys
c:devmingw32
c:devlocal32
c:devmingw64
c:devlocal64
为32位构建设置一些环境变量:
export CPPFLAGS=-I/c/dev/local32/include
export LDFLAGS=-L/c/dev/local32/lib
termcap 1.3.1。 运行configure脚本:
./configure --host=i686-w64_mingw32 --prefix=/c/dev/local32
编辑termcap.c并在顶部修改几行。我看起来像这样:
/* Emacs config.h may rename various library functions such as malloc.  */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#ifdef emacs

#include <lisp.h>       /* xmalloc is here */
/* Get the O_* definitions for open et al.  */
#include <sys/file.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
//#ifdef HAVE_UNISTD_H
#include <unistd.h>
//#endif

#else /* not emacs */

//#ifdef STDC_HEADERS
#include <stdlib.h>
#include <string.h>
#define bcopy(b1,b2,len) (memmove((b2), (b1), (len)), (void) 0)
//#else
//char *getenv ();
//char *malloc ();
//char *realloc ();
//#endif
和tparam.c
/* Emacs config.h may rename various library functions such as malloc.  */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#ifdef emacs
#include "lisp.h"       /* for xmalloc */
#else

//#ifdef STDC_HEADERS
#include <stdlib.h>
#include <string.h>
//#else
//char *malloc ();
//char *realloc ();
//#endif

/* Do this after the include, in case string.h prototypes bcopy.  */
//#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy)
#define bcopy(s, d, n) memcpy ((d), (s), (n))
//#endif

#endif /* not emacs */
修改Makefile:
Line 23: CC = i686-w64-mingw32-gcc
Line 24: AR = i686-w64-mingw32-ar
Line 36: prefix = /c/dev/local32
Line 49: #oldincludedir = /usr/local
在调用make install之后,它应该在没有警告或错误的情况下编译。 readline 6.2 在调用之前设置与termcap相同的CPPFLAGS和LDFLAGS变量:
./configure --prefix=/c/dev/local32 --host=i686-w64-mingw32 --enable-static --enable-shared
编辑Makefile:
Line 40: AR = i686-w64-mingw32-ar
make install现在应该编译并安装readline! 如果需要64位库,请将i686-w64-mingw32替换为* x86_64-w64-mingw32 *,将local32替换为local64。     
查看MinGWEditLine库   本机Windows控制台的EditLine API实现。这个获得BSD许可的库提供了类似于GNU Readline中的命令行编辑和历史功能。 主要的readline函数是为本机Windows控制台实现的。 BSD许可证。     
gnuwin32有一个readline端口:http://gnuwin32.sourceforge.net/packages/readline.htm 对于非GPL项目,libedit拥有更可接受的许可[使用BSD许可]     

要回复问题请先登录注册