Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid compiler binary path on Microsoft Windows with VC 11.0 #9

Open
huku- opened this issue Dec 22, 2016 · 3 comments
Open

Invalid compiler binary path on Microsoft Windows with VC 11.0 #9

huku- opened this issue Dec 22, 2016 · 3 comments

Comments

@huku-
Copy link

huku- commented Dec 22, 2016

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 :)

@markcharney
Copy link
Contributor

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.

@huku-
Copy link
Author

huku- commented Dec 22, 2016

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.

@markcharney
Copy link
Contributor

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants