Bug 104523 - build-webkit --chromium --ninja should show a better error message when ninja is missing
Summary: build-webkit --chromium --ninja should show a better error message when ninja...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-10 01:40 PST by Eric Seidel (no email)
Modified: 2012-12-10 20:53 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2012-12-10 01:40:40 PST
build-webkit --chromium --ninja should show a better error message when ninja is missing

Currently:

[robert@mwenge WebKit (101803-6)]$ lucid ./Tools/Scripts/update-webkit --chromium --ninja
Updating OpenSource
Current branch 101803-6 is up to date.
Updating chromium port dependencies using gclient...
Syncing projects:  98% (54/55), done.party/icu                     

________ running '/usr/bin/python tools/clang/scripts/update.py --mac-only' in '/home/robert/Dev/WebKit/Source/WebKit/chromium'

________ running '/usr/bin/python gyp_webkit' in '/home/robert/Dev/WebKit/Source/WebKit/chromium'
Updating webkit projects from gyp files...
Using overrides found in /home/robert/.gyp/include.gypi
[robert@mwenge WebKit (101803-6)]$ lucid ./Tools/Scripts/build-webkit --chromium --makearg=-j5
ninja not found. Install chromium's depot_tools by running update-webkit first
[robert@mwenge WebKit (101803-6)]$ 


We should show the path of the discovered depot_tools, and explain that chromium depot tools only contains ninja binaries for linux-64, mac and win and any other platforms will need to build ninja themselves.
Comment 1 Eric Seidel (no email) 2012-12-10 01:43:06 PST
With a link to ninja of course: http://martine.github.com/ninja/ :)
Comment 2 Nico Weber 2012-12-10 08:38:36 PST
Now that I look at the code, my analysis was probably wrong. Here's the ninja discovery code from Tools/Scripts/webkitdirs.pm:

    # Find ninja.
    my $ninjaPath;
    if (commandExists('ninja')) {
        $ninjaPath = 'ninja';
    } elsif (-e 'Source/WebKit/chromium/depot_tools/ninja') {
        $ninjaPath = 'Source/WebKit/chromium/depot_tools/ninja';
    } else {
        die "ninja not found. Install chromium's depot_tools by running update-webkit first\n";
    }

ninja is a bash script in depot_tools, and that should always be found. Robert, does Source/WebKit/chromium/depot_tools exist on your box? (If not, do you know how `update-webkit --chromium` manages to find gclient?)


Here's the ninja bash script in depot_tools:

#!/bin/bash

# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

OS="$(uname -s)"
THIS_DIR="$(dirname "${0}")"

if [ "${OS}" = "Linux" ]; then
  exec "${THIS_DIR}/ninja-linux64" "$@"
elif [ "${OS}" = "Darwin" ]; then
  exec "${THIS_DIR}/ninja-mac" "$@"
elif [[ ${OS} == CYGWIN* ]]; then
  exec cmd.exe /c `cygpath -t windows $0`.exe "$@"
elif [[ ${OS} == MINGW32* ]]; then
  cmd.exe //c $0.exe "$@"
else
  echo "Unsupported OS ${OS}"
  exit 1
fi


exec will probably print something like "don't know how to exec ninja-linux64" on a 32bit linux, and that diagnostic should certainly be better -- but it looks like this script isn't even called, so we need to figure out why that's not happening first.
Comment 3 Robert Hogan 2012-12-10 10:26:44 PST
(In reply to comment #2)
> ninja is a bash script in depot_tools, and that should always be found. Robert, does Source/WebKit/chromium/depot_tools exist on your box? (If not, do you know how `update-webkit --chromium` manages to find gclient?)

Turns out I had a very old depot_tools from a couple of years ago in my path. I got rid of that and progressed to the message you suggest here:

> exec will probably print something like "don't know how to exec ninja-linux64" 

I think https://code.google.com/p/chromium/wiki/UsingALinuxChroot may work for me as my chroot is very old and not 64-bit. I will try it when I get the chance.

I will still be able to build with Makefiles though once ninja becomes default though right? I just need to pass an extra build flag?
Comment 4 Eric Seidel (no email) 2012-12-10 11:34:20 PST
We should just check in a linux32 binary to handle your case. :)  ninja is very tiny.
Comment 5 Eric Seidel (no email) 2012-12-10 11:35:03 PST
(In reply to comment #3)
> (In reply to comment #2)
> I will still be able to build with Makefiles though once ninja becomes default though right? I just need to pass an extra build flag?

Yes --no-ninja will work.  I believe --make exists to and will work in your case (or I'll make sure it does before I land!)
Comment 6 Nico Weber 2012-12-10 11:40:25 PST
(In reply to comment #4)
> We should just check in a linux32 binary to handle your case. :)  ninja is very tiny.

Dunno, the 32bit user base is also very tiny, and it's another binary for me to build when updating ninja.

I'll make the ninja shell script print something nicer on 32bit for now.
Comment 7 Nico Weber 2012-12-10 11:40:46 PST
And yes, make will still work for now, but it might go away eventually.
Comment 8 Nico Weber 2012-12-10 11:57:33 PST
https://codereview.chromium.org/11485007/ is adding a friendlier message.
Comment 9 Nico Weber 2012-12-10 20:53:32 PST
We ended up needing a 32bit ninja binary for the 32bit bots anyway ( :-/ ), so that's now checked in. https://codereview.chromium.org/11485007 will make the error message friendlier for non-mac/win/linux platforms. I think this is all done.