build boost.python tutorial "hello world" without bjam
hi there, for some days i try to build the boost.python tutorial "hello world" without bjam on winxp by using mingw. so i wrote a *.bat-file: // --- snip ----------------------------------------------------------------------------- @echo off SETLOCAL SET DIR_MINGW=c:\development_compiler\mingw\ SET DIR_BOOST=c:\development_compiler\_boost\ SET DIR_PYTHN=c:\development_compiler\python25\ SET DIR_PRJCT=%~dp0 SET NME_PRJCT=hello SET CC=c:\development_compiler\mingw\bin\g++.exe SET INCL=-I%DIR_BOOST%include\boost-1_34_1 -I%DIR_PYTHN%include -I%DIR_MINGW%include SET LIBS=-L%DIR_BOOST%lib -L%DIR_PYTHN%libs -L%DIR_MINGW%lib %CC% -O0 -shared %INCL% %LIBS% -lboost_python-mgw34-s-1_34_1 -lpython25 %DIR_PRJCT%%NME_PRJCT%.cpp -o %NME_PRJCT%.pyd ENDLOCAL // --- snip ----------------------------------------------------------------------------- this works fine. but nevertheless it produces errors. // --- snip ----------------------------------------------------------------------------- D:\Temp\boost_test>c:\development_compiler\mingw\bin\g++.exe -O0 - shared -Ic:\development_compiler\_boost\include\boost-1_34_1 -Ic:\development_compiler\python25\include -Ic:\development_compiler\mingw\include -Lc:\development_compiler\_boost\lib -Lc:\development_compiler\python25\libs -Lc:\development_compiler\mingw\lib -lboost_python-mgw34-mt-s-1_34_1 -lpython25 D:\Temp\boost_test\hello.cpp -o hello.pyd C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text+0x11e): undefined reference to `_imp___ZN5boost6python6detail11init_moduleEPKcPFvvE' C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text$_ZN5boost6python3de fIPFPKcvEEEvS3_T_[void boost::python::def<char const* (*)()>(char const*, char const* (*)())]+0x6e): undefined reference to `_imp___ZN5boost6python6detail17scope_setattr_docEPKcRKNS0_3api6objectES3_' C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text$_ZN5boost6python6detail17make_function_auxIPFPKcvENS0_21default_call_policiesENS_3mpl7vector1IS4_EE EENS0_3api6objectET_RKT0_RKT1_[boost::python::api::objectboost::python::detail: :make_function_aux<char const* (*)(), boost::python::default_call_policies, boost::mpl::vector1<char const*> >(char const* (*)(), boost::python::default_call_policies const&, boost::mpl::vector1<char const*> const&)]+0x73): undefined refere nce to `_imp___ZN5boost6python7objects15function_objectERKNS1_11py_functionE' C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text$_ZN5boost6python7objects21py_function_impl_baseC2Ev[boost::python::objects::py_function_impl_base:: py_function_impl_base()]+0x7): undefined reference to `_imp___ZTVN5boost6python7objects21py_function_impl_baseE' C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.rdata$_ZTVN5boost6python7objects23caller_py_function_implINS0_6detail6callerIPFPKcvENS0_21default_call_p oliciesENS_3mpl7vector1IS6_EEEEEE[vtable for boost::python::objects::caller_py_function_impl<boost::python::detail::caller<char const* (*)(), boost::python::def ault_call_policies, boost::mpl::vector1<char const*> > >]+0x18): undefined reference to 'boost::python::objects::py_function_impl_base::max_arity() const' C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text$_ZN5boost6python3api6objectC2Ev[boost::python::api::object::object()]+0x7): undefined reference to `_imp___Py_NoneStruct' C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text$_ZN5boost6python7objects23caller_py_function_implINS0_6detail6callerIPFPKcvENS0_21default_call_poli ciesENS_3mpl7vector1IS6_EEEEED1Ev[boost::python::objects::caller_py_function_impl<boost::python::detail::caller<char const* (*)(), boost::python::default_call_policies, boost::mpl::vector1<char const*> > >::~caller_py_function_impl()]+0x16) : undefined reference to `_imp___ZN5boost6python7objects21py_function_impl_baseD2Ev' C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text$_ZN5boost6python7objects23caller_py_function_implINS0_6detail6callerIPFPKcvENS0_21default_call_poli ciesENS_3mpl7vector1IS6_EEEEED0Ev[boost::python::objects::caller_py_function_impl<boost::python::detail::caller<char const* (*)(), boost::python::default_call_policies, boost::mpl::vector1<char const*> > >::~caller_py_function_impl()]+0x16) : undefined reference to `_imp___ZN5boost6python7objects21py_function_impl_baseD2Ev' C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text$_ZNK5boost6python15to_python_valueIRKPKcEclES5_[boost::python::to_python_value<char const* const&>::operator()(char const* const&) const]+0xf): undefined reference to `_imp___ZN5boost6python9converter19do_return_to_pythonEPKc' C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text$_ZNK5boost6python9type_info4nameEv[boost::python::type_info::name() const]+0x15): undefined reference to `_imp___ZN5boost6python6detail12gcc_demangleEPKc' collect2: ld returned 1 exit status // --- snip ----------------------------------------------------------------------------- any ideas what's wrong? any ideas how to fix that? many, many thnx daniel PS: i build boost.python by doing this ... // --- snip ----------------------------------------------------------------------------- @echo off SETLOCAL SET path=%path%;C:\Development_Compiler\MinGW\Bin bjam.exe -a "-sTOOLS=mingw" "-sGCC_ROOT_DIRECTORY=C:\Development_Compiler\MinGW" "-sPYTHON_VERSION=2.5" "-sPYTHON_ROOT=C:\Development_Compiler\Python25" --build-dir=C:\Temp --toolset=gcc --with-python install ENDLOCAL // --- snip ----------------------------------------------------------------------------- _____________________________________________________________________ Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! http://smartsurfer.web.de/?mc=100071&distributionid=000000000066
damny@web.de wrote:
hi there,
for some days i try to build the boost.python tutorial "hello world" without bjam on winxp by using mingw. so i wrote a *.bat-file:
// --- snip ----------------------------------------------------------------------------- @echo off SETLOCAL SET DIR_MINGW=c:\development_compiler\mingw\ SET DIR_BOOST=c:\development_compiler\_boost\ SET DIR_PYTHN=c:\development_compiler\python25\ SET DIR_PRJCT=%~dp0 SET NME_PRJCT=hello SET CC=c:\development_compiler\mingw\bin\g++.exe SET INCL=-I%DIR_BOOST%include\boost-1_34_1 -I%DIR_PYTHN%include -I%DIR_MINGW%include SET LIBS=-L%DIR_BOOST%lib -L%DIR_PYTHN%libs -L%DIR_MINGW%lib %CC% -O0 -shared %INCL% %LIBS% -lboost_python-mgw34-s-1_34_1 -lpython25 %DIR_PRJCT%%NME_PRJCT%.cpp -o %NME_PRJCT%.pyd ENDLOCAL // --- snip -----------------------------------------------------------------------------
this works fine. but nevertheless it produces errors.
// --- snip ----------------------------------------------------------------------------- D:\Temp\boost_test>c:\development_compiler\mingw\bin\g++.exe -O0 - shared -Ic:\development_compiler\_boost\include\boost-1_34_1 -Ic:\development_compiler\python25\include -Ic:\development_compiler\mingw\include -Lc:\development_compiler\_boost\lib -Lc:\development_compiler\python25\libs -Lc:\development_compiler\mingw\lib -lboost_python-mgw34-mt-s-1_34_1 -lpython25 D:\Temp\boost_test\hello.cpp -o hello.pyd
This is just a wild guess, but what happens when you reorder your compile command, putting the libraries _after_ the source file, like this: g++.exe -O0 - shared \ -Ic:\development_compiler\_boost\include\boost-1_34_1 \ -Ic:\development_compiler\python25\include \ -Ic:\development_compiler\mingw\include \ D:\Temp\boost_test\hello.cpp \ -Lc:\development_compiler\_boost\lib \ -Lc:\development_compiler\python25\libs \ -Lc:\development_compiler\mingw\lib \ -lboost_python-mgw34-mt-s-1_34_1 -lpython25 \ -o hello.pyd [...] Markus
participants (2)
-
damny@web.de
-
Markus Schöpflin