Windows 7 Notes
The uma::bson library has been tested on Windows 7 64 bit using Microsoft Visual Studio 2010. The API and unit test suite has been built and tested for 64 bit builds. See notes towards bottom of page for 32 bit builds.
Prerequisites
- Download the latest version of the boost library (tested with 1.51) and unarchive as \usr\local\boost. We need only the headers, so building is not required.
- Download the latest version (tested with 1.4.4) of the Poco library and unarchive as \usr\local\poco. Open the various 64 bit MSVS 2010 projects under Foundation, XML, and Util and build the shared libraries for debug and release targets.
- Download the latest (tested with 4.8.3) Qt library sources to \Qt\qt-4.8.3 and build the 64 bit version.
- Optionally download and install the Qt Visual Studio Addin, and Qt Creator
- Optionally download the current MongoDB binary distribution and unarchive as \usr\local\mongodb. We use the bsondump.exe utility to perform validation on the test bson output as part of the unit test suite.
Assumptions
Most of the instructions on this page assume the following:
- Boost library base directory is \usr\local\boost
- Poco library base directory is \usr\local\poco
- Qt library base directory is \Qt\qt-4.8.3 (pre-built 32 bit version of Qt installs under \Qt\4.8.3)
- uma::bson sources checked out to %homepath%\Documents\projects\mongoviewer\bson
Build & Test
Build Qt
Launch the Win64 x64 command prompt tool from the VS 2010 menu.
cd \Qt\qt-4.8.3
configure -opensource -platform win32-msvc2010 -nomake examples \
-nomake demos -mp -debug -release
nmake
It will take quite a while to finish building Qt.
Build uma::bson
A couple of scripts have been provided under the bin folder in the source distribution to help build and run the unit test suite. The bin\win64.bat file is the script that we use to quickly build the API and run the unit test suite. The bin\win32.bat file is set up to build and run the unit test suite for 32 bit builds, but as noted towards the end of this page, there are issues with 32 bit builds.
Launch the Win64 x64 command prompt tool from the VS 2010 menu.
cd %homepath%\Documents\projects\mongoviewer\bson
bin\win64
Script output
Setting up Qt Creator
Launch Qt Creator and go to Tools->Options. Select the “Build & Run” tab and manually add a new Qt version using the qmake executable that was generated by building the 64 bit version of Qt.
Qt Settings
Open the uma.pro and test.pro files from the uma::bson project in Qt Creator. It would be best to create a new session (named BSON perhaps), switch to the session and then open the projects. This will save the dependency on the uma.pro project for test.pro project.
Configure the uma and test projects as shown in the screen captures.
UMA project set up
Test project build settings
Test project run settings
32 bit build
At present the unit test suite crashes on 32 bit builds. We have narrowed the issue down to some memory corruption in the object id (_id) field that is automatically set in new uma::bson::Document instances. For some reason, on windows 32 bit builds, the _id field memory gets corrupted, and leads to a crash.
Changing Build Type
These are the steps to be performed to move between 64 bit and 32 bit builds:
- Edit uma.pro and test.pro files. Use -L/usr/local/poco/lib64 for 64 bit and -L/usr/local/poco/lib for 32 bit builds.
- In the projects tab in Qt Creator, select the appropriate “Qt version:” setting.
- Rebuild all the sources. If using the batch files, it would be safest to run it from the appropriate command prompt tool from VS 2010.
cd %homepath%\Documents\projects\mongoviewer\bsonrmdir /s /q buildbin\win32cd %homepath%\Documents\projects\mongoviewer\bsonrmdir /s /q buildbin\win64