Build fails with "arch: posix_spawnp: egrep: Bad CPU type in executable" when MacPorts egrep is on $PATH

RESOLVED FIXED in mozilla17

Status

()

Core
Build Config
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Adam Rosenfield, Assigned: Adam Rosenfield)

Tracking

Trunk
mozilla17
x86_64
Mac OS X
Points:
---
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
Created attachment 643720 [details] [diff] [review]
Proposed fix for the bug

If MacPorts' egrep is on your $PATH before Apple's egrep, building mozilla-central on Mac OS X v10.7 (Lion) fails with this error:

> arch: posix_spawnp: egrep: Bad CPU type in executable

from trying to run this command:

    $ arch -arch i386 egrep <args>

because the MacPorts egrep is by default only built for the local machine architecture, x86-64 in this case [1].

    $ which egrep
    /opt/local/bin/egrep
    $ egrep --version | head -1
    egrep (GNU grep) 2.10
    $ file `which egrep`
    /opt/local/bin/egrep: Mach-O 64-bit executable x86_64

See also bug 655339 and bug 750574.

This patch fixes the problem by preferring to use the 32-bit architecture if available but falling back on 64-bit if that's the only one, like with MacPorts' egrep.  If the MacPorts egrep is built as a universal binary, this will still choose i386, but that shouldn't cause any problems.  MacPorts' egrep does not have the bug causing the issues in bug 655339, at least not as of v2.10.

[1]: https://trac.macports.org/wiki/howto/buildUniversal
Attachment #643720 - Flags: review?(ted.mielczarek)
Comment on attachment 643720 [details] [diff] [review]
Proposed fix for the bug

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

This is the bug that keeps on giving. Thanks for fixing this.
Attachment #643720 - Flags: review?(ted.mielczarek) → review+
Assignee: nobody → adam
Keywords: checkin-needed
(Assignee)

Comment 2

5 years ago
Created attachment 643914 [details] [diff] [review]
Fix v1.1

Added bug number and reviewer to description
Attachment #643720 - Attachment is obsolete: true
(Assignee)

Updated

5 years ago
Attachment #643914 - Flags: review?(ted.mielczarek)
Attachment #643914 - Flags: review?(ted.mielczarek) → review+
You don't need re-review for a minor cosmetic change like that, FYI.
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Assignee)

Comment 4

5 years ago
Ah ok, I wasn't sure what the protocol was, so I erred on the safe side.
https://hg.mozilla.org/integration/mozilla-inbound/rev/457d860988bf
Flags: in-testsuite-
Keywords: checkin-needed

Comment 6

5 years ago
https://hg.mozilla.org/mozilla-central/rev/457d860988bf
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
You need to log in before you can comment on or make changes to this bug.