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

标签 c windows openldap mingw-w64 msys2

我正在尝试在 Windows 上构建 OpenLDAP。我很难做到这一点。

我开始遵循概述的指示 here ,但很快意识到它已经过时了。

然后我发现this ,并意识到这也不完全正确。

我终于找到了this ,并经历了这个家伙正在经历的确切错误。然而,当我尝试他的解决方案(注释掉第 1116 行)时,我遇到了更多问题。

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

我正在使用:

  • Windows 7 专业版。
  • Msys2(x86_64 20160205,来自 here)
  • OpenSSL(版本 1.0.1r,来自 here)
  • rxspencer(来自 here 的 alpha 3.8.g7)
  • OpenLDAP(版本 2.4.44,来自 here)

第0步:

编译rxspencer

./configure
make
make check
make install

第 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

第 2 步:

修改路径,以便configure能够看到rxspencer

PATH=$PATH:/usr/local/lib

第 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

这有效。太棒了!

第 4 步:

make depend 2>&1 | tee output_makedepend.log

这有效。太棒了!

第 5 步:

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

第 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;

添加:

#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 问题。

然后我的 make dependentmake 毫无问题地成功了。我用它做了一些简单的测试,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 header 丢失的问题,但它仍然有效。

关于c - 如何使用 Msys2 和 MinGW 在 Windows 上构建 OpenLDAP 库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36435795/

相关文章:

c++ - 如何在 C/C++ PCRE 正则表达式中使用 UTF-8 文字字符?

python - 程序退出时消息中的异常被忽略

linux - 每个用户的 LDAP 特定 ACL

ldap_sasl_interactive_bind_s : No such attribute (16)

c - 如何将通用结构传递给 C 中的函数?

c - ULONG的高8位如何清零和置位

c - 打印链表中的值对

c - 在程序的生命周期中使用 malloc

c++ - Win32 上的 LAPACK

linux - openLdap BerkleyDB 编译问题