-
Notifications
You must be signed in to change notification settings - Fork 44
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
Windows & castxml, compiler not found #57
Comments
- Improve algorithm which tries to guess the compiler path (for clang, gcc, msvc and mingw). - Update doc: a compiler path is now always guessed (for all platforms). Explain how to pass the compiler path. - Raise an exception if no compiler path is set
Hi. Thank you for reporting this. There are multiple reasons why all this is not so clear. Pygccxml was written in a time where there the compilers where mostly only gcc and msvc. Since I added the support of CastXML, the documentation has gone out of sync in some places. I pushed a patch on the develop branch, which will be in the next 1.8.0. You can see the changes here: 4a5c391. The guessing of the compiler is now improved. First it will look for msvc, and then for mingw. That should work now for you. I would be interested to know if my change help finding msvc automatically (I did not test it, but could give it a try this weekend). I am not often under windows, so this part is less taken care of. Also there are no regular unit tests running under windows, so errors are often unnoticed until I make a test before a release. Feel free to open a pull request if there are some wordings errors or if you want to extend the documentation at some places. |
I don't think a typical MSVC installation modifies your PATH, so even with your change Anyway, I don't think your change hurts anything, but even with the change, you'll still need to open the appropriate VSxxxx Command Prompt (or modify PATH) to get things to work. Also, since clang on Windows is an officially supported thing now, it might not be a bad idea to check for |
@praetorian20 Ideally, I too would like to see castxml and pygccxml use clang on all platforms. However:
So clang++ doesn't seem to be supported officially on any platform. Also, thank you @iMichka so much for your quick response and fix. There is an issue with a type error (the RuntimeError here is failing saying that Errors must be based on BaseException, so I'll try to fix what isn't working and I'll make a PR when I have a fix. Edit: also seems to be an issue when I run from the VS command prompt (so it can find EDIT2: Fixed the issue with the exception. Python wasn't dealing with the multiline very well. |
@ethanhs I think the id field is As for the problem with the MSVC command, there are a few things you could try:
|
@praetorian20 On the clang id, I have no idea. If you want to figure that out, please go ahead. :)
Good catch! I didn't get to that yet. I will add that in my PR. On your last point, it doesn't work outside of the VS command prompt as you suspected, as
|
@iMichka do you want me to add something before searching for cl by calling it by searching in the path I mentioned? Essentially if |
I fixed the missing space already. I do not want the guessing function to get too complex. Ideally people should define the path themselves, because they know where their compiler is located (hopefully :)). I think looking in the PATH is the most obvious thing to do: it's the first place I would expect to find a compiler. And this is why the which/where calls are the less worse strategy. I do not think hard-coding the paths to msvc with version numbers is a good idea. The compiler could be installed elsewhere, and I will need to make a new release each time to add new compiler versions. Too much work. Here again; setting the path manually is probably the best thing to do. About version numbers: looking at compiler versions is difficult. It may work for windows, but other compilers have been known to be lying about their version numbers. Example: Also: if you install gcc with homebrew on mac, the compiler call will be There is now an exception if the compiler is not found. So if on Windows msvc is not in the PATH, people will know what to do. I would be really happy if you could make a pull request with fixes/improvements. +1 on looking for clang on windows. |
I just started with the following very basic example:
And it fails saying that
compiler_path
is not defined, when it checks if I am using mingw or not (I'm not).In the docs, it says that creating a compiler path is only needed on Mac and Linux. Are the docs in error, or is this an issue with the code finding my Visual Studio compiler?
I am on Windows 10, Python 3.5, VS 14
The text was updated successfully, but these errors were encountered: