"mach bootstrap" failed to set up clang on OS X 10.7

RESOLVED FIXED in mozilla32

Status

Firefox Build System
General
RESOLVED FIXED
5 years ago
4 months ago

People

(Reporter: jfkthame, Assigned: Nickolay_Ponomarev)

Tracking

unspecified
mozilla32
x86
Mac OS X

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
Tried to use "./mach bootstrap" to update my build env on OS X 10.7. After ensure Xcode and its tools were up to date, I ran into the following failure:

>>>>> begin <<<<<

$ ./mach bootstrap

It looks like you have multiple package managers installed.


Please choose a package manager you'd like:
1. Homebrew
2. MacPorts
Your choice:
2
Executing as root: sudo /opt/local/bin/port select --set python python27
Password:
Selecting 'python27' for 'python' succeeded. 'python27' is now active.
Executing as root: sudo /opt/local/bin/port select --set clang mp-clang-3.3
Selecting 'mp-clang-3.3' for 'clang' failed: The specified group 'clang' does not exist.
Error running mach:

    ['bootstrap']

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:

CalledProcessError: Command '[u'sudo', u'/opt/local/bin/port', u'select', u'--set', u'clang', u'mp-clang-3.3']' returned non-zero exit status 1

  File "/Users/jkew/mozdev/mc-clean/python/mozboot/mozboot/mach_commands.py", line 24, in bootstrap
    bootstrapper.bootstrap()
  File "/Users/jkew/mozdev/mc-clean/python/mozboot/mozboot/bootstrap.py", line 89, in bootstrap
    instance.install_system_packages()
  File "/Users/jkew/mozdev/mc-clean/python/mozboot/mozboot/osx.py", line 179, in install_system_packages
    getattr(self, 'ensure_%s_packages' % choice)()
  File "/Users/jkew/mozdev/mc-clean/python/mozboot/mozboot/osx.py", line 318, in ensure_macports_packages
    self.run_as_root([self.port, 'select', '--set', 'clang', 'mp-' + MACPORTS_CLANG_PACKAGE])
  File "/Users/jkew/mozdev/mc-clean/python/mozboot/mozboot/base.py", line 113, in run_as_root
    subprocess.check_call(command, stdin=sys.stdin)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)

>>>>>  end  <<<<<

I was able to overcome this by manually running "sudo port install clang-3.3"; after this, re-running mach bootstrap appears to have succeeded. But I thought mach bootstrap was supposed to avoid the need for such manual installations. (It wasn't instantly obvious what I needed to install; my first guess was to try "sudo port install clang", but that failed.)

Comment 1

5 years ago
We've historically had issues getting MacPorts and Clang to play nice. See also bug 934165 and bug 887814 for starters.

If you have ideas to fix this, please submit a patch.
(Assignee)

Comment 2

5 years ago
Looking at |ensure_macports_packages| http://mxr.mozilla.org/mozilla-central/source/python/mozboot/mozboot/osx.py#297 it seems that we only attempt to install macports' clang on OS X < 10.7, but call "port select" on the modern systems anyway.

As far as I understand, we just shouldn't call 'port select' if clang is not installed with macports.

Commenting out
>>319         self.run_as_root([self.port, 'select', '--set', 'clang', 'mp-' + MACPORTS_CLANG_PACKAGE])
worked fine in my setup (OS X 10.9, macports, no macports clang).

Comment 3

5 years ago
(In reply to Nickolay_Ponomarev from comment #2)
> Looking at |ensure_macports_packages|
> http://mxr.mozilla.org/mozilla-central/source/python/mozboot/mozboot/osx.
> py#297 it seems that we only attempt to install macports' clang on OS X <
> 10.7, but call "port select" on the modern systems anyway.
> 
> As far as I understand, we just shouldn't call 'port select' if clang is not
> installed with macports.
> 
> Commenting out
> >>319         self.run_as_root([self.port, 'select', '--set', 'clang', 'mp-' + MACPORTS_CLANG_PACKAGE])
> worked fine in my setup (OS X 10.9, macports, no macports clang).

We'll gladly accept a patch! I'm not a MacPorts user and am not sure the best way to solve this problem. If you know what you are doing, by all means contribute a fix!
(Assignee)

Comment 4

4 years ago
Created attachment 8420595 [details] [diff] [review]
957186.patch

> 319         self.run_as_root([self.port, 'select', '--set', 'clang', 'mp-' + MACPORTS_CLANG_PACKAGE])

This line came from bug 862562 comment 3, an effort to make bootstrap work on 10.6, so it's only fair to put it into 10.6-only section, I think, since newer Macs are supposed to work fine with XCode-provided clang.
Attachment #8420595 - Flags: review?(gps)

Comment 5

4 years ago
Comment on attachment 8420595 [details] [diff] [review]
957186.patch

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

LGTM. I'll land this for you.
Attachment #8420595 - Flags: review?(gps) → review+

Comment 6

4 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/b3b8c58f83a9
Assignee: nobody → asqueella
Status: NEW → ASSIGNED

Updated

4 years ago
Component: mach → Build Config
https://hg.mozilla.org/mozilla-central/rev/b3b8c58f83a9
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32

Updated

4 months ago
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.