如何使用 Msys2 和 MinGW 在 Windows 上构建 OpenLDAP 库?

2023-12-28

我正在尝试在 Windows 上构建 OpenLDAP。我这样做非常困难。

我开始按照概述的指示进行操作here http://www.openldap.org/faq/data/cache/302.html,但很快意识到它已经过时了。

然后我发现this https://bowmansolutions.com/mingw-openldap/,并意识到这也不完全正确。

我终于找到了this http://www.openldap.org/its/index.cgi/Incoming?id=8383;selectid=8383,并经历了这个家伙正在经历的确切错误。然而,当我尝试他的解决方案(注释掉 portable.h 中的第 1116 行)时,我遇到了更多问题。

有构建这个库的规范来源吗?

我在用着:

  • Windows 7 专业版。
  • Msys2(x86_64 20160205 来自here https://msys2.github.io/)
  • OpenSSL(版本 1.0.1r 来自here https://www.openssl.org/source/old/1.0.1/openssl-1.0.1r.tar.gz)
  • rxspencer(来自 alpha 3.8.g7here https://github.com/garyhouston/rxspencer/archive/alpha3.8.g7.tar.gz)
  • OpenLDAP(版本 2.4.44 来自here ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-2.4.44.tgz)

Step 0:

编译rxspencer

./configure
make
make check
make install

Step 1:

使用 Visual Studio 2010 x64 命令提示符编译 OpenSSL

perl Configure no-ssl2 VC-WIN64A --prefix=d:\temp\openssl\x64
./ms/do_win64a.bat

nmake -f ms\nt.mak
nmake -f ms\ntdll.mak
cd out32
..\ms\test

Step 2:

修改路径,这样configure就能看到rxspencer

PATH=$PATH:/usr/local/lib

Step 3:

env \
CFLAGS="-I/usr/local/include/rxspencer" \
LD_LIBRARY_PATH="/c/work/openssl/lib:/usr/local/lib" \
LDFLAGS="-L/c/work/openssl/lib -L/usr/local/lib" \
CPPFLAGS="-I/c/work/openssl/include" \
LIBS="-lssl -lrxspencer" \
./configure \
--enable-shared \
--enable-static \
--with-tls \
--disable-bdb \
--disable-hdb \
2>&1 | tee output_config.log

这有效。出色的!

Step 4:

make depend 2>&1 | tee output_makedepend.log

这有效。出色的!

Step 5:

注释掉 include/portable.h 中的第 1116 行

Step 6:

make 2>&1 | tee output_make.log

观察出现的一堆错误,如下所示:

In file included from init.c:25:0:
back-mdb.h:71:2: error: unknown type name 'uint32_t'
  uint32_t mi_dbenv_flags;
  ^
back-mdb.h:84:2: error: unknown type name 'uint32_t'
  uint32_t mi_rtxn_size;
  ^
back-mdb.h:86:2: error: unknown type name 'uint32_t'
  uint32_t mi_txn_cp_min;
  ^
back-mdb.h:87:2: error: unknown type name 'uint32_t'
  uint32_t mi_txn_cp_kbyte;
  ^
init.c: In function 'mdb_db_open':
init.c:88:2: error: unknown type name 'uint32_t'
  uint32_t flags;

Add:

#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif

到顶部

servers/slapd/back-mdb/back-mdb.h

再做一次...

现在我有一堆如下所示的错误:

symdummy.c:1:5: error: expected identifier or '(' before string constant
 int ".refptr.ad_index_mutex"();
     ^
symdummy.c:2:5: error: expected identifier or '(' before string constant
 int ".refptr.ad_undef_mutex"();
     ^
symdummy.c:3:5: error: expected identifier or '(' before string constant
 int ".refptr.at_oc_cache"();
 ^

指出servers/slapd.def 出了什么问题?

我在这里做错了什么?我是否做错了什么并且构建在 Windows 上根本不起作用?


对此已经很晚了。

我最近成功了

Windows 7 旗舰版 x64。

Msys2 x86_64 20160205

OpenLDAP 2.4.46

我也像你一样禁用了 hdb 和 bdb 。我启用了共享库,但不确定它们是否已编译。

我注意到这可能不是您想要的完整列表,只是想分享。

多亏了你的帮助,我才能够克服 portable.h 和 init.c 问题。

Then my make depend and make毫无问题地成功了。我用它做了一些简单的测试,slapd 正在为我工​​作,能够 ldapsearch、ldapadd 并从 ldapAdmin 连接到它。

在 make dependent 期间,我确实看到了 nt_err.c 问题,并且必须手动将其从 openldap-2.4.46/libraries/liblber/nt_err.c 复制到 /openldap-2.4.46/servers/slapd/slapi 以跳过该警告。但我无法解决 netdb.h 标头丢失问题,但它仍然有效。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何使用 Msys2 和 MinGW 在 Windows 上构建 OpenLDAP 库? 的相关文章

随机推荐