Closed Bug 775405 Opened 9 years ago Closed 9 years ago

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

Categories

(Firefox Build System :: General, defect)

x86_64
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla17

People

(Reporter: adam, Assigned: adam)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch Proposed fix for the bug (obsolete) — Splinter Review
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
Attached patch Fix v1.1Splinter Review
Added bug number and reviewer to description
Attachment #643720 - Attachment is obsolete: true
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
Ah ok, I wasn't sure what the protocol was, so I erred on the safe side.
https://hg.mozilla.org/mozilla-central/rev/457d860988bf
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.