[CXX-645] Attempting to build c++ driver on windows with SASL Created: 31/Jul/15  Updated: 11/Sep/19  Resolved: 10/Jan/16

Status: Closed
Project: C++ Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Thomas Gibson Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Trying to build mongo c++ driver on window with the --ssl and the --use_sasl_client. I have got the --ssl to build without the sasl however whenever I attempt to add the use_sasl_client option it stalls out checking the sasl2 library.

Is there clear instructions on how to build this on Windows.



 Comments   
Comment by Thomas Gibson [ 05/Aug/15 ]

Never mind it all works, was building from wrong VS command prompt. Thanks for the help.

Comment by Thomas Gibson [ 05/Aug/15 ]

Thank you Andrew, I am making a lot of progress. I was able to build the 32 bit version of the driver in both debug and release. I am still running into a problem with the 64 bit driver. I get an unresolved external Link error. I believe I am not properly building the sasl libraries in 64 bit. Any suggestions.

Comment by Andrew Morrow (Inactive) [ 04/Aug/15 ]

thomas.gibson - When the configure phase of SCons runs, it logs all test results to the file build/scons/config.log. You should be able to review that file to better understand what went wrong with the test for sasl_version_info. Please note that you might want to add the flag --config=force to your SCons invocation to inhibit configuration test result caching. Otherwise, the log file may not be very revealing.

Comment by Thomas Gibson [ 04/Aug/15 ]

I followed your directions to build the sasl Libraries. I however am still running into a problem. Also, I wanted to know if I needed to do anything different to build the 64bit sasl than the 32?

Input

scons-2.3.0 --prefix="D:\MONGO\build\client\x86\debug\" --32 --sharedclient --dynamic-windows --dbg=on --opt=on --dynamic-boost=off --cpppath="E:\boost" --libpath="E:\boost\lib32-msvc-12.0" --ssl --extrapath=C:\OpenSSL-Win32 --use-sasl-client --extrapath=E:\sasl install

output

scons: Reading SConscript files ...
scons version: 2.3.0
python version: 2 7 3 'final' 0
Checking whether the C++ compiler works(cached) yes
Checking whether the C compiler works(cached) yes
Checking if C++ compiler "$CC" is MSVC... (cached) yes
Checking if C compiler "cl" is MSVC... (cached) yes
Checking if we are using libstdc++... (cached) no
WARNING: Cannot disable C++11 features when using MSVC
Checking if we are on a POSIX system... (cached) no
Checking for VS 2013 Update 2 or Later... (cached) yes
Checking for __declspec(thread)... no
Checking for C++11 <atomic> support... no
Checking for C++ header file boost/version.hpp... yes
Checking for C header file unistd.h... no
Checking for sasl_version_info(0, 0, 0, 0, 0, 0) in C library sasl2... no

Comment by Jonathan Reams [ 04/Aug/15 ]

Thomas, we don't have public instructions on how to build the sasl library on windows. Our internal process mostly follows the instructions from here https://cyrusimap.org/docs/cyrus-sasl/2.1.25/windows.php. The following instructions install to c:\sasl. If want to build to an alternate directory, change c:\sasl to an appropriate directory.

  1. To build the library, obtain and the cyrus sasl sources from https://cyrusimap.org/index.php.
  2. Copy plugins\cram.c, plugins\plain.c to lib\cram.c, lib\plain.c
  3. Change four functions in the copied files to be exported into the DLL (prefix with LIBSASL_API to look as below):
    In lib\plain.c:

    LIBSASL_API int plain_server_plug_init(sasl_utils_t *utils, ...
    LIBSASL_API int plain_client_plug_init(sasl_utils_t *utils, ...

    In lib\cram.c:

    LIBSASL_API int crammd5_server_plug_init(sasl_utils_t *utils, ...
    LIBSASL_API int crammd5_client_plug_init(sasl_utils_t *utils, ...

  4. Add both files to NTMakefile in lib\

    libsasl_sources = cram.c plain.c auxprop.c <etc>
    libsasl_objs = cram.obj plain.obj auxprop.obj <etc>

  5. in cyrus-sasl-2.1.26\lib, using a VS command prompt, run nmake /f ntmakefile STATIC=no prefix=c:\sasl. Note this uses /MD.
  6. run nmake /f ntmakefile prefix=c:\sasl STATIC=no install in the same directory (lib), which will create a c:\sasl and put some files in it
  7. run nmake /f ntmakefile prefix=c:\sasl STATIC=no install in cyrus-sasl-2.1.26\include, to install the headers into the include directory
  8. run nmake /f ntmakefile prefix=c:\sasl STATIC=no install in cyrus-sasl-2.1.26\win32\include, to install more headers into the include directory
  9. Rename the installed c:\sasl\lib\libsasl.lib to c:\sasl\lib\sasl2.lib (this is what SCons looks for)

You'll need to run scons with --extrapath to specify the location of the \include and \lib directories for headers and library (e.g. --extrapath=c:\sasl). Let me know if you have any more questions.

Generated at Wed Feb 07 21:59:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.