Open huku- opened 7 years ago
I believe that is the cross compile you are referencing. The native 64b compiler is line C:\Program Files (no "(x86)") suffix.
Have you installed the 64b native compiler? In older compilers, I believe it requried customizing (by clicking a few extra buttons) during install.
You are right. I have a 64-bit VM and VS is under C:\Program Files (x86)\, so, that's a cross compile.
My build fails because in build_env.py, and more specifically in find_ms_toolchain()
, the if-elif
block doesn't correctly recognize the case of a cross compile and toolchain
is set to an invalid path.
To fix this problem, I used the following hack before the aforementioned if
block:
# If running on a 32-bit VS installation, assume we are running on a 32-bit CPU.
programs86 = os.getenv("ProgramFiles(x86)").replace('\\', '/')
if env['build_cpu'] == 'x86-64' and env['vc_dir'].startswith(programs86):
env['build_cpu'] = 'ia32'
However, I think the logic of detecting a cross compile should be implemented in _set_msvs_dev*()
in msvs.py. I can look into it if you think this is of any use.
Yeah, cross compiles.... I guess we can think about cross compilation support feature with a low priority. With the pervasiveness of 64b hardware, I was less motivated to support the cross compilation (32b host, 64b output). And the other cross (64b host, 32b output) seems kinda useless because every 64b host has the 32b native compiler, at least on windows. FWIW, mbuild does support cross compilation generally when doing 32b output on 64b hosts. So the basic plumbing is there.
(Historical note: 10+ years ago, XED0 used C++ instead of python for the generator. I had to deal with Itanium cross compiles to x86 so one could build on an Itanium and have it support x86 code. I don't miss those days and avoiding painful cross compiles was why I moved the generators to python).
On Microsoft Windows with VC 11.0, msvs.py assumes cl.exe is in the following directory:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64
However, things changed on VC 11.0 and now compiler binaries for AMD64 are under:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64
Notice the change in the last component of the directory.
I can commit a patch, but I would like to study the source first so that my solution is elegant and compatible with how mbuild works. If you have a faster solution for this let me know :)