mach fails to build on Windows: WindowsError: [Error 193] %1 is not a valid Win32 application

RESOLVED FIXED in mozilla18

Status

()

Core
mach
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: gps, Assigned: gps)

Tracking

Trunk
mozilla18
x86_64
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
$ ./mach build
Traceback (most recent call last):
  File "./mach", line 48, in <module>
    mach.run(sys.argv[1:])
  File "d:\src\mozilla-central\python/mach\mach\main.py", line 133, in run
    fn(**stripped)
  File "d:\src\mozilla-central\python/mach\mach\build.py", line 23, in build
    warnings_path = self._get_state_filename('warnings.json')
  File "d:\src\mozilla-central\python/mozbuild\mozbuild\base.py", line 170, in _get_state_filename
    path = self.statedir
  File "d:\src\mozilla-central\python/mozbuild\mozbuild\base.py", line 89, in statedir
    return os.path.join(self.topobjdir, '.mozbuild')
  File "d:\src\mozilla-central\python/mozbuild\mozbuild\base.py", line 72, in topobjdir
    self._load_mozconfig()
  File "d:\src\mozilla-central\python/mozbuild\mozbuild\base.py", line 110, in _load_mozconfig
    env['CONFIG_GUESS'] = self._config_guess
  File "d:\src\mozilla-central\python/mozbuild\mozbuild\base.py", line 151, in _config_guess
    cwd=self.topsrcdir).strip()
  File "c:\dev\mozilla-build\python\lib\subprocess.py", line 537, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "c:\dev\mozilla-build\python\lib\subprocess.py", line 679, in __init__
    errread, errwrite)
  File "c:\dev\mozilla-build\python\lib\subprocess.py", line 893, in _execute_child
    startupinfo)
WindowsError: [Error 193] %1 is not a valid Win32 application


I reckon we need to execute config.guess within a shell. Yay Windows.
(Assignee)

Comment 1

5 years ago
Created attachment 665249 [details] [diff] [review]
Run config.guess and mozconfig in shells, v1

Ugh, Windows and shells. I should have tested the "mach build" patch on Windows.
Assignee: nobody → gps
Status: NEW → ASSIGNED
Attachment #665249 - Flags: review?(jhammel)
(Assignee)

Comment 2

5 years ago
Comment on attachment 665249 [details] [diff] [review]
Run config.guess and mozconfig in shells, v1

glandium: if you get to this while California is sleeping, that would rock. Feel free to check in to m-c (don't forget DONTBUILD) if you are so inclined. If not, don't worry about it.
Attachment #665249 - Flags: review?(mh+mozilla)
Comment on attachment 665249 [details] [diff] [review]
Run config.guess and mozconfig in shells, v1

Review of attachment 665249 [details] [diff] [review]:
-----------------------------------------------------------------

::: python/mozbuild/mozbuild/base.py
@@ +273,5 @@
>  
>      def _run_command_in_objdir(self, **args):
>          self._run_command(cwd=self.topobjdir, **args)
>  
> +    def _run_command(self, args=None, cwd=None, stderr=None,

You're not doing anything with stderr.
Attachment #665249 - Flags: review?(mh+mozilla) → review-
(Assignee)

Comment 4

5 years ago
(In reply to Mike Hommey [:glandium] from comment #3)
> ::: python/mozbuild/mozbuild/base.py
> @@ +273,5 @@
> >  
> >      def _run_command_in_objdir(self, **args):
> >          self._run_command(cwd=self.topobjdir, **args)
> >  
> > +    def _run_command(self, args=None, cwd=None, stderr=None,
> 
> You're not doing anything with stderr.

And that's why we have code review :/

Turns out that plugging stderr in to ProcessHandlerMixin breaks things. And, we can't use ProcessHandlerMixin for this usage because... ProcessHandlerMixin force redirects stderr to stdout!

So, I'll throw together a new patch that doesn't use mozprocess. (We also need to change mozconfig processing to go through shells and those executed scripts rely on stderr and stdout being different streams.)

Long term it would be great if mozprocess didn't cross the streams.
(Assignee)

Comment 5

5 years ago
Created attachment 665516 [details] [diff] [review]
Run config.guess and mozconfig in shells, v2

First to get to it "wins."

The environment variable key type foo makes me feel dirty.
Attachment #665249 - Attachment is obsolete: true
Attachment #665249 - Flags: review?(jhammel)
Attachment #665516 - Flags: review?(ted.mielczarek)
Attachment #665516 - Flags: review?(mh+mozilla)
Attachment #665516 - Flags: review?(jhammel)
(In reply to Gregory Szorc [:gps] from comment #5)
> Created attachment 665516 [details] [diff] [review]
> Run config.guess and mozconfig in shells, v2
> 
> First to get to it "wins."
> 
> The environment variable key type foo makes me feel dirty.

It makes you feel dirty, but why is it needed?
(In reply to Mike Hommey [:glandium] from comment #6)
> It makes you feel dirty, but why is it needed?

Forget it, missed the comment.
Comment on attachment 665516 [details] [diff] [review]
Run config.guess and mozconfig in shells, v2

Review of attachment 665516 [details] [diff] [review]:
-----------------------------------------------------------------

::: python/mozbuild/mozbuild/base.py
@@ +344,5 @@
> +        if not require_unix_environment or not _in_msys:
> +            return args
> +
> +        # Always munge Windows-style into Unix style for the command.
> +        prog = args[0].replace('\\', '/')

You should only do that on windows.
Attachment #665516 - Flags: review?(mh+mozilla) → review+
(Assignee)

Comment 9

5 years ago
(In reply to Mike Hommey [:glandium] from comment #8)
> ::: python/mozbuild/mozbuild/base.py
> @@ +344,5 @@
> > +        if not require_unix_environment or not _in_msys:
> > +            return args
> > +
> > +        # Always munge Windows-style into Unix style for the command.
> > +        prog = args[0].replace('\\', '/')
> 
> You should only do that on windows.

We only get here if _in_msys and require_unix_environment. _in_msys implies Windows. So, no change is necessary.
(Assignee)

Comment 10

5 years ago
https://hg.mozilla.org/mozilla-central/rev/74522aafbcdc
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
(Assignee)

Updated

5 years ago
Attachment #665516 - Flags: review?(ted.mielczarek)
Attachment #665516 - Flags: review?(jhammel)
You need to log in before you can comment on or make changes to this bug.