如何使用Msys2和MinGW在Windows上构建OpenLDAP库? [英] How do you build OpenLDAP libraries on Windows using Msys2 and MinGW?

查看:198
本文介绍了如何使用Msys2和MinGW在Windows上构建OpenLDAP库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to build OpenLDAP on Windows. 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.

我终于找到了,经历了这个家伙正在经历的确切错误.但是,当我尝试解决他的问题时(在Portable.h中注释了1116行),我遇到了更多问题.

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.

是否有建立该库的规范资源?

Is there a canonical source for building this library?

我正在使用:

  • Windows 7 Professional.
  • Msys2 (x86_64 20160205 from here)
  • OpenSSL (version 1.0.1r from here)
  • rxspencer (alpha 3.8.g7 from here)
  • OpenLDAP (version 2.4.44 from here)

第0步:

编译rxspencer

Compile rxspencer

./configure
make
make check
make install

第1步:

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

Compile OpenSSL using a Visual Studio 2010 x64 command prompt

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

Modify the path so that configure will be able to see 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行

Comment out line 1116 from include/portable.h

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

添加:

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

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

再做一次...

现在我有很多类似这样的错误:

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

是否指出server/slapd.def出了什么问题?

pointing to something going wrong with servers/slapd.def?

我在这里做错了什么?我做错什么了吗,而该构建对于Windows根本不起作用?

What am I doing wrong here? Am I doing anything wrong and the build just doesn't work at all for Windows?

推荐答案

为此很晚.

我最近成功

Windows 7 Ultimate x64.

Windows 7 Ultimate x64.

Msys2 x86_64 20160205

Msys2 x86_64 20160205

OpenLDAP 2.4.46< ==与您不同

OpenLDAP 2.4.46 <== different from you

与您一样,我禁用了hdb和bdb.我启用了共享库,但不确定它们是否已编译.

I disabled hdb and bdb same as you did as well. 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.

在您的帮助下,我得以克服了Portable.h和init.c的问题.

And it is thanks to your help I was able to overcome that portable.h and init.c problem.

然后我的make dependmake顺利完成,没有问题.我已经使用slapd为我进行了一些简单的测试,能够ldapsearch,ldapadd并从ldapAdmin连接到它.

Then my make depend and make succeeded without problem. 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.

在makedepend期间,我确实看到了nt_err.c问题,必须手动将其从openldap-2.4.46/libraries/liblber/nt_err.c复制到/openldap-2.4.46/servers/slapd/slapi才能跳过那警告.但是我仍然无法解决netdb.h标头丢失的问题,尽管它仍然可以正常工作.

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. But I cannot solve the netdb.h header missing problem, none the less it still worked.

这篇关于如何使用Msys2和MinGW在Windows上构建OpenLDAP库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆