User forums > Using Code::Blocks
[MinGW]libboost_python-mgw34-mt-d-1_39.lib is not being linked.
stahta01:
I got it to link with an absolute path to the boost_python-mgw34-mt-1_39.dll instead of .lib; but, it crashed on running the exe.
Note: Also, linked OK, if I renamed "boost_python-mgw34-mt.lib" to "libboost_python-mgw34-mt.a" and used that in the library name.
Tim S
stahta01:
Made some test code that works OK for me.
Note: I am using MinGW GCC 4.4 DW2 for my testing; it gave error messages when it crashed; not, like MinGW 3.4.5.
Tim S
--- Code: ---#include <iostream>
#include <boost/python.hpp>
namespace python = boost::python;
int main(){
Py_Initialize();
python::object main_module = python::import("__main__");
python::object global = main_module.attr("__dict__");
python::object result = python::exec(
"def greet(): \n"
" return 'Hello from Python!' \n",
global, global
);
// Create a reference to it.
python::object greet = global["greet"];
// Call it.
std::string message = python::extract<std::string>(greet());
std::cout << message << std::endl;
return 0;
}
--- End code ---
Snippet of my Build Log for you to compare with yours.
Note: I renamed "boost_python-mgw44-mt-1_39.lib" to "libboost_python-mgw44-mt-1_39.a" and used "boost_python-mgw44-mt-1_39" in the library name.
--- Code: ---mingw32-g++.exe -Wall -fexceptions -O2 -fno-strict-aliasing -IC:\Apps\Python26\include -IC:\GreenApps\MinGW_Boost\include\boost-1_39 -IC:\GreenApps\MinGW_Boost\include -c C:\SourceCode\Projects\IDEs\CodeBlocks\Projects\BoostTest\main.cpp -o obj\Release\main.o
mingw32-g++.exe -LC:\Apps\Python26\libs -LC:\GreenApps\MinGW_Boost\lib -o bin\Release\BoostTest.exe obj\Release\main.o -s -lpython26 -lboost_python-mgw44-mt-1_39
--- End code ---
verysimplenick:
Can u told me how you build boost with python (maybe link to tutorial?)
stahta01:
I used multiple sites for directions here some of them will add them as I find them.
http://www.boost.org/doc/libs/1_35_0/more/getting_started/windows.html
The two bjam commands from the batch file below; I found out by trial and error that mixing --with-XXX ans --without-XXX did not work.
IIRC I used --with-python or --without-mpi to build python; been to long for me to be sure.
--- Quote --- bjam -q -d0 --with-graph --prefix="%_MINGWBASEFOLDER%" --build-dir=C:\temp\BoostTmp threading=multi variant=release link=shared toolset=gcc install
REM bjam -q -d0 --without-mpi --prefix="%_MINGWBASEFOLDER%" --build-dir=C:\temp\BoostTmp threading=multi variant=debug link=shared toolset=gcc install
--- End quote ---
Found my batch file I used to build boost
build-boost.bat
--- Code: ---SET _MINGWBASEFOLDER=C:\GreenApps\MinGW_Boost
SET PATH=%_MINGWBASEFOLDER%\bin;%PATH%
cd C:\SourceCode\Libraries\Boost\boost_1_39_0
REM SET EXPAT_INCLUDE=%_MINGWBASEFOLDER%
REM SET EXPAT_LIBPATH=%_MINGWBASEFOLDER%
REM
REM Change file user-config.jam by adding the line, without quotes,
REM "using python : 2.6 : C:\\Apps\\Python26 ;" to it.
REM
REM bjam option info
REM -d+2 Show commands as they are executed
REM -d0 Supress all informational messages
REM -q Stop at first error
REM --debug-configuration Diagnose configuration
REM bjam troubleshoot with "-q -d+2 --debug-configuration"
REM bjam normal build with "-q -d0"
REM
REM Clean
REM
REM bjam --clean -d0 --without-mpi --prefix="%_MINGWBASEFOLDER%" --build-dir=C:\temp\BoostTmp threading=multi variant=release link=shared toolset=gcc install
REM bjam --clean -d0 --without-mpi --prefix="%_MINGWBASEFOLDER%" --build-dir=C:\temp\BoostTmp threading=multi variant=debug link=shared toolset=gcc install
REM PAUSE
REM
REM Build
REM
bjam -q -d0 --with-graph --prefix="%_MINGWBASEFOLDER%" --build-dir=C:\temp\BoostTmp threading=multi variant=release link=shared toolset=gcc install
REM bjam -q -d0 --without-mpi --prefix="%_MINGWBASEFOLDER%" --build-dir=C:\temp\BoostTmp threading=multi variant=debug link=shared toolset=gcc install
PAUSE
goto _end
CD %_MINGWBASEFOLDER%\lib
copy boost_date_time-mgw44-mt-1_39.lib libboost_date_time-mgw44-mt-1_39.a
copy boost_date_time-mgw44-mt-d-1_39.lib libboost_date_time-mgw44-mt-d-1_39.a
copy boost_date_time-mgw44-mt-d.lib libboost_date_time-mgw44-mt-d.a
copy boost_date_time-mgw44-mt.lib libboost_date_time-mgw44-mt.a
copy boost_filesystem-mgw44-mt-1_39.lib libboost_filesystem-mgw44-mt-1_39.a
copy boost_filesystem-mgw44-mt-d-1_39.lib libboost_filesystem-mgw44-mt-d-1_39.a
copy boost_filesystem-mgw44-mt-d.lib libboost_filesystem-mgw44-mt-d.a
copy boost_filesystem-mgw44-mt.lib libboost_filesystem-mgw44-mt.a
copy boost_graph-mgw44-mt-1_39.lib libboost_graph-mgw44-mt-1_39.a
copy boost_graph-mgw44-mt-d-1_39.lib libboost_graph-mgw44-mt-d-1_39.a
copy boost_graph-mgw44-mt-d.lib libboost_graph-mgw44-mt-d.a
copy boost_graph-mgw44-mt.lib libboost_graph-mgw44-mt.a
copy boost_iostreams-mgw44-mt-1_39.lib libboost_iostreams-mgw44-mt-1_39.a
copy boost_iostreams-mgw44-mt-d-1_39.lib libboost_iostreams-mgw44-mt-d-1_39.a
copy boost_iostreams-mgw44-mt-d.lib libboost_iostreams-mgw44-mt-d.a
copy boost_iostreams-mgw44-mt.lib libboost_iostreams-mgw44-mt.a
copy boost_math_c99-mgw44-mt-1_39.lib libboost_math_c99-mgw44-mt-1_39.a
copy boost_math_c99-mgw44-mt-d-1_39.lib libboost_math_c99-mgw44-mt-d-1_39.a
copy boost_math_c99-mgw44-mt-d.lib libboost_math_c99-mgw44-mt-d.a
copy boost_math_c99-mgw44-mt.lib libboost_math_c99-mgw44-mt.a
copy boost_math_c99f-mgw44-mt-1_39.lib libboost_math_c99f-mgw44-mt-1_39.a
copy boost_math_c99f-mgw44-mt-d-1_39.lib libboost_math_c99f-mgw44-mt-d-1_39.a
copy boost_math_c99f-mgw44-mt-d.lib libboost_math_c99f-mgw44-mt-d.a
copy boost_math_c99f-mgw44-mt.lib libboost_math_c99f-mgw44-mt.a
copy boost_math_c99l-mgw44-mt-1_39.lib libboost_math_c99l-mgw44-mt-1_39.a
copy boost_math_c99l-mgw44-mt-d-1_39.lib libboost_math_c99l-mgw44-mt-d-1_39.a
copy boost_math_c99l-mgw44-mt-d.lib libboost_math_c99l-mgw44-mt-d.a
copy boost_math_c99l-mgw44-mt.lib libboost_math_c99l-mgw44-mt.a
copy boost_math_tr1-mgw44-mt-1_39.lib libboost_math_tr1-mgw44-mt-1_39.a
copy boost_math_tr1-mgw44-mt-d-1_39.lib libboost_math_tr1-mgw44-mt-d-1_39.a
copy boost_math_tr1-mgw44-mt-d.lib libboost_math_tr1-mgw44-mt-d.a
copy boost_math_tr1-mgw44-mt.lib libboost_math_tr1-mgw44-mt.a
copy boost_math_tr1f-mgw44-mt-1_39.lib libboost_math_tr1f-mgw44-mt-1_39.a
copy boost_math_tr1f-mgw44-mt-d-1_39.lib libboost_math_tr1f-mgw44-mt-d-1_39.a
copy boost_math_tr1f-mgw44-mt-d.lib libboost_math_tr1f-mgw44-mt-d.a
copy boost_math_tr1f-mgw44-mt.lib libboost_math_tr1f-mgw44-mt.a
copy boost_math_tr1l-mgw44-mt-1_39.lib libboost_math_tr1l-mgw44-mt-1_39.a
copy boost_math_tr1l-mgw44-mt-d-1_39.lib libboost_math_tr1l-mgw44-mt-d-1_39.a
copy boost_math_tr1l-mgw44-mt-d.lib libboost_math_tr1l-mgw44-mt-d.a
copy boost_math_tr1l-mgw44-mt.lib libboost_math_tr1l-mgw44-mt.a
copy boost_prg_exec_monitor-mgw44-mt-1_39.lib libboost_prg_exec_monitor-mgw44-mt-1_39.a
copy boost_prg_exec_monitor-mgw44-mt-d-1_39.lib libboost_prg_exec_monitor-mgw44-mt-d-1_39.a
copy boost_prg_exec_monitor-mgw44-mt-d.lib libboost_prg_exec_monitor-mgw44-mt-d.a
copy boost_prg_exec_monitor-mgw44-mt.lib libboost_prg_exec_monitor-mgw44-mt.a
copy boost_program_options-mgw44-mt-1_39.lib libboost_program_options-mgw44-mt-1_39.a
copy boost_program_options-mgw44-mt-d-1_39.lib libboost_program_options-mgw44-mt-d-1_39.a
copy boost_program_options-mgw44-mt-d.lib libboost_program_options-mgw44-mt-d.a
copy boost_program_options-mgw44-mt.lib libboost_program_options-mgw44-mt.a
copy boost_python-mgw44-mt-1_39.lib libboost_python-mgw44-mt-1_39.a
copy boost_python-mgw44-mt-d-1_39.lib libboost_python-mgw44-mt-d-1_39.a
copy boost_python-mgw44-mt-d.lib libboost_python-mgw44-mt-d.a
copy boost_python-mgw44-mt.lib libboost_python-mgw44-mt.a
copy boost_serialization-mgw44-mt-1_39.lib libboost_serialization-mgw44-mt-1_39.a
copy boost_serialization-mgw44-mt-d-1_39.lib libboost_serialization-mgw44-mt-d-1_39.a
copy boost_serialization-mgw44-mt-d.lib libboost_serialization-mgw44-mt-d.a
copy boost_serialization-mgw44-mt.lib libboost_serialization-mgw44-mt.a
copy boost_signals-mgw44-mt-1_39.lib libboost_signals-mgw44-mt-1_39.a
copy boost_signals-mgw44-mt-d-1_39.lib libboost_signals-mgw44-mt-d-1_39.a
copy boost_signals-mgw44-mt-d.lib libboost_signals-mgw44-mt-d.a
copy boost_signals-mgw44-mt.lib libboost_signals-mgw44-mt.a
copy boost_system-mgw44-mt-1_39.lib libboost_system-mgw44-mt-1_39.a
copy boost_system-mgw44-mt-d-1_39.lib libboost_system-mgw44-mt-d-1_39.a
copy boost_system-mgw44-mt-d.lib libboost_system-mgw44-mt-d.a
copy boost_system-mgw44-mt.lib libboost_system-mgw44-mt.a
copy boost_thread-mgw44-mt-1_39.lib libboost_thread-mgw44-mt-1_39.a
copy boost_thread-mgw44-mt-d-1_39.lib libboost_thread-mgw44-mt-d-1_39.a
copy boost_thread-mgw44-mt-d.lib libboost_thread-mgw44-mt-d.a
copy boost_thread-mgw44-mt.lib libboost_thread-mgw44-mt.a
copy boost_unit_test_framework-mgw44-mt-1_39.lib libboost_unit_test_framework-mgw44-mt-1_39.a
copy boost_unit_test_framework-mgw44-mt-d-1_39.lib libboost_unit_test_framework-mgw44-mt-d-1_39.a
copy boost_unit_test_framework-mgw44-mt-d.lib libboost_unit_test_framework-mgw44-mt-d.a
copy boost_unit_test_framework-mgw44-mt.lib libboost_unit_test_framework-mgw44-mt.a
copy boost_wave-mgw44-mt-1_39.lib libboost_wave-mgw44-mt-1_39.a
copy boost_wave-mgw44-mt-d-1_39.lib libboost_wave-mgw44-mt-d-1_39.a
copy boost_wave-mgw44-mt-d.lib libboost_wave-mgw44-mt-d.a
copy boost_wave-mgw44-mt.lib libboost_wave-mgw44-mt.a
copy boost_wserialization-mgw44-mt-1_39.lib libboost_wserialization-mgw44-mt-1_39.a
copy boost_wserialization-mgw44-mt-d-1_39.lib libboost_wserialization-mgw44-mt-d-1_39.a
copy boost_wserialization-mgw44-mt-d.lib libboost_wserialization-mgw44-mt-d.a
copy boost_wserialization-mgw44-mt.lib libboost_wserialization-mgw44-mt.a
copy libboost_regex-mgw44-mt-1_39.lib libboost_regex-mgw44-mt-1_39.a
copy libboost_regex-mgw44-mt-d-1_39.lib libboost_regex-mgw44-mt-d-1_39.a
copy libboost_regex-mgw44-mt-d.lib libboost_regex-mgw44-mt-d.a
copy libboost_regex-mgw44-mt.lib libboost_regex-mgw44-mt.a
copy libboost_test_exec_monitor-mgw44-mt-1_39.lib libboost_test_exec_monitor-mgw44-mt-1_39.a
copy libboost_test_exec_monitor-mgw44-mt-d-1_39.lib libboost_test_exec_monitor-mgw44-mt-d-1_39.a
copy libboost_test_exec_monitor-mgw44-mt-d.lib libboost_test_exec_monitor-mgw44-mt-d.a
copy libboost_test_exec_monitor-mgw44-mt.lib libboost_test_exec_monitor-mgw44-mt.a
:_end
PAUSE
--- End code ---
Tim S.
verysimplenick:
"--without-mpi" really help,thx Tim.
I used "--with-python" but boost::python not build in gcc,althought toolset=vc build it right(something wrong with config gcc?!)
Navigation
[0] Message Index
[*] Previous page
Go to full version