Page 1 of 1

scons.py errors with python 3.2

Posted: Tue Aug 30, 2011 9:44 pm
by kestion
I am trying to compile 64 bit blender 2.9 on a windows 7 machine.
I tried cmake first but got errors, so I'm now working with scons.

I had python2.7 on my machine. Scons compiled everything happily
but while linking makesdna.exe i got the error:

module machine type 'X86' conflicts with target machine type 'x64'

I tried seval things with no luck so I installed python3.2 since i noticed blender was built with this version.

Now when i run scons it can't get out of the starting gate. I get an error that comes from the scons.py file i'm guessing. The error states that environ has no such attribute has_key

[offending lines from scons.py]
if os.environ.has_key("SCONS_LIB_DIR"):
libs.append(os.environ["SCONS_LIB_DIR"])

From what i've read, has_key was used in python2 but dropped in python3.
So it appears that blender can't be scons-built with python3 even though it is internally built with python3.2? REALLY? I used tortoiseSVN to grab the trunk from blender just last week.

I guess I'll go back to python2.7 and try to find the error with the linker between module machine and target machine.

Been at this a few days now. Any help appreciated.

Posted: Wed Aug 31, 2011 6:31 am
by stiv
Blender need Python 3.2, SCons needs Py 2.x; quirky maybe, but there you are.

This
module machine type 'X86' conflicts with target machine type 'x64'
sounds like some mix 32 bit and 64 bit prorams. Are you running 32 bit Python?

scons.py errors with python 3.2

Posted: Wed Aug 31, 2011 6:30 pm
by kestion
This
module machine type 'X86' conflicts with target machine type 'x64'
sounds like some mix 32 bit and 64 bit prorams. Are you running 32 bit Python?[/quote]
I agree.

>python gives the version as 64 (amd) on win32. I always download the x64 if it is available. But what does 64 on win32 mean?

2 problems:

1. If i use python3.2 i can't run scons.py because i get an error since has_key no longer exists in python3. Has anyone compiled blender using scons and python3? Do tell!

2. If i use python2.7 then all compiles well, but i get the linker error. I downloaded the \lib\64 binaries as suggested on the blender.org compiling tutorial. But i haven't figured out which compiler scons uses or if it is linking to the lib\64 binaries.

However, I found that even trying to compile a simple helloWorld.cpp using the Visual Studio 2010\VC\bin\amd64\cl.exe at command prompt, it compiles fine but gives the same linking error. What is being linked? <iostream> and a system("PAUSE") call are the only pieces of code in there.

Building with config mgr set to x64 does work from within vs 2010 IDE on the helloworld.cpp.

Do i need to pass some options to the cl.exe compiler to get the command line linker to work? How can i find out what VS 2010 is doing to make the linking work?

thanks,

kesten

Posted: Wed Aug 31, 2011 7:54 pm
by stiv
Let's try again:

Blender needs to find Python 3.2 libraries and header files in order to build. It does not care about a Py 3.2 executable.

To run SCons, you need a Python 2.x executable. SCons does not work with Python 3 yet.

It has been a while since I was afflicted with Visual Studio, but the fact that you cannot link Hello World suggests something is wrong with your setup. Are you perhaps running a 32 bit version of Windows on a 64 bit processor?

Posted: Mon Sep 05, 2011 5:50 am
by kestion
I have windows7 64bit on a 64 bit processor.
Cl.exe does compile hello world correctly if I configure vs2010 to build target x64.
I have both python32 and python27 installed at c:\. Currently I only have python27 in the path, but i think scons should find python32 as well.

My main concern now is that scons somewhere chooses to use win64-vc-config.py rather than win32-vc-config.py from directory C:\BlenderSVN\blender\build_files\scons\config

And creates the build directory C:\BlenderSVN\build\blender25-win64-vc

It is not clear from the naming or documentation weather the win64 is refering to the build machine (correct for me) or the target executable (win32 in my case). I think its the executable in which case, scons is incorrectly guessing that i want an x64 build. ( i did, until i ran into too many troubles and opted for win32)

Any tips as to where to find the scons script that decides which config to use?

thanks
kesten