How to properly build Cronet?

467 views
Skip to first unread message

Gabi Zuniga

unread,
Nov 22, 2016, 6:26:43 PM11/22/16
to net-dev
I attempted building cronet using "cr_cronet.py gn" and then "cr_cronet build" on a Linux machine.
However I get assertion errors complaining about the output directory location.

I then tried to build manually by using gn and ninja directly and was able to successfully build the cronet and cronet_package targets, however I am not getting native libraries for all architectures (only armeabi_v7a). 
Also I am getting a collection of jars instead of the cronet.jar like in https://console.cloud.google.com/storage/browser/chromium-cronet/android
Is there any document that explains how to correctly build cronet for android?

Misha Efimov

unread,
Nov 23, 2016, 9:30:33 AM11/23/16
to Gabi Zuniga, net-dev
On Tue, Nov 22, 2016 at 6:26 PM, Gabi Zuniga <ga...@alignd.io> wrote:
I attempted building cronet using "cr_cronet.py gn" and then "cr_cronet build" on a Linux machine.
However I get assertion errors complaining about the output directory location.
This should work. What kind of assertion errors do you get? Can you try to remove out/ directory? 

I then tried to build manually by using gn and ninja directly and was able to successfully build the cronet and cronet_package targets, however I am not getting native libraries for all architectures (only armeabi_v7a). 
That is expected, each build configuration is targeting one architecture. Builds referenced below are produced by combining output from several builders. With gn you can have multiple different target directories with different architectures in one check out, which is good.
 
Also I am getting a collection of jars instead of the cronet.jar like in https://console.cloud.google.com/storage/browser/chromium-cronet/android
This is result of recent refactoring to allow better separation of API from implementation and native implementation from platform java implementation, for example see https://console.cloud.google.com/storage/browser/chromium-cronet/android/56.0.2924.0/Release/cronet/?pli=1
 
Is there any document that explains how to correctly build cronet for android?
Unfortunately there is no public document yet, but we should consider creating one.

--
You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+unsubscribe@chromium.org.
To post to this group, send email to net...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/net-dev/fd07ab52-a91f-441a-a410-a1de9c384d99%40chromium.org.

Gabi Zuniga

unread,
Nov 23, 2016, 7:19:12 PM11/23/16
to net-dev
Thanks!
(cr_cronet does not seem to accept a target_cpu option)

Misha Efimov

unread,
Nov 28, 2016, 10:54:59 AM11/28/16
to Gabi Zuniga, net-dev
The cr_cronet script is primarily development aid, so it targets default configuration used for testing.

The easiest way to create configurations for different cpus is to modify command line printed by 'cr_cronet.py gn', for example

$ components/cronet/tools/cr_cronet.py gn
Namespace(asan=False, command='gn', gn=False, iphoneos=False, out_dir=None, release=False)
[]
gn gen out/Debug --args='use_errorprone_java_compiler=true arm_use_neon=false target_os="android" enable_websockets=false disable_ftp_support=true use_platform_icu_alternatives=true disable_brotli_filter=true is_component_build=false ignore_elf32_limitations=true'  
Done. Made 12946 targets from 1068 files in 3184ms

$ gn gen out/Debug-x86 --args='use_errorprone_java_compiler=true target_os="android" enable_websockets=false disable_file_support=true disable_ftp_support=true use_platform_icu_alternatives=true disable_brotli_filter=true is_component_build=false ignore_elf32_limitations=true target_cpu="x86"'
Done. Made 12955 targets from 1067 files in 3261ms

Build cronet_package target in each build directory:

$ ninja -C out/Debug-x86 cronet_package

And combine content of out/<xyz>/cronet into one folder.

This is pretty much what official builders do.

--
You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+unsubscribe@chromium.org.
To post to this group, send email to net...@chromium.org.
Reply all
Reply to author
Forward
0 new messages