13

I'm trying to build the executable target for ChromeDriver from source with GN, which I installed in a directory on my PATH with Depot Tools, but when I run gn BUILD.gn I'm getting this error:

gn.py: Could not find checkout in any parent of the current path.
This must be run inside a checkout.

I'm not sure if I need to checkout the entire Chromium directory, if I'm not setting this up correctly?

UPDATE

I've downloaded a working binary of gn with the help of gn_tool.

I'm still unsure what command I'm supposed to run for "building the chromedriver target", because right now every command I try seems to give me this error:

ERROR Can't find source root. I could not find a ".gn" file in the current directory or any parent,and the --root command-line argument was not specified.

...even though there is a BUILD.gn file in the directory where I'm running gn...

0

6 Answers 6

8
+100

Looks like some dependencies are missing. You can pull the dependencies by running

gclient sync

which should download the required dependencies for Chrome driver to compile. Then run the following commands to start compiling Chrome driver:

gn gen out/YourBuildFolder
ninja -C out/YourBuildFolder chromedriver

The above gn gen... command will basically prepare the build folder for the ninja build system to compile by copying the dependencies and preparing necessary files. And ninja -C... command will actually start compiling the files

Hope that works. Thanks

8
  • do you know what's up with the buildtools directory? If I don't have it in my directory I can't build my target -- i've added my own target to the source tree. Commented Jan 7, 2021 at 9:24
  • 1
    Well actually am a Chromium developer but you won't find docs for every thing in the Chromium world. Also gclient sync will download that compiler and other third-party libraries and source code needed for it to compile. So that doesn't necessary mean, it has to be inside buildtools folder. Most of the third-party deps that are downloaded after executing gclient sync are stored in third_party folder in Chromium. Also you might want to look at DEPS file, which include references to repos that will will be downloaded by it
    – Asesh
    Commented Jan 7, 2021 at 13:12
  • 1
    @ThomasDignan Actually gclient is part of depot_tools so this page might be helpful to you: dev.chromium.org/developers/how-tos/depottools
    – Asesh
    Commented Jan 7, 2021 at 13:15
  • 1
    Should have mentioned this too: the above gn gen command will basically prepare the build folder for the ninja build system to compile by copying the dependencies and necessary files. And ninja -C command will actually start compiling the files.
    – Asesh
    Commented Jan 7, 2021 at 13:34
  • 1
    @Asesh yeah i'm realizing that just wanted to be certain I wasn't missing something easier! thanks very much for your answers. Commented Jan 8, 2021 at 13:46
3

I had same problem but figured it out.

When I run gn in depot_tool directory, I got same error message.

enter image description here

But I run gn in chromium/src directory, gn works!

enter image description here

0

This error occurs when you don't have a buildtools directory, such as the one in src/chromium/buildtools checked in to your git repository.

A cheap way to get this to work outside of chromium's source tree is to copy theirs to your build dir, e.g.:

cp -r ~/src/chromium/buildtools myrepo/buildtools

and check it in to git

cd myrepo
git add buildtools
git commit -m "add buildtools"

you should then be able to run gn gen out successfully in that repository.

-1

I have same problem just now.

According to https://chromium.googlesource.com/chromium/src/tools/gn/+/HEAD/docs/standalone.md, '.gn' and other build config files are missing. It seems the project can not be built standalone. Perhaps you should checkout the entire Chromium directory.

-1

path of depot_tool is not setup, try in terminal:

export PATH="$PATH:/path/to/depot_tools"

in src you have gn as well so that's why code is running.

-1

path of depot_tool is not setup, try in terminal:

export PATH="$PATH:/path/to/depot_tools"

in src you have gn as well so that's why code is running.

Src folder does not has gn - executable file. This complaint means that the build system cannot find ng.exe(for windows) file is located in "build_tools" packet(do not confuse with "depot_tools" ). You may set CHROMIUM_BUILDTOOLS_PATH=D:\PROJECTS\Web\ to find it. But you have to download correct version of this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.