Closed Bug 1036093 Opened 5 years ago Closed 5 years ago

'mach build' fails after building a universal build

Categories

(Firefox Build System :: General, defect)

All
macOS
defect
Not set

Tracking

(firefox-esr31 affected, b2g-v2.0 fixed)

RESOLVED FIXED
Tracking Status
firefox-esr31 --- affected
b2g-v2.0 --- fixed

People

(Reporter: mshal, Assigned: mshal)

References

Details

Attachments

(1 file)

In bug 978211, we're trying to run 'mach build' in automation. However, in a universal OSX build (where we explicitly specify MOZ_OBJDIR), after all steps have completed we get:

---------------
Your build was successful!
Error running mach:

    ['build']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.

You should consider filing a bug for this issue.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

Exception: config.status not available. Run configure.

  File "/Users/marf/mozilla-central-git/python/mozbuild/mozbuild/mach_commands.py", line 430, in build
    if self.substs['MOZ_BUILD_APP'] != 'mobile/android':
  File "/Users/marf/mozilla-central-git/python/mozbuild/mozbuild/base.py", line 286, in substs
    return self.config_environment.substs
  File "/Users/marf/mozilla-central-git/python/mozbuild/mozbuild/base.py", line 273, in config_environment
    raise Exception('config.status not available. Run configure.')
---------------

I tried to fix this by considering MOZ_BUILD_PROJECTS when looking for config.status:

diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py
index 53b39c2..a06357b 100644
--- a/python/mozbuild/mozbuild/base.py
+++ b/python/mozbuild/mozbuild/base.py
@@ -267,7 +267,18 @@ class MozbuildObject(ProcessExecutionMixin):
         if self._config_environment:
             return self._config_environment
 
-        config_status = os.path.join(self.topobjdir, 'config.status')
+
+        make_extra = self.mozconfig['make_extra'] or []
+        make_extra = dict(m.split('=', 1) for m in make_extra)
+
+        # For universal builds, grab config.status from the first arch
+        projects = make_extra.get('MOZ_BUILD_PROJECTS')
+        if projects:
+            subdir = os.path.join(self.topobjdir, projects.split(' ')[0])
+        else:
+            subdir = ''
+
+        config_status = os.path.join(self.topobjdir, subdir, 'config.status')
 
         if not os.path.exists(config_status):
             raise Exception('config.status not available. Run configure.')

But unfortunately that makes 'make check' fail in some tests, so I'm guessing it's not the right place to add this in. This is similar to the issue seen in bug 832112 / bug 762358. Any suggestions?
gps, glandium - can either of you help out here?
Flags: needinfo?(mh+mozilla)
Flags: needinfo?(gps)
I suspect this code path is broken for universal OS X builds, automation or not. I don't think I've ever tried universal OS X builds myself and can't remember much about how they work. But I /thought/ there were 2 objdirs involved, possibly in sibling directories. I bet base.py just needs to be educated about universal OS X builds.

I didn't cross-reference the source, but this is in the "print the binary path" code, right? If my hypothesis about the failure is correct, I would just not print a binary for universal builds. Or print both if you aren't feeling lazy :)
Flags: needinfo?(gps)
Universal builds use MOZ_BUILD_PROJECTS in client.mk, which creates a sub-objdir for each entry in that list, so you wind up with $MOZ_OBJDIR/{i386,x86_64}, each containing a full objdir for that cpu arch. The root "objdir" at MOZ_OBJDIR is otherwise empty.

Unfortunately this abstraction bleeds through quite a bit, hence all the hardcoded buildbot knowledge to run a bunch of make steps in one of the subdirs.
Rather than hard-code a workaround only for Universal builds, can we just skip the message generating if we get an exception?
Assignee: nobody → mshal
Attachment #8454477 - Flags: review?(gps)
Flags: needinfo?(mh+mozilla)
Comment on attachment 8454477 [details] [diff] [review]
0001-Bug-1036093-ignore-mach-exceptions-when-printing-bin.patch

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

::: python/mozbuild/mozbuild/mach_commands.py
@@ +438,5 @@
> +                app = self.substs['MOZ_BUILD_APP']
> +                if app in ('browser', 'mobile/android'):
> +                    print('For more information on what to do now, see '
> +                        'https://developer.mozilla.org/docs/Developer_Guide/So_You_Just_Built_Firefox')
> +            except Exception:

except Exception is a bit heavy handed. But this is just UX code, so meh.
Attachment #8454477 - Flags: review?(gps) → review+
Looks like this has already been merged to m-c: http://hg.mozilla.org/mozilla-central/rev/82875b65c9a7
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Duplicate of this bug: 1102505
Aha, it looks like I'm using ESR31.2.0 which is too old for this fix.
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.