简体   繁体   English

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

[英]How do you build OpenLDAP libraries on Windows using Msys2 and MinGW?

I'm trying to build OpenLDAP on Windows.我正在尝试在 Windows 上构建 OpenLDAP。 I'm having extreme difficulty doing so.我这样做非常困难。

I started to follow the directions outlined here , but quickly realized that it was out of date.我开始按照此处概述的说明进行操作,但很快意识到它已经过时了。

I then found this , and realized it wasn't quite right either.然后我发现了this ,并意识到它也不完全正确。

I finally found this , and experienced the exact bug that this guy is experiencing.我终于找到了这个,并经历了这个人正在经历的确切错误。 However, when I try his work around (commenting out line 1116 in portable.h) I ran into more issues.然而,当我尝试他的工作时(在portable.h 中注释掉第1116 行)我遇到了更多问题。

Is there a canonical source for building this library?是否有用于构建此库的规范来源?

I'm using:我正在使用:

  • Windows 7 Professional. Windows 7 专业版。
  • Msys2 (x86_64 20160205 from here ) Msys2 (x86_64 20160205 从这里)
  • OpenSSL (version 1.0.1r from here ) OpenSSL(来自 此处的1.0.1r 版)
  • rxspencer (alpha 3.8.g7 from here ) rxspencer(来自此处的alpha 3.8.g7)
  • OpenLDAP (version 2.4.44 from here ) OpenLDAP(来自此处的2.4.44 版)

Step 0:第 0 步:

Compile rxspencer编译rxspencer

./configure
make
make check
make install

Step 1:第1步:

Compile OpenSSL using a Visual Studio 2010 x64 command prompt使用 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:第2步:

Modify the path so that configure will be able to see rxspencer修改路径,configure 就能看到rxspencer

PATH=$PATH:/usr/local/lib

Step 3:第 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

This works.这有效。 Excellent!优秀!

Step 4:第四步:

make depend 2>&1 | tee output_makedepend.log

This works.这有效。 Excellent!优秀!

Step 5:第 5 步:

Comment out line 1116 from include/portable.h从 include/portable.h 注释掉第 1116 行

Step 6:第 6 步:

make 2>&1 | tee output_make.log

Watch a bunch of errors appear that look like this:观看出现的一堆错误,如下所示:

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

to the top of到顶部

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

make again...再做...

Now I have a bunch of errors that look like this:现在我有一堆看起来像这样的错误:

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"();
 ^

pointing to something going wrong with servers/slapd.def?指出服务器/slapd.def 出了什么问题?

What am I doing wrong here?我在这里做错了什么? Am I doing anything wrong and the build just doesn't work at all for Windows?我做错了什么并且构建根本不适用于Windows吗?

quite late for this.很晚了。

I recently succeeded with我最近成功了

Windows 7 Ultimate x64. Windows 7 旗舰版 x64。

Msys2 x86_64 20160205 Msys2 x86_64 20160205

OpenLDAP 2.4.46 <== different from you OpenLDAP 2.4.46 <== 与你不同

I disabled hdb and bdb same as you did as well.我和你一样禁用了 hdb 和 bdb。 I enabled-shared lib, but not sure if they got compiled.我启用了共享库,但不确定它们是否被编译。

I notice this may not be the full list of what you want, just trying to share.我注意到这可能不是您想要的完整列表,只是想分享一下。

And it is thanks to your help I was able to overcome that portable.h and init.c problem.多亏了你的帮助,我才能够克服那个portable.h 和init.c 的问题。

Then my make depend and make succeeded without problem.然后我的make depend并且make成功而没有问题。 I have done some simple test with it the slapd is working for me, are able to ldapsearch, ldapadd and connect to it from ldapAdmin.我已经用它做了一些简单的测试,slapd 正在为我工​​作,能够 ldapsearch、ldapadd 并从 ldapAdmin 连接到它。

during make depend, I did see the nt_err.c problem and have to manually copy it from openldap-2.4.46/libraries/liblber/nt_err.c to /openldap-2.4.46/servers/slapd/slapi to skip that warning.在 make Depend 期间,我确实看到了 nt_err.c 问题,并且必须手动将其从 openldap-2.4.46/libraries/liblber/nt_err.c 复制到 /openldap-2.4.46/servers/slapd/slapi 以跳过该警告。 But I cannot solve the netdb.h header missing problem, none the less it still worked.但是我无法解决 netdb.h 标头丢失问题,但它仍然有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM