1

I'm trying to build a VRPN server with Python3 flag using Python 3.4 64-bit on Windows 7 64-bit but there seems to be a problem. I need this for BlenderVR software.

This is my procedure:

  • 1) I use CMake to create makefiles (I'm using 3.4.0 version but I've also tried different ones). I do it with this command (those flags should be there but the result seems to be the same without them anyway):

cmake -G"MinGW Makefiles"
-HD:\My\BlenderVR\plugins\vrpn
-BD:\My\BlenderVR\plugins\cmake
-DVRPN_BUILD_PYTHON=OFF
-DVRPN_BUILD_PYTHON_HANDCODED_2X=OFF
-DVRPN_BUILD_PYTHON_HANDCODED_3X=ON

I used to add those flags as well but it seems that it can find Python without them

-DPYTHON_INCLUDE_DIR=D:\My\BlenderVR\Required\Python3\include
-DPYTHON_LIBRARY=D:\My\BlenderVR\Required\Python3\libs\python34.lib

Python is correctly found and this operation doesn't throw any error.

  • 2) Then I use mingw32-make.exe to build it and I get this error:

[ 90%] Linking CXX shared module vrpn.pyd
D:/My/BlenderVR/Required/Python3/libs/python34.lib: error adding symbols: File f ormat not recognized
collect2.exe: error: ld returned 1 exit status
python\CMakeFiles\vrpn-python.dir\build.make:505: recipe for target 'python/vrpn .pyd' failed mingw32-make[2]: * * * [python/vrpn.pyd] Error 1
CMakeFiles\Makefile2:3247: recipe for target 'python/CMakeFiles/vrpn-python.dir/ all' failed mingw32-make[1]: * * * [python/CMakeFiles/vrpn-python.dir/all]
Error 2 Makefile:159: recipe for target 'all' failed
mingw32-make: [all] Error 2

vprn.pyd is the crucial thing for my future work.

I figured out that it needs libpython34.a file (probably). When I created it and copied to Python3/libs folder it worked and finished without errors but the crated vprn.pyd didn't worked as it should.

What I need is to get import vrpn to work with this simple test in python (appending path where vrpn.pyd was build):

import sys
sys.path.append('D:/My/BlenderVR/plugins/cmake/python')
import vrpn

It lags my whole computer for a while and then pops out that Python has stop working.

I suspect that problem is in the libpython34.a file that I created doing this:

gendef python34.dll (in Windows/System32)
dlltool -D python34.dll -d python34.def -l libpython34.a

I don't how else should I get the libpython file. I've tried various versions of CMake and MinGW (like MinGWPy, TDM, w64) with many CMake flags. I was able to make it work using 32-bit Python but I need 64-bit version otherwise it is not working with BlenderVR enviroment.

I know this is very specific problem and probably kind of confusing at first but I didn't know how else to put it. I'll be glad for anything that could help. Thank you.

Gungnir
  • 13
  • 4
  • I would try taking a look at `vrpn.pyd` with [dependency walker](http://www.dependencywalker.com/) to check if there are any 32/64bit mismatches or .dlls it can't find. – user3419537 Nov 19 '15 at 10:24

1 Answers1

1

mingwpy should be installed with pip (until it is officially released at PYPI):

pip install -i https://pypi.anaconda.org/carlkl/simple mingwpy

all necessary import files are atomatically copied into the python\libs folder. If python\Scripts is in the PATH it should work out of the box.

You have to make sure, that Blender Python is equiped with two import files

D:\My\BlenderVR\Required\Python3\libs\libpython\libpython34.dll.a
D:\My\BlenderVR\Required\Python3\libs\libpython\libmsvcr100.a
carlkl
  • 26
  • 3
  • Thank you for your response. It looked promising but it threw this error while mingw32-make: `[ 51%] Linking CXX executable time_test.exe CMakeFiles\time_test.dir/objects.a(time_test.cpp.obj): In function get_time_using_ftime(unsigned long&, unsigned long&)': D:/BlenderVR/plugins/vrpn/time_test.cpp:56: undefined reference to __imp__ftime'` I've tried anything I thought of but I don't know how to get rid of this error. Other MinGW distributions don't do this. – Gungnir Nov 22 '15 at 15:46
  • You may replace the symbol _ftime with _ftime64 as described in http://sourceforge.net/p/mingw-w64/bugs/363 The symbol _ftime doesn't exist in msvcr90.dll or msvcr100.dll anymore. – carlkl Nov 23 '15 at 21:13
  • It worked! Thank you very much, you helped me big time. Sorry for late response I was rather busy. If you guys are getting this error just do find/replace for _ftime to _ftime64 in time_test.cpp file and you're golden. – Gungnir Nov 26 '15 at 21:17