Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build with targets with Google Chromium GN?

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...

like image 215
legel Avatar asked Mar 10 '17 23:03

legel


People also ask

What is GN build?

GN is a meta-build system that generates NinjaBuild files. It's meant to be faster and simpler than GYP. It outputs only Ninja build files.

What is args GN?

"GN args" as used on this page are not the command line arguments passed to GN. They refer to the individual variables that are passed as part of the --args command line flag and/or written to the args.gn file.


1 Answers

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

like image 103
Asesh Avatar answered Oct 02 '22 23:10

Asesh