On 8/5/2014 3:12 AM, Jürgen Hunold wrote:
Hi Edward,
Am Montag, 4. August 2014, 11:55:12 schrieb Edward Diener:
On 8/2/2014 5:31 AM, Jürgen Hunold wrote:
It even needs more caretaking. After fixing boost-build.jam to point to the new build system location, I had to tweak the example itself. Full patch to get things compiling again attached.
With the example that you tweaked I get:
embedding.cpp: In function 'void exec_test()': embedding.cpp:56:48: error: 'PyInit_embedded_hello' was not declared in this scope> if (PyImport_AppendInittab("embedded_hello", PyInit_embedded_hello) == -1)
It appears that the change you made in embedding.cpp is not correct, or I am doing something wrong.
Which Python do you use? I have Python-3.4 installed, this would be one possible reason. Does the example compile without my patch on your system?
The patch for the boost-build.jam file without the change you specified in embedding.cpp works with Python-2.7.8 32 bit. The patch for the boost-build.jam file with the change you specified in embedding.cpp works produces this error with Python-2.7.8 32 bit:
embedding.cpp: In function 'void exec_test()': embedding.cpp:56:48: error: 'PyInit_embedded_hello' was not declared in this scope if (PyImport_AppendInittab("embedded_hello", PyInit_embedded_hello) == -1)
The patch for the boost-build.jam file without the change you specified in embedding.cpp produces these errors with Python-3.4.1 32 bit:
gcc.link.dll bin\gcc-mingw-4.8.1\debug\libextending.dll.a bin\gcc-mingw-4.8.1\debug\extending.o: In function `PyInit_extending': C:\Programming\VersionControl\modular-boost\libs\python\example\quickstart/extending.cpp:29: undefined reference to `_imp___ZN5boost6python6detail11init_moduleER11PyModuleDefPFvvE' collect2.exe: error: ld returned 1 exit status
"g++" -L"C:\Utilities\Python341_32\libs" -Wl,-R -Wl,"C:\Utilities\Python341_32" -Wl,-R -Wl,"C:\Utilities\Python341_32\libs" "-Wl,--out-implib,bin\gcc-mingw-4.8.1\debug\libextending.dll.a" -o "bin\gcc-mingw-4.8.1\debug\extending.pyd" -shared -Wl,--start-group "bin\gcc-mingw-4.8.1\debug\extending.o" "..\..\..\..\bin.v2\libs\python\build\gcc-mingw-4.8.1\debug\libboost_python-mgw48-d-1_56.dll.a" -Wl,-Bstatic -Wl,-Bdynamic -lpython34 -Wl,--end-group -g
...failed gcc.link.dll bin\gcc-mingw-4.8.1\debug\libextending.dll.a bin\gcc-mingw-4.8.1\debug\extending.pyd...
embedding.cpp: In function 'void exec_test()': embedding.cpp:57:48: error: 'initembedded_hello' was not declared in this scope if (PyImport_AppendInittab("embedded_hello", initembedded_hello) == -1) ^
"g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -g -I"..\..\..\.." -I"C:\Utilities\Python341_32\Include" -c -o "bin\gcc-mingw-4.8.1\debug\embedding.o" "embedding.cpp"
...failed gcc.compile.c++ bin\gcc-mingw-4.8.1\debug\embedding.o...
The patch for the boost-build.jam file with the change you specified in embedding.cpp produces these errors with Python-3.4.1 32 bit:
gcc.link.dll bin\gcc-mingw-4.8.1\debug\libextending.dll.a bin\gcc-mingw-4.8.1\debug\extending.o: In function `PyInit_extending': C:\Programming\VersionControl\modular-boost\libs\python\example\quickstart/extending.cpp:29: undefined reference to `_imp___ZN5boost6python6detail11init_moduleER11PyModuleDefPFvvE' collect2.exe: error: ld returned 1 exit status
"g++" -L"C:\Utilities\Python341_32\libs" -Wl,-R -Wl,"C:\Utilities\Python341_32" -Wl,-R -Wl,"C:\Utilities\Python341_32\libs" "-Wl,--out-implib,bin\gcc-mingw-4.8.1\debug\libextending.dll.a" -o "bin\gcc-mingw-4.8.1\debug\extending.pyd" -shared -Wl,--start-group "bin\gcc-mingw-4.8.1\debug\extending.o" "..\..\..\..\bin.v2\libs\python\build\gcc-mingw-4.8.1\debug\libboost_python-mgw48-d-1_56.dll.a" -Wl,-Bstatic -Wl,-Bdynamic -lpython34 -Wl,--end-group -g
...failed gcc.link.dll bin\gcc-mingw-4.8.1\debug\libextending.dll.a bin\gcc-mingw-4.8.1\debug\extending.pyd...
gcc.link bin\gcc-mingw-4.8.1\debug\embedding.exe bin\gcc-mingw-4.8.1\debug\embedding.o: In function `PyInit_embedded_hello': C:\Programming\VersionControl\modular-boost\libs\python\example\quickstart/embedding.cpp:45: undefined reference to `_imp___ZN5boost6python6detail11init_moduleER11PyModuleDefPFvvE' collect2.exe: error: ld returned 1 exit status
"g++" -L"C:\Utilities\Python341_32\libs" -Wl,-R -Wl,"C:\Programming\VersionControl\modular-boost\bin.v2\libs\python\build\gcc-mingw-4.8.1\debug" -Wl,-R -Wl,"C:\Utilities\Python341_32" -Wl,-R -Wl,"C:\Utilities\Python341_32\libs" -Wl,-rpath-link -Wl,"C:\Programming\VersionControl\modular-boost\bin.v2\libs\python\build\gcc-mingw-4.8.1\debug" -o "bin\gcc-mingw-4.8.1\debug\embedding.exe" -Wl,--start-group "bin\gcc-mingw-4.8.1\debug\embedding.o" "..\..\..\..\bin.v2\libs\python\build\gcc-mingw-4.8.1\debug\libboost_python-mgw48-d-1_56.dll.a" -Wl,-Bstatic -Wl,-Bdynamic -lpython34 -Wl,--end-group -g
...failed gcc.link bin\gcc-mingw-4.8.1\debug\embedding.exe...
Hopefully these will give you enough to fix this problem in Boost Python. I am pretty sure I have done everything correctly. I also have 64-bit versions of Python 2.7.8 and Python 3.4.1 but I am not sure how I test that. Do I have to add some sort of address model parameter to the bjam line ?