Need help compiling mozldap-6.0.7 in 64 bit Windows

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Need help compiling mozldap-6.0.7 in 64 bit Windows

Andrew Y.
Trying to upgrade our isapi filter that uses an old 32 bit openldap50 library.  Everything needs to be 64 bit and therefore including the open ldap sdk.  I downloaded the latest version which is mozldap-6.0.7 and the MozillaBuild 1.3.  I installed VC2012.  I fixed some syntax problem in the ldapsdk.mak file.  I started the MozillaBuild and issue the make command "make -f ldapsdk.mak build_all".  The MozillaBuild complaint that the nsldap.mak file does not exist.  The ldapsdk.mak make file is looking for the nsldap.mak file within the folder c-sdk/ldap/libraries/msdos/winsock and indeed the file does not exist.  Am I doing the right thing or this is not the way to build the sdk.  Am I missing some steps prior to this build such as needing to download other modules and configure those first?  I appreciate if someone can help.

C:\mozilla\directory>c:\mozilla-build\start-msvc11-x64.bat
"Mozilla tools directory: c:\mozilla-build\"
Visual C++ 6 directory:
Visual C++ 7.1 directory:
Visual C++ 8 directory:
Visual C++ 8 Express directory:
Visual C++ 9 directory:
Visual C++ 9 Express directory:
Platform SDK directory:
Platform SDK version:
Using VC 2012 built-in SDK
The system cannot find the path specified.
Mozilla build environment: MSVC version 11.

andrewy@11C-1040 ~
$ cd ../../mozilla/directory/

andrewy@11C-1040 /c/mozilla/directory
$ make -f ldapsdk.mak build_all
+++ ldapsdk.mak: building ldap
cd c-sdk/ldap/libraries/msdos/winsock
+++ ldapsdk.mak: depend step
NMAKE : fatal error U1052: file 'nsldap.mak' not found
Stop.
make: *** [build_ldap] Error 2
_______________________________________________
dev-tech-ldap mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-ldap
Reply | Threaded
Open this post in threaded view
|

Re: Need help compiling mozldap-6.0.7 in 64 bit Windows

Mathias Fricke
hi,

i include my notes from the same procedure. it's been a while since i did  
it and i am happy to say that in the foreseeable future there's no need to  
do it again -- building MOZLDAP for Windows is one of the worst nightmares  
i've encountered ... (yes, i am spoiled linux user)
i certainly hope that either someone creates reliable binaries to be  
downloaded or that this preposterous way to build is replaced by something  
less sick and better documented.

- VS 2010 was used
- check paths

<notes>

ftp://ftp.mozilla.org/pub/mozilla.org/directory/c-sdk/releases/v6.0.4/ldapcsdk-6.0.3-WINNT5.2_DBG.OBJ.zip

more recent:

http://www.devsource.com/c/a/Using-VS/Working-at-the-Visual-Studio-Command-Line/

!!!MAKE SURE TO HAVE NO SPACES IN FOLDER OR FILE NAMES!!!
unpack all mozilla stuff into the same structure (mozilla/directory) --  
that way everything will end up in mozilla/dist/:x

NSS/NSPR:
- get and install  
http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe
- get and unpack latest NSS/NSPR sources from  
https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_<VERSION>_RTM/src/nss-<VERSION>-with-nspr-<VERSION>.tar.gz
- in Windows go to MozillaBuildSetup's install dir and start with  
start-msvcXX.bat where XX equals the msvcr dll from the installed VS  
(80=VS2005, 90=VS2008, 10=VS2010, ...) - a shell will open up
- cd to the folder you unpacked the NSS into
- cd to folder nsprpub/ and do configure && make -- .dlls and .libs should  
be created
!!!64BIT:
* export BUILD_OPT=1 USE_64=1
* ./configure --enable-64bit
!!!
- cd to folder ../security/dbm/ and do
$  
INCLUDES+="-I/c/Users/username/Desktop/SW_Development/nss-3.13.3/mozilla/nsprpub/dist/include/nspr/  
-I/c/Users/username/Desktop/SW_Development/nss-3.13.3/mozilla/security/dbm/include"  
\
make
- .dll and .lib should be created (? neither nor -- is it an .obj and  
linked in statically into NSS?)
- make sure the path of NSPR_LIB_DIR is a dos style path! it becomes  
argument for VS' linker which only understands dos style paths (LNK1104  
may occure otherwise)
- cd to folder ../nss and do

$  
NSPR_LIB_DIR="c:/Users/username/Desktop/SW_Development/nss-3.13.3/mozilla/nsprpub/dist/lib"  
\
INCLUDES+="-I/c/Users/username/Desktop/SW_Development/nss-3.13.3/mozilla/nsprpub/dist/include/nspr/  
-I/c/Users/username/Desktop/SW_Development/nss-3.13.3/mozilla/security/dbm/include"  
\
make


- use absolute paths for includes -- you'll never know how deep the  
calling folder/file will be in the hierarchy (there's probably a  
configuration option somewehere -- but documentation is bad)

- use

$ RELEASE_TREE="<somefolder>"  
NSPR_LIB_DIR="c:/Users/username/Desktop/SW_Development/nss-3.13.3/mozilla/nsprpub/dist/lib"  
\
INCLUDES+="-I/c/Users/username/Desktop/SW_Development/nss-3.13.3/mozilla/nsprpub/dist/include/nspr/  
-I/c/Users/username/Desktop/SW_Development/nss-3.13.3/mozilla/security/dbm/include"  
\
make release

to export headers as one jar and exe/lib/dll as another in  
<somefolder>/nss/

- true to style, it's not that simple with NSPR (internal paths hardcoded,  
no checks for external and so on) -- so, simply do

BUILD_NUMBER=<whatever> make relase

it will finish with an error, but create a folder  
dist/release/nspr20/<whatever>/ containing everything and more. just zip  
that


OpenSSL:

necessary only for SASL SCARM plugin -- if you disable that, we don't go  
through all the hassle (which doesn't work in 64bit so far anyway)

* for MingW on Linux see below! *
http://www.timvw.be/2008/04/21/build-openssl-with-visual-studio-2008/ (no  
idea what file he changed)
http://wiki.apache.org/httpd/Win64Compilation
* WIN64A does not work, use MingW/Linux *
- get and unpack from http://www.openssl.org/source/
- you may need to install NASM from  
http://www.nasm.us/pub/nasm/releasebuilds/<VERSION>/win32/ and add it to  
the path of the VS console below
- open VS shell, this will set all necessary variables: Start -> VS -> VS  
Tools -> VS Command Prompt (make sure to use the 32bit for now) and add  
MozillaBuild's perl to the PATH
PATH=<pathtoperl>;%PATH%
- do
perl Configure VC-WIN32 --prefix=../ossl
- and then either
ms\do_nt.bat OR ms\do_nasm.bat
OR (WIN64A does not work apparently, errors over errors)
perl Configure VC-WIN64A --prefix=../ossl
ms\dowin64a.bat

- if there's an error you may need to patch util/mk1mf.pl (see  
http://stackoverflow.com/questions/7680189/openssl-cant-build-in-vc-2010):
<quote>
The problem seems to be related to eol (end of lines). The solution is to  
patch mk1mf.pl to make it remove the carriage-return:
Index: mk1mf.pl
===================================================================
--- mk1mf.pl    (revision 88908)
+++ mk1mf.pl    (working copy)
@@ -315,7 +315,7 @@
  for (;;)
         {
         chop;

+       s/\r$//; #remove carriage return too!
         ($key,$val)=/^([^=]+)=(.*)/;
         if ($key eq "RELATIVE_DIRECTORY")
                 {

Found the solution in openssl users mailing:

http://groups.google.com/group/mailing.openssl.users/browse_thread/thread/42a8f226f1fc279f)
</quote>

- next
nmake -f ms\ntdll.mak
- when assembler (ml) fails in x86cpuid.asm, maybe type of  
_OPENSSL_ia32cap_P has to be changed from QWORD to DWORD? problem does not  
occure with NASM
- when build hangs while trying to write >tmp32dll\sha1-586.asm -- cancel  
and call manually. all those processor/compiler flags confuse perl ...

perl crypto\sha\asm\sha1-586.pl win32n /MD /Ox /O2 /Ob2  
>tmp32dll\sha1-586.asm

- do again

nmake -f ms\ntdll.mak
nmake -f ms\ntdll.mak test
nmake -f ms\ntdll.mak install


*** MingW/Linux ***
http://marc.waeckerlin.org/computer/blog/openssl_fuer_windows_mingw_unter_linux_crosscomilieren
http://www.blogcompiler.com/2011/12/21/openssl-for-windows/
- install
binutils-mingw-w64-i686
binutils-mingw-w64
binutils-mingw-w64-x86-64
gcc-mingw-w64
mingw-w64-dev
mingw-w64
mingw-w64-tools

- go to unpacked sources and do
./Configure --prefix=/tmp/ossl64  
--cross-compile-prefix="x86_64-w64-mingw32-" mingw64 shared
- "mingw64" to compile in mingw environment 64bit dlls
- "shared" to get dlls
- --cross-compile-prefix="x86_64-w64-mingw32-" so that gcc, ld, ... are  
prefixed and thus the mingw ones are used


SASL:
- get und unpack latest  
http://asg3.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-<VERSION>.tar.gz
- patch NTMakefile in plugins/ and utils/ to make SASLDB optional (not  
needed in client anyway) with SASL_[plugins|utils]_NTMakefile.patch --  
work with 2.1.25, based on  
ftp://ftp.mozilla.org/pub/mozilla.org/directory/c-sdk/patches/

patch --dry-run -p0 < SASL_..._NTMakefile.patch (test, if ok remove  
--dry-run)

- open VS shell, this will set all necessary variables: Start -> VS -> VS  
Tools -> VS Command Prompt (make sure to use the 32bit for now)
- add OpenSSL includes to path:

set  
INCLUDES=%INCLUDES%;c:\Users\username\Desktop\SW_Development\ossl\include\  
(same path as in --prefix from OpenSSL compilation!)
set OPENSSL_INCLUDE=c:\Users\username\Desktop\SW_Development\ossl\include\  
(same path as in --prefix from OpenSSL compilation!)

- add OpenSSL libs to path:

set LIB=%LIB%;c:\Users\username\Desktop\SW_Development\ossl\lib\ (same  
path as in --prefix from OpenSSL compilation!)
set OPENSSL_LIBPATHc:\Users\username\Desktop\SW_Development\ossl\lib\  
(same path as in --prefix from OpenSSL compilation!)

- do

nmake -f NTMakefile

- if that's ok, do

nmake -f NTMakefile install

this will install into C:\CMU! apparently even developers of OSS don't  
really believe in the user when it comes to Windows ... to change that one  
would need to change several lines in several config files, no single  
option
!!! WIN64: i disabled SCRAM since the OpenSSL did not provide .lib files  
to link against: !!!
plguins/NTMakefile:
line 2: set from =1 to SCRAM=0
line 54: removed saslSCRAM.dll

SRVCORE???

LDAP C SDK:
- configure

export  
SASL_LIBS=c:/Users/username/Desktop/SW_Development/CMU_2.1.25/lib/libsasl.lib  
(MS linker needs this -- else it fails b/c libsasl.lib not found)
./configure  
--with-nss-inc=/c/Users/username/Desktop/SW_Development/nss-3.13.3/mozilla/dist/release/no-policy/include/  
--with-nss-lib=/c/Users/username/Desktop/SW_Development/nss-3.13.3/mozilla/dist/release/no-policy/WINNT6.1_DBG.OBJ/lib/  
--with-nspr-inc=/c/Users//username//Desktop/SW_Development/nss-3.13.3/mozilla/nsprpub/dist/release/nspr20/4.9_20120320/include/  
--with-nspr-lib=/c/Users/username/Desktop/SW_Development/nss-3.13.3/mozilla/nsprpub/dist/release/nspr20/4.9_20120320/lib/  
--with-sasl-inc=/c/Users/username/Desktop/SW_Development/cyrus-sasl-2.1.25/include/

- make

make
make install

- results will be in
C:\Users\username\Desktop\SW_Development\mozldap-6.0.7\mozilla\dist\

</notes>

HTH a little

> Trying to upgrade our isapi filter that uses an old 32 bit openldap50  
> library.  Everything needs to be 64 bit and therefore including the open  
> ldap sdk.  I downloaded the latest version which is mozldap-6.0.7 and  
> the MozillaBuild 1.3.  I installed VC2012.  I fixed some syntax problem  
> in the ldapsdk.mak file.  I started the MozillaBuild and issue the make  
> command "make -f ldapsdk.mak build_all".  The MozillaBuild complaint  
> that the nsldap.mak file does not exist.  The ldapsdk.mak make file is  
> looking for the nsldap.mak file within the folder  
> c-sdk/ldap/libraries/msdos/winsock and indeed the file does not exist.  
> Am I doing the right thing or this is not the way to build the sdk.  Am  
> I missing some steps prior to this build such as needing to download  
> other modules and configure those first?  I appreciate if someone can  
> help.
>
> C:\mozilla\directory>c:\mozilla-build\start-msvc11-x64.bat
> "Mozilla tools directory: c:\mozilla-build\"
> Visual C++ 6 directory:
> Visual C++ 7.1 directory:
> Visual C++ 8 directory:
> Visual C++ 8 Express directory:
> Visual C++ 9 directory:
> Visual C++ 9 Express directory:
> Platform SDK directory:
> Platform SDK version:
> Using VC 2012 built-in SDK
> The system cannot find the path specified.
> Mozilla build environment: MSVC version 11.
>
> andrewy@11C-1040 ~
> $ cd ../../mozilla/directory/
>
> andrewy@11C-1040 /c/mozilla/directory
> $ make -f ldapsdk.mak build_all
> +++ ldapsdk.mak: building ldap
> cd c-sdk/ldap/libraries/msdos/winsock
> +++ ldapsdk.mak: depend step
> NMAKE : fatal error U1052: file 'nsldap.mak' not found
> Stop.
> make: *** [build_ldap] Error 2
> _______________________________________________
> dev-tech-ldap mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-tech-ldap

_______________________________________________
dev-tech-ldap mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-ldap