Compiling Cython for Blender 2.71

Hi !

I currently trying to compile Molecular for Blender 2.71. The things is Blender 2.71 now use python 3.4 instead of 3.3. So I need to install python 3.4 with cython ( 0.20.2 ). But it’s not working. First of all , I get error with manifest.

I use this command ( already used with previous version of molecular ):

"C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\mt.exe" -inputresource:D:\Blender3D\blender-2.71-windows64\python34.dll;#2 -outputresource:E:\3D\project_molecular\build\windows\64bit\cmolcore.pyd;#2

but this time I get this error :

mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file "E:\3D\project_molecular\build\windows\64bit\cmolcore.pyd". Paramhtre incorrect.

if I change path for Blender 2.70a and pyhton33.dll it’s working fine , but for 2.71a with python34.dll it’s not working at all. I’m on Windows 7 and try to compile x64bit with Microsoft SDK 7.0 NET3.5 SP1 commandline.

Anybody get this problem ?

thanks

This appear than python 3.4 need Microsoft SDK 7.1 to work ( and previously use SDK 7.0 to compile under Windows for python3.3 sucessfully )

I download and install SDK 7.1 but now my problem is this free version don’t have OpenMP included ! ( openMP is the lib to make Molecular multithreaded ). But 7.0 have it … why ??? I don’t know. With 7.1 you need to purchase the Professionnal version of MSVC if I understand well.

Not a easy things.

After that , until I find a way to make OpenMP work with free SDK 7.1 edition, I try to compile it with MinGW64 but I get another issue ( despite then many windows users get error because don’t have some minwg lib on his computer ):

...
`__imp_PyTuple_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x51c7): undefined reference to `__imp_PyTuple_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x520d): undefined reference to `__imp_PyFloat_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x5261): undefined reference to `__imp_PyTuple_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x52aa): undefined reference to `__imp_PyTuple_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x52fe): undefined reference to `__imp_PyTuple_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x534c): undefined reference to `__imp_PyFloat_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x53ce): undefined reference to `__imp_PyTuple_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x57c1): undefined reference to `__imp_PyTuple_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x580a): undefined reference to `__imp_PyTuple_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x589f): undefined reference to `__imp__Py_TrueStruct'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x58a9): undefined reference to `__imp__Py_FalseStruct'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x58e6): undefined reference to `__imp_PyTuple_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x592f): undefined reference to `__imp_PyTuple_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x5c48): undefined reference to `__imp_PyTuple_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x5cdd): undefined reference to `__imp__Py_TrueStruct'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x5ce7): undefined reference to `__imp__Py_FalseStruct'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x6057): undefined reference to `__imp__Py_NoneStruct'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x6083): undefined reference to `__imp__PyThreadState_Current'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x61f3): undefined reference to `__imp__Py_NoneStruct'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x64ac): undefined reference to `__imp__Py_NoneStruct'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x6710): undefined reference to `__imp_PyExc_OverflowError'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x6741): undefined reference to `__imp_PyExc_OverflowError'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x6772): undefined reference to `__imp_PyExc_OverflowError'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x6799): undefined reference to `__imp_PyExc_OverflowError'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x6897): undefined reference to `__imp_PyFloat_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x6e72): undefined reference to `__imp_PyList_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x6e82): undefined reference to `__imp_PyTuple_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x6f4f): undefined reference to `__imp_PyTuple_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x82c0): undefined reference to `__imp_PyTuple_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x8367): undefined reference to `__imp_PyTuple_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x83bc): undefined reference to `__imp_PyTuple_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0x8462): more undefined references to `__imp_PyTuple_Type' follow
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0xc819): undefined reference to `__imp_PyExc_OverflowError'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0xd270): undefined reference to `__imp_PyExc_TypeError'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0xd2a0): undefined reference to `__imp_PyUnicode_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0xd2a9): undefined reference to `__imp_PyBytes_Type'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0xed22): undefined reference to `__imp_PyExc_ImportError'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0xedf7): undefined reference to `__imp_PyExc_NameError'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0xeec3): undefined reference to `__imp_PyExc_NameError'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0xef7a): undefined reference to `__imp_PyExc_AttributeError'
build	emp.win-amd64-3.4\Release\cmolcore.o:cmolcore.c:(.text+0xef8e): undefined reference to `__imp_PyExc_ImportError'
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/bin/ld.exe: build	emp.win-amd64-3.4\Release\cmolcore.o: bad reloc address 0x0
 in section `.data'
collect2.exe: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

Anybody already get this problems ? I try to find a solution on the Cython usergroups side too.

thanks

Hi,

i have been able to compile molecular under Win 7 64 bits and VS2013 Express. It was some hard piece of work to get it run, but hopefully its working properly.
I basically had to modify msvc9compiler.py to let him find vcvarsall.bat and had to enter the version and architecture manually…

Anyway, i made a zip with a pyd suitable for blender 2.71 and python 3.4. I also included some instructions on how to compile and the modified msvc9compiler.py file.

molecular.zip (49.2 KB)

This zip can also be installed directly as addon (for testing purpose)

Hope this helps,

scorpion81

Wow ! Thanks a lot Scorpion81 ! Really generous ! It’s can sound weird by the creator of Molecular but I’m really a noob in compiling code stuff. Never une MSVC at all. So your solution sound great because I don’t have to open it ! :wink:

This working for 64bit and 32bit version ? Work for any others Cython projects than molecular without modifications ? I need to look closer on what you change in the msvc9compiler.py file.

Some users from Cython Google UsersGroups use TDM-GCC Mingw64. Supposed to work very well to compile cython. But for me it’s not working at all on two different computer. I post a ticket to the usergroup and wait a answer. What’s I’m afraid about Mingw is the last time I use it , few Molecular users get error due to dependancy. This error disapears when I start to use MS SDK (msvc command prompt).

EDIT: I get it working for MSVC2012 very well by changing the “version” variable to 11.0 !