Last Comment Bug 775405 - Build fails with "arch: posix_spawnp: egrep: Bad CPU type in executable" when MacPorts egrep is on $PATH
: Build fails with "arch: posix_spawnp: egrep: Bad CPU type in executable" when...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Build Config (show other bugs)
: Trunk
: x86_64 Mac OS X
: -- normal (vote)
: mozilla17
Assigned To: Adam Rosenfield
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-18 21:30 PDT by Adam Rosenfield
Modified: 2012-07-20 06:42 PDT (History)
2 users (show)
ryanvm: in‑testsuite-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Proposed fix for the bug (1.50 KB, patch)
2012-07-18 21:30 PDT, Adam Rosenfield
ted: review+
Details | Diff | Splinter Review
Fix v1.1 (1.52 KB, patch)
2012-07-19 10:28 PDT, Adam Rosenfield
ted: review+
Details | Diff | Splinter Review

Description Adam Rosenfield 2012-07-18 21:30:00 PDT
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
Comment 1 Ted Mielczarek [:ted.mielczarek] 2012-07-19 07:50:54 PDT
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.
Comment 2 Adam Rosenfield 2012-07-19 10:28:02 PDT
Created attachment 643914 [details] [diff] [review]
Fix v1.1

Added bug number and reviewer to description
Comment 3 Ted Mielczarek [:ted.mielczarek] 2012-07-19 10:46:28 PDT
You don't need re-review for a minor cosmetic change like that, FYI.
Comment 4 Adam Rosenfield 2012-07-19 10:49:25 PDT
Ah ok, I wasn't sure what the protocol was, so I erred on the safe side.
Comment 5 Ryan VanderMeulen [:RyanVM] 2012-07-19 19:10:19 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/457d860988bf
Comment 6 Ed Morley [:emorley] 2012-07-20 06:42:42 PDT
https://hg.mozilla.org/mozilla-central/rev/457d860988bf

Note You need to log in before you can comment on or make changes to this bug.