There is one build error when building boost 1.46 + python 3.2 via VC++ 2008:
libs/python/src/converter/builtin_converters.cpp(436) : error C2664: 'PyUnicodeUCS2_AsWideChar' : cannot convert parameter 1 from 'PyUnicodeObject *' to 'PyObject *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Solution: change libs/python/src/converter/builtin_converters.cpp(436)
static std::wstring extract(PyObject* intermediate)
{
std::wstring result(::PyObject_Length(intermediate), L' ');
if (!result.empty())
{
int err = PyUnicode_AsWideChar(
/*(PyUnicodeObject *)*/intermediate // change this line, comment out the C style cast!!!
, &result[0]
, result.size());
if (err == -1)
throw_error_already_set();
}
return result;
}
Note: I also append the following to D:/opensource/boost_1_46_0/tools/build/v2/user-config.jam
###########################################################
using python
: 3.2 # Version
: C://Python32//python.exe # Python Path
: C://Python32//Include # include path(s) -they may be not really needed here
: C://Python32//libs # lib path(s) - they may be not really needed here
: <python-debugging>off <define>BOOST_ALL_NO_LIB=1
;
using python
: 3.2 # Version
: C://Python32//python.exe # Python Path
: C://Python32//Include # include path(s) -they may be not really needed here
: C://Python32//libs # lib path(s) - they may be not really needed here
: <python-debugging>on <define>BOOST_ALL_NO_LIB=1
;
###########################################################
I also need to modify the following line in D:/src/boost_1_46_0/libs/python/src/module.cpp
BOOST_PYTHON_DECL PyObject* init_module(PyModuleDef& moduledef, void(*init_function)())
Otherwise there is a link error:
error LNK2001: unresolved external symbol "__declspec(dllimport) struct _object * __cdecl boost::python::detail::init_module(struct PyModuleDef &,void (__cdecl*)(void))" (__imp_?init_module@detail@python@boost@@YAPAU_object@@AAUPyModuleDef@@P6AXXZ@Z)
boost.log is only compatible with boost.filesystem v2, but boost 1.46 is using boost.filesystem v3 by default.
compile-c-c++ bin.v2/libs/log/build/msvc-10.0/release/link-static/runtime-link-static/threading-multi/text_file_backend.obj
text_file_backend.cpp
./boost/log/detail/universal_path.hpp(46) : error C2039: 'external_string_type' : is not a member of 'boost::filesystem3::path'
The following command can be used to build boost.log.
bjam.exe --with-log --toolset=msvc stage --build-type=complete define=BOOST_FILESYSTEM_VERSION=2
I created a batch file to build the boost library.
rem call "%VS100COMNTOOLS%/../../vc/bin/vcvars32.bat"
call "%VS90COMNTOOLS%/../../VC/vcvarsall.bat"
cd /d D:/opensource/boost_1_46_0
echo Update D:/opensource/boost_1_46_0/tools/build/v2/user-config.jam
call bootstrap.bat
set ICU_PATH=D:/opensource/icu4c-4_6-src/icu
echo "build start" >> buildtime.txt
time /t >> buildtime.txt
bjam.exe --toolset=msvc stage --build-type=complete -sBZIP2_SOURCE=D:/opensource/bzip2-1.0.5 -sZLIB_SOURCE=D:/opensource/zlib-1.2.5 -sICU_PATH="D:/opensource/icu4c-4_4_1-Win32-msvc9/icu" >> msvc10.log
time /t >> buildtime.txt
echo "build finished" >> buildtime.txt
Use boost.log in DLL
When I am using boost.log in DLL, the Debug configuration will raise the following error:
---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!
Program: E:/svn/trunk/Debug/Onegad.exe
File: f:/dd/vctools/vc7libs/ship/atlmfc/src/mfc/dllinit.cpp
Line: 587
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
---------------------------
Abort Retry Ignore
---------------------------
compile with Intel C++ compiler
C:/tmp/boost_1_35_0/libs/program_options/build>../../../bjam.exe --toolset=intel release
C:/tmp/boost_1_35_0/libs/program_options/build>../../../bjam.exe --toolset=intel
C:/tmp/boost_1_35_0/libs/program_options/build>../../../bjam.exe --toolset=intel link=static debug release