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

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

我开始按照这里列出的指示,但很快意识到它已经过时了。

然后我发现了这一点 ,并意识到它也不是很正确。

我终于找到了这个 ,并且经历了这个家伙正在经历的确切错误。 然而,当我尝试他的工作时(在portable.h中评论第1116行)我遇到了更多的问题。

是否有用于构建此库的规范来源?

我正在使用:

  • Windows 7专业版。
  • Msys2(x86_64 20160205来自这里 )
  • OpenSSL(版本1.0.1r从这里 )
  • rxspencer(alpha 3.8.g7 from here )
  • OpenLDAP(版本2.4.44从这里开始 )

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

指出服务器/ slapd.def出了什么问题?

我在这做错了什么? 我做错了什么,构建根本不适用于Windows?

这么晚了。

我最近成功了

Windows 7旗舰版x64。

Msys2 x86_64 20160205

OpenLDAP 2.4.46 <==与您不同

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

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

感谢您的帮助,我能够克服portable.h和init.c问题。

然后我的make depend并毫无问题地取得成功。 我已经做了一些简单的测试,slapd正在为我工​​作,能够ldapsearch,ldapadd并从ldapAdmin连接到它。

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