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
msbuild call failure with 'flutter run' on Windows #32792
Comments
@stuartmorgan not that I'm aware of. |
I've set up a branch for debugging this. As a starting point, it just adds some logging to make sure I understand where the problem is; if you |
Hi. How can I use your updated |
Sorry, I thought checking out a different branch would be enough to trigger a rebuild, but it sounds like that's not the case. You can delete |
Here is the output:
|
Okay, so that rules out something weird happening with locating vcvars64.bat in the first place. Can you try updating that branch and then running again? I've added quoting to the path; this breaks the build for me, but if it works for you that would be more evidence that it's being double-interpreted somehow. (If that's the case, maybe we'll need to think about generating a batch script that does the two steps, rather that passing through the shell, unless we can figure out why behavior is different.) It would also be helpful if you could try running |
Here's the output from your latest changes:
When I try to run the full path of
|
That's when properly quoted for invoking it in the shell manually? I.e., the script is successfully invoked, but is logging that error internally? |
No, it was not quoted. But when quoted, i.e. |
So it's not from within the script then. I'm perplexed as to how invoking it could fail both when quoted and when not quoted. (And why so far this is specific to your environment.) I think the next step is to try having the build process write a temporary |
Ok, I have had two issues wrt building on windows. Both of them are path related, of which this issue was one. I've managed to isolate their causes on my system. The error discussed here is thrown when there's a space in the path to the example project. My username contains a space and I checked out the example desktop repo into my documents folder. Moving the repo to The second error reported is Yeah, the error is absolutely bananas for what is going wrong, but hope this helps you to reproduce the issues your side. |
Interesting, the form of the error made it seem like the issue must be with the command rather than the project path. Thanks for tracking that down. It seems like the easiest solution to both of these issues is to add a bat file as discussed above. We can design it so that it's intended to be run with the working directory set to the |
Invoking msbuild with runInShell makes handling path escaping more error-prone, and substantially increases the chances of running into maximum path limits. This replaces the direct call with a .bat wrapper that calls vsvars64.bat then msbuild, and uses relative paths within the script to keep command lengths short. Fixes flutter#32792
https://github.com/stuartmorgan/flutter/tree/msbuild-bat-wrapper has the first pass at a fix. I don't have a Windows machine at the moment so it was written on macOS, which means it's never actually been tested; there may well be typo in I'll actually test it next week and get it landed, but you're welcome to try it out now and see if it works for you. |
Happy to be of help. I've been able to test this. My copy of your branch is located at While testing, I discovered one issue. The path join in After that line was changed, calling Let me know what your findings are when you have the chance to test. |
The hazards of writing a patch on a machine where I can't actually run it! Fix pushed to the branch.
That's just the Flutter tool output when the script returns non-zero; the actual error that caused it should be somewhere earlier in the output if you use |
The arguments to the helper commands were being quoted, but not the commands themselves, causing failures if the path to the project had spaces in it. Also re-adds the previously-dropped example/Runner.sln, to make the workflow smoother when opening the project in Visual Studio (to avoid being prompted to save the auto-synthesized solution on quit). Part of the fix for flutter/flutter#32792
The remaining problem with spaces is in the FDE example project rather than the Flutter tooling. |
The arguments to the helper commands were being quoted, but not the commands themselves, causing failures if the path to the project had spaces in it. Also re-adds the previously-dropped example/Runner.sln, to make the workflow smoother when opening the project in Visual Studio (to avoid being prompted to save the auto-synthesized solution on quit). Part of the fix for flutter/flutter#32792
My mistake, I didn't scroll far enough to find the error, previously the error was in the line above |
Invoking msbuild with runInShell makes handling path escaping more error-prone, and substantially increases the chances of running into maximum path limits. This replaces the direct call with a .bat wrapper that calls vsvars64.bat then msbuild, and uses relative paths within the script to keep command lengths short. Fixes #32792
Invoking msbuild with runInShell makes handling path escaping more error-prone, and substantially increases the chances of running into maximum path limits. This replaces the direct call with a .bat wrapper that calls vsvars64.bat then msbuild, and uses relative paths within the script to keep command lengths short. Fixes flutter#32792
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Splitting out from google/flutter-desktop-embedding#342 (comment)
Summarizing the error:
That looks very much like the vcvars64 path was split on spaces. What doesn't make sense about that is that this path pretty much always has spaces, so I don't understand why this would happen to someone else, but not be reproducible for me.
I'll make a branch tomorrow with some additional logging to make sure that's indeed what's happening (and not a strange issue with finding the vcvars64.bat path, for instance). Meanwhile, @contrix09 is there anything unusual about your CMD.exe configuration (e.g., something that might cause paths to be processed an extra time)?
The text was updated successfully, but these errors were encountered: