Closed Bug 790883 Opened 12 years ago Closed 3 years ago

mercurial fails to run after bootstrap install on osx (couldn't find mercurial libraries)

Categories

(Firefox Build System :: Bootstrap Configuration, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: glob, Unassigned)

References

Details

after running bootstrap on osx, i'm told:

Your system should be ready to build Firefox! If you have not already,
obtain a copy of the source code by running:

    hg clone https://hg.mozilla.org/mozilla-central

this results in:

$ hg clone https://hg.mozilla.org/mozilla-central
abort: couldn't find mercurial libraries in [/usr/platlib/Library/Python/2.7/site-packages /usr/local/bin /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC /Library/Python/2.7/site-packages]


this is on a 10.8.1 system.  brew wasn't installed prior to running bootstrap.

$ brew install hg
Error: mercurial-2.3.1 already installed, it's just not linked

PYTHONPATH is empty.


this is probably a brew issue; but here's what i had to do to fix it:

$ export PYTHONPATH=/usr/local/lib/python2.7/site-packages
$ cd /usr/local/lib/python2.7/site-packages/
$ ln -s ../../../Cellar/mercurial/2.3.1/libexec/mercurial-2.3.1-py2.7.egg-info
$ ln -s ../../../Cellar/mercurial/2.3.1/libexec/mercurial
$ hg version
Mercurial Distributed SCM (version 2.3.1)
...
Most interesting.

If you actually got:

  $ brew install hg
  Error: mercurial-2.3.1 already installed, it's just not linked

Then, we need to check for package link state, not just installation state and link as needed.

FWIW, you shouldn't need to set PYTHONPATH of create those symlinks. If you just |brew link mercurial| it should do all that symlink magic for you. If you look at the source for /usr/local/bin/hg, you'll see that it is adjusting sys.path to pick up /usr/local/lib/python2.7/site-packages. So, PYTHONPATH should be irrelevant.

Let me see if I can code up a patch to check homebrew package link state...
after removing the symlinks and clearing PYTHONPATH:

~ $ brew link mercurial
Linking /usr/local/Cellar/mercurial/2.3.1... Warning: Could not link mercurial. Unlinking...

Error: Could not symlink file: /usr/local/Cellar/mercurial/2.3.1/bin/hg
Target /usr/local/bin/hg already exists. You may need to delete it.
To force the link and delete this file, do:
  brew link -f formula_name

To list all files that would be deleted:
  brew link -n formula_name
It appears you've installed mercurial previously, possibly by doing |pip install| or something.

If you want homebrew to take things over, you can run those brew commands it printed.

We probably don't want to do this as part of bootstrap. Perhaps we should look for hg before attempting to install it through homebrew.
I get the same errors running mercurial, and I've never installed mercurial before. Additionally, from the steps above:

singerb@lambda:~/Documents/mozilla > brew link hg
Warning: Already linked: /usr/local/Cellar/mercurial/2.3.1
singerb@lambda:~/Documents/mozilla > brew install hg
Error: mercurial-2.3.1 already installed
singerb@lambda:~/Documents/mozilla >

it appears to have installed fine.
Additionally, the symlinks suggested above don't appear to be needed; mercurial/ and the egg are already in /usr/local/lib/python2.7/site-packages. Setting PYTHONPATH as suggested also has no effect. I'll clone with git for now, but would prefer to get mercurial working.
Just to add, with you got a message like this "mercurial-x.x already installed, it's just not linked" when running 'brew install mercurial'. Don't worry. It looks like you have installed mercurial before. 

Homebrew tries to don't mess up your system.
You can run 'brew link --overwrite --dry-run mercurial' to firstly see what will be overwritten, without actually doing it, or 'brew link --overwrite mercurial' to go ahead anyway.

Then, you can check if everything is fine by running 'hg' and 'brew doctor' commands.
When I run 'brew link --overwrite --dry-run mercurial', I get this response: 'Would remove:', so then I ran 'brew link --overwrite mercurial' and got this response: 

     Linking /usr/local/Cellar/mercurial/3.4... 
     Error: Could not symlink etc/bash_completion.d/hg-completion.bash /usr/local/etc/bash_completion.d is           not writable.

What is happening here?
(In reply to Tim Barry from comment #7)
> When I run 'brew link --overwrite --dry-run mercurial', I get this response:
> 'Would remove:', so then I ran 'brew link --overwrite mercurial' and got
> this response: 
> 
>      Linking /usr/local/Cellar/mercurial/3.4... 
>      Error: Could not symlink etc/bash_completion.d/hg-completion.bash
> /usr/local/etc/bash_completion.d is           not writable.
> 
> What is happening here?

Sounds like a filesystem permissions issue, possibly caused by running `brew` as root, possibly via `sudo`. Running `brew doctor` *may* fix things up for you.
Product: Core → Firefox Build System
Component: General → Bootstrap Configuration

I haven't hit this issue in years, closing.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.