[Bf-committers] bpy.dll

Paolo Basso pa.basso at gmail.com
Fri Mar 25 16:22:05 CET 2011


In which version of Windows did you compile?

May the problem be this one?
http://www.mingw.org/wiki/linking_hangs_under_windows_7
By the way, I got a 33 mb .pyd file.

Cheers
2011/3/25 Campbell Barton <ideasman42 at gmail.com>

> >From the error message, python fails to load the DLL, it doesn't even
> get to look for a function inside it.
>
> Some misc suggestions if you want to look into this further.
>
> - My DLL was about 120mb (RelWithDebugInfo). When setting up cmake
> linking with add_library(...SHARED) function I managed to get a DLL
> that was ~600kb.
>  If your bpy.pyd is under 6mb something is wrong linking it and its
> - try build with CMAKE_BUILD_TYPE  set to RelWithDebugInfo
> - Find some tool to inspect the dll to get a hint as to why it fails,
> whats wrong with it.
> - could be a python ABI version conflict, I used the 32bit Python3.2
> MSI, built with blenders default python that comes in lib.
>
> Would be interesting to know if other systems have the same trouble.
>
> On Fri, Mar 25, 2011 at 12:16 AM, Paolo Basso <pa.basso at gmail.com> wrote:
> > no I was running Python 3.2, I just mentioned that I also hav Python 2.6
> > installed  just in case it could be of some help in understanding my
> > problem.
> >
> > I tried to build also the blender.exe from source but, again in this
> case,
> > everything seems to work fine except that at the end I get an error
> message
> > when I try to launch blender.
> >
> > I guess the problem could be something related to my minGW, can be?
> >
> >
> >
> > 2011/3/25 Daniel Tavares <danielmtavares at gmail.com>
> >
> >> Which of the Python runtimes were you running when you got the
> ImportError?
> >> It seems to me that you're trying to import bpy from Python 2.6. That
> will
> >> not work.
> >>
> >> Make sure to import bpy from your Python 3.2 runtime. As Campbell said:
> >>
> >> Execute...
> >> C:\Python32\python.exe
> >>
> >> >>> import bpy
> >> >>> print(bpy.data)
> >>
> >>
> >> Cheers,
> >>
> >> Daniel
> >>
> >>
> >> On Thu, Mar 24, 2011 at 8:20 AM, Paolo Basso <pa.basso at gmail.com>
> wrote:
> >>
> >> > My environment:
> >> >
> >> > Windows7 32 bit
> >> > python 2.6 and python 3.2 installed (C.\Pythonx.x\...)
> >> >
> >> > by the way, when I write the command "python" at the command prompt,
> >> > then python26 starts (not python32)
> >> >
> >> >
> >> > What I did:
> >> >
> >> > download latest build and windows dependencies with SVN and placed in
> >> > C.\BlenderSVN
> >> > (then I have two folders in C.\BlenderSVN: "blender" and "lib")
> >> >
> >> > I run Cmake 2.8.2 gui and set:
> >> >
> >> > - source code location: "C:/BlenderSVN/blender"
> >> > - where to build the binaries: "C:/BlenderSVN/build"
> >> >
> >> > then
> >> > 1) click configure once
> >> > 2) specify the generator for the project as "MinGW Makefiles" (Use
> >> default
> >> > native compilers)
> >> >
> >> > I get the following configure info:
> >> >
> >> > The C compiler identification is GNU
> >> >
> >> > The CXX compiler identification is GNU
> >> >
> >> > Check for working C compiler: C:/Program
> Files/pythonxy/mingw/bin/gcc.exe
> >> >
> >> > Check for working C compiler: C:/Program
> Files/pythonxy/mingw/bin/gcc.exe
> >> > --
> >> > works
> >> >
> >> > Detecting C compiler ABI info
> >> >
> >> > Detecting C compiler ABI info - done
> >> >
> >> > Check for working CXX compiler: C:/Program
> >> Files/pythonxy/mingw/bin/g++.exe
> >> >
> >> > Check for working CXX compiler: C:/Program
> >> Files/pythonxy/mingw/bin/g++.exe
> >> > -- works
> >> >
> >> > Detecting CXX compiler ABI info
> >> >
> >> > Detecting CXX compiler ABI info - done
> >> >
> >> > Performing Test SUPPORT_SSE_BUILD
> >> >
> >> > Performing Test SUPPORT_SSE_BUILD - Success
> >> >
> >> > SSE Support: detected.
> >> >
> >> > Performing Test SUPPORT_SSE2_BUILD
> >> >
> >> > Performing Test SUPPORT_SSE2_BUILD - Success
> >> >
> >> > SSE2 Support: detected.
> >> >
> >> > Performing Test C_WARN_ALL
> >> >
> >> > Performing Test C_WARN_ALL - Success
> >> >
> >> > Performing Test C_WARN_CAST_ALIGN
> >> >
> >> > Performing Test C_WARN_CAST_ALIGN - Success
> >> >
> >> > Performing Test C_WARN_ERROR_DECLARATION_AFTER_STATEMENT
> >> >
> >> > Performing Test C_WARN_ERROR_DECLARATION_AFTER_STATEMENT - Success
> >> >
> >> > Performing Test C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION
> >> >
> >> > Performing Test C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION - Success
> >> >
> >> > Performing Test C_WARN_ERROR_RETURN_TYPE
> >> >
> >> > Performing Test C_WARN_ERROR_RETURN_TYPE - Success
> >> >
> >> > Performing Test C_WARN_ERROR_STRICT_PROTOTYPES
> >> >
> >> > Performing Test C_WARN_ERROR_STRICT_PROTOTYPES - Success
> >> >
> >> > Performing Test C_WARN_NO_CHAR_SUBSCRIPTS
> >> >
> >> > Performing Test C_WARN_NO_CHAR_SUBSCRIPTS - Success
> >> >
> >> > Performing Test C_WARN_NO_UNKNOWN_PRAGMAS
> >> >
> >> > Performing Test C_WARN_NO_UNKNOWN_PRAGMAS - Success
> >> >
> >> > Performing Test C_WARN_POINTER_ARITH
> >> >
> >> > Performing Test C_WARN_POINTER_ARITH - Success
> >> >
> >> > Performing Test C_WARN_UNUSED_PARAMETER
> >> >
> >> > Performing Test C_WARN_UNUSED_PARAMETER - Success
> >> >
> >> > Performing Test C_WARN_WRITE_STRINGS
> >> >
> >> > Performing Test C_WARN_WRITE_STRINGS - Success
> >> >
> >> > Performing Test CXX_WARN_ALL
> >> >
> >> > Performing Test CXX_WARN_ALL - Success
> >> >
> >> > Performing Test CXX_WARN_NO_INVALID_OFFSETOF
> >> >
> >> > Performing Test CXX_WARN_NO_INVALID_OFFSETOF - Success
> >> >
> >> > Performing Test CXX_WARN_NO_SIGN_COMPARE
> >> >
> >> > Performing Test CXX_WARN_NO_SIGN_COMPARE - Success
> >> >
> >> > Blender Skipping: (bf_collada;bf_imbuf_openexr;extern_redcode)
> >> >
> >> > Could NOT find Subversion (missing: Subversion_SVN_EXECUTABLE)
> >> >
> >> > Configuring done
> >> >
> >> > 3) tick the box WITH_PYTHON_MODULE and unselect the box
> >> WITH_PYTHON_INSTALL
> >> > (WITH_PLAYER is already unselected)
> >> >
> >> > 4) click for the second time configure
> >> >
> >> > This time I get these messages:
> >> >
> >> > Blender Skipping: (bf_collada;bf_imbuf_openexr;extern_redcode)
> >> >
> >> > Could NOT find Subversion (missing: Subversion_SVN_EXECUTABLE)
> >> >
> >> > Configuring done
> >> >
> >> >
> >> >
> >> > 5) click generate
> >> >
> >> >
> >> >
> >> > At this point I close Cmake gui, open the windows shell and run the
> >> > following commands:
> >> >
> >> >
> >> >
> >> > cd C:\BlenderSVN\build
> >> >
> >> > mingw32-make
> >> >
> >> >
> >> >
> >> > (the compilation ends like:
> >> >
> >> >
> >> >
> >> > [100%] Building C object
> >> > source/creator/CMakeFiles/blender.dir/buildinfo.c.obj
> >> > Linking CXX shared library ..\..\bin\bpy.pyd
> >> > Creating library file: ..\..\lib\libbpy.dll.a
> >> > Warning: .drectve `/DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" '
> >> > unrecognized
> >> > Warning: .drectve `/DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" '
> >> > unrecognized
> >> > Warning: .drectve `/DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" '
> >> > unrecognized
> >> > Warning: .drectve `/DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" '
> >> > unrecognized
> >> > [100%] Built target blender
> >> >
> >> >
> >> >
> >> > )
> >> >
> >> >
> >> > mingw32-make *install*
> >> >
> >> > **
> >> >
> >> > After the installation, still in the shell I write the following
> >> commands:
> >> >
> >> >
> >> >
> >> > copy bin\bpy.pyd C:\Python32\Lib\site-packages\
> >> > xcopy /E bin\2.56 C:\Python32\
> >> >
> >> >
> >> >
> >> > (last command actually copies only the sub-folders of the 2.56 folder
> so
> >> > that I have three different folders - config, datafiles, scripts - in
> >> > C:\Python32   -----> however I tried also copying the whole 2.56
> >> folder..)
> >> >
> >> >
> >> > ....and still get the same error message:
> >> >
> >> > ImportError: DLL load failed: %1 non è un'applicazione di Win32
> valida.
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > 2011/3/24 Campbell Barton <ideasman42 at gmail.com>
> >> >
> >> > > tested again and it works ok for me with mingw/cmake.
> >> > >
> >> > > You should have...
> >> > > * C:\Python32\2.56\scripts
> >> > > * C:\Python32\Lib\site-packages\bpy.pyd
> >> > >
> >> > > Execute...
> >> > > C:\Python32\python.exe
> >> > >
> >> > > ... try import bpy,
> >> > > print(bpy.data)
> >> > >
> >> > > Important its version 3.2 and that ./2.56/ is in the subdirectory of
> >> > > python.exe.
> >> > >
> >> > > On Thu, Mar 24, 2011 at 9:27 AM, Paolo Basso <pa.basso at gmail.com>
> >> wrote:
> >> > > > Something wrong still happens...
> >> > > >
> >> > > > I compile the source using cmake and MinGW and everything seems to
> >> work
> >> > > in
> >> > > > the right way. I get the bpy.pyd file and successfully copy it
> >> together
> >> > > with
> >> > > > the other folders in the python32 directory (as explained in the
> wiki
> >> > > page).
> >> > > > However when I run the python 32 interpreter and try to import the
> >> bpy
> >> > > > module I get the same error message as before (ImportError: DLL
> load
> >> > > failed:
> >> > > > %1 is not a Win32 valid application).
> >> > > >
> >> > > > I tried to compile the source also with visual studio 10 but,
> among
> >> the
> >> > > > others, I got the following error message:
> >> > > >
> >> > > > C:\temp_blender\bin\Debug\bpy.pyd : fatal error LNK1169: one or
> more
> >> > > symbols
> >> > > > defined more then once
> >> > > >
> >> > > >
> >> > > > Am I doing something wrong??
> >> > > >
> >> > > > Cheers,
> >> > > >
> >> > > > P
> >> > > >
> >> > > >
> >> > > > 2011/3/24 Campbell Barton <ideasman42 at gmail.com>
> >> > > >
> >> > > >> Added support for windows r35735
> >> > > >>
> >> > > >> Updated wiki.
> >> > > >>
> http://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule
> >> > > >>
> >> > > >> On windows the function needed exporting, defining
> Py_ENABLE_SHARED
> >> > does
> >> > > >> this.
> >> > > >>
> >> > > >> On Wed, Mar 23, 2011 at 6:45 PM, Paolo Basso <pa.basso at gmail.com
> >
> >> > > wrote:
> >> > > >> > I tried also this way but I get the following error message
> >> > > (translated
> >> > > >> from
> >> > > >> > italian):
> >> > > >> >
> >> > > >> > ImportError: DLL load failed: %1 is not a Win32 valid
> application.
> >> > > >> >
> >> > > >> > It is possible that the dll has to be compiled with the same
> >> > compiler
> >> > > as
> >> > > >> > python (visual studio)?
> >> > > >> > I compiled using mgwin.
> >> > > >> >
> >> > > >> > http://docs.python.org/py3k/extending/windows.html
> >> > > >> > 4.3. Using DLLs in Practice
> >> > > >> >
> >> > > >> > Thanks,
> >> > > >> >
> >> > > >> > P
> >> > > >> >
> >> > > >> > 2011/3/23 Mitchell Stokes <mogurijin at gmail.com>
> >> > > >> >
> >> > > >> >> On Windows, C Extension modules for Python have the extension
> >> .pyd
> >> > > >> >> instead. So, try renaming the module from bpy.dll to bpy.pyd.
> >> > > >> >>
> >> > > >> >> Cheers,
> >> > > >> >> Mitchell
> >> > > >> >> _______________________________________________
> >> > > >> >> Bf-committers mailing list
> >> > > >> >> Bf-committers at blender.org
> >> > > >> >> http://lists.blender.org/mailman/listinfo/bf-committers
> >> > > >> >>
> >> > > >> > _______________________________________________
> >> > > >> > Bf-committers mailing list
> >> > > >> > Bf-committers at blender.org
> >> > > >> > http://lists.blender.org/mailman/listinfo/bf-committers
> >> > > >> >
> >> > > >>
> >> > > >>
> >> > > >>
> >> > > >> --
> >> > > >> - Campbell
> >> > > >> _______________________________________________
> >> > > >> Bf-committers mailing list
> >> > > >> Bf-committers at blender.org
> >> > > >> http://lists.blender.org/mailman/listinfo/bf-committers
> >> > > >>
> >> > > > _______________________________________________
> >> > > > Bf-committers mailing list
> >> > > > Bf-committers at blender.org
> >> > > > http://lists.blender.org/mailman/listinfo/bf-committers
> >> > > >
> >> > >
> >> > >
> >> > >
> >> > > --
> >> > > - Campbell
> >> > > _______________________________________________
> >> > > Bf-committers mailing list
> >> > > Bf-committers at blender.org
> >> > > http://lists.blender.org/mailman/listinfo/bf-committers
> >> > >
> >> > _______________________________________________
> >> > Bf-committers mailing list
> >> > Bf-committers at blender.org
> >> > http://lists.blender.org/mailman/listinfo/bf-committers
> >> >
> >> _______________________________________________
> >> Bf-committers mailing list
> >> Bf-committers at blender.org
> >> http://lists.blender.org/mailman/listinfo/bf-committers
> >>
> > _______________________________________________
> > Bf-committers mailing list
> > Bf-committers at blender.org
> > http://lists.blender.org/mailman/listinfo/bf-committers
> >
>
>
>
> --
> - Campbell
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list