问题
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.
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?
I'm using:
- 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)
Step 0:
Compile rxspencer
./configure
make
make check
make install
Step 1:
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
Step 2:
Modify the path so that configure will be able to see 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
This works. Excellent!
Step 4:
make depend 2>&1 | tee output_makedepend.log
This works. Excellent!
Step 5:
Comment out line 1116 from include/portable.h
Step 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?
What am I doing wrong here? Am I doing anything wrong and the build just doesn't work at all for Windows?
回答1:
quite late for this.
I recently succeeded with
Windows 7 Ultimate x64.
Msys2 x86_64 20160205
OpenLDAP 2.4.46 <== different from you
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.
And it is thanks to your help I was able to overcome that portable.h and init.c problem.
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.
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.
来源:https://stackoverflow.com/questions/36435795/how-do-you-build-openldap-libraries-on-windows-using-msys2-and-mingw