Opened on 02/16/2018 at 08:09:05 AM

Closed on 04/12/2018 at 11:54:56 AM

#6396 closed defect (fixed)

Error creating non debug build config

Reported by: jwangenheim Assignee:
Priority: P2 Milestone:
Module: Adblock-Plus-for-Chromium Keywords:
Cc: diegocarloslima, Anton, sergz Blocked By:
Blocking: Platform: Android
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29720588/
https://gitlab.com/eyeo/adblockplus/chromium/merge_requests/10
https://codereview.adblockplus.org/29733646/

Description

Environment

Chromium + ABP (https://gitlab.com/eyeo/adblockplus/orca-android/tree/orca)

How to reproduce

  1. navigate to root source dir
  2. crate new ninja build config with gn gen --args='target_os="android" is_debug=false proprietary_codecs=true ffmpeg_branding="Chrome"' out/Default

Observed behaviour

Unable to create build config:

ERROR Input to target not generated by a dependency.
The file:
  //out/Default/libv8.cr.so
is listed as an input or source for the target:
  //third_party/libadblockplus_android:copy_libv8
but no targets in the build generate that file.

ERROR Input to target not generated by a dependency.
The file:
  //out/Default/libv8_libbase.cr.so
is listed as an input or source for the target:
  //third_party/libadblockplus_android:copy_libv8_libbase
but no targets in the build generate that file.

If you have generated inputs, there needs to be a dependency path between the
two targets in addition to just listing the files. For indirect dependencies,
the intermediate ones must be public_deps. data_deps don't count since they're
only runtime dependencies. If you think a dependency chain exists, it might be
because the chain is private. Try "gn path" to analyze.

Expected behaviour

We should be able to create non debug build config too.

Attachments (0)

Change History (20)

comment:1 Changed on 02/16/2018 at 11:08:42 AM by asmirnov

As a quick fix one can add is_component_build=true to gn gen ...
More on this: https://chromium.googlesource.com/chromium/src/+/master/docs/component_build.md

comment:2 Changed on 02/16/2018 at 11:59:39 AM by asmirnov

  • Cc sergz added

comment:3 Changed on 02/16/2018 at 02:54:25 PM by jwangenheim

Thanks for the hint, anton.is_component_build=true does not work with is_official_build=true. The docs say is_official_build=true does a lot of optimizations but how I understand it, it's only used for desktop builds.
I'll try to run a full build over the weekend.

Last edited on 02/16/2018 at 02:54:57 PM by jwangenheim

comment:4 follow-up: Changed on 02/21/2018 at 08:16:14 AM by jwangenheim

I found out that we should set is_official_build=true for all builds that we intend to be used by users. "official build" here is supposed to mean "as opposed to a developer build", and it has not anything to do with Google/Chrome/etc.

So the temporary fix unfortunately doesn't help us with release builds.

Last edited on 02/21/2018 at 08:16:36 AM by jwangenheim

comment:5 in reply to: ↑ 4 Changed on 02/21/2018 at 08:17:56 AM by asmirnov

Replying to jwangenheim:

I found out that we should set is_official_build=true for all builds that we intend to be used by users. "official build" here is supposed to mean "as opposed to a developer build", and it has not anything to do with Google/Chrome/etc.

So the temporary fix unfortunately doesn't help us with release builds.

Yes, i'm on it. The problem is that for Release ("official") build we have neither static nor dynamic libraries for v8 and we have nothing to link with libadblockplus-android.

comment:6 follow-up: Changed on 02/21/2018 at 08:22:26 AM by asmirnov

BTW i've found this assert https://gitlab.com/adblockplus/chromium/blob/abp/BUILD.gn#L41 is the only thing that prevents gn gen with both is_official_build and is_component_buld equal to true at the same time (as dirty hack as i do understand that it prevents from some optimizations). Not tested building though..

comment:7 in reply to: ↑ 6 Changed on 02/23/2018 at 10:52:06 AM by jwangenheim

Replying to asmirnov:

BTW i've found this assert https://gitlab.com/adblockplus/chromium/blob/abp/BUILD.gn#L41 is the only thing that prevents gn gen with both is_official_build and is_component_buld equal to true at the same time (as dirty hack as i do understand that it prevents from some optimizations). Not tested building though..

Yeah, I've seen that too. I'll remove the check and try to run a non debug build over the weekend. Would be nice to at least get an unsigned release APK as a result, that we can sign with our own key and start to distribute among the team.

comment:8 Changed on 02/26/2018 at 06:31:59 AM by asmirnov

Just wanted to add the task is in progress. However it seems to be not as easy as expected. We have to build "libchrome.so" to link "libadblockplusandroid-jni.so" but the last is a step of building of apk and "libchrome.so". So we're having circular dependencies:

ERROR Dependency cycle:
  //chrome/android:chrome_java__build_config ->
  //chrome/android:chrome_java_resources__build_config ->
  //third_party/libadblockplus_android:settings_aar_java__build_config ->
  //third_party/libadblockplus_android:settings_aar_java__res__build_config ->
  //third_party/libadblockplus_android:settings_aar_java__unpack_aar ->
  //third_party/libadblockplus_android:make ->
  //third_party/libadblockplus_android:copy_libchromium ->
  //chrome/android:chrome ->
  //chrome/android:chrome_jni_registration ->
  //chrome/android:chrome_public_apk__build_config ->
  //chrome/android:app_hooks_java__build_config ->
  //chrome/android:chrome_java__build_config

Trying to separate native code build and aar build or to change GN build configuration to build static libraries even in release build..

Last edited on 02/26/2018 at 07:27:40 AM by asmirnov

comment:9 Changed on 02/27/2018 at 07:42:51 AM by jwangenheim

Thanks for the update anton! I have successfully ran the build with is_debug = false, is_official_build = true and is_component_build = true but the outcome is still a signed APK. Seems like there is still something missing to create an unsigned APK.

Last edited on 02/27/2018 at 07:44:03 AM by jwangenheim

comment:10 Changed on 02/27/2018 at 07:46:07 AM by asmirnov

Please try to run the apk and make sure it's working. Also please upload apk to Google Drive in any case (works/not works) for me to analyze it (in email or IRC).

comment:11 Changed on 02/27/2018 at 07:57:37 AM by jwangenheim

It's running and it blocks ads. You can download it here: https://drive.google.com/open?id=1A7a-C4KGPKq6Mv9_7_jksud4_dYhpu_x

This is the complete build config:

target_os = "android"
proprietary_codecs = true
is_official_build = true
is_component_build = true
is_debug = false
ffmpeg_branding = "Chrome"

comment:12 Changed on 02/27/2018 at 08:07:34 AM by asmirnov

I can see multiple shared libs (.so) in the apk and it means is_component_build = true is actually working even if having is_debug = false. This is what we want! However i will spend some more time on trying to have only v8 as shared library i order not to loose in performance but still be able to link libadblockplus-android with Chromium's v8.

Last edited on 02/27/2018 at 06:39:20 PM by asmirnov

comment:13 Changed on 02/27/2018 at 08:18:45 AM by jwangenheim

Perfect, that sounds like a good plan!

comment:14 Changed on 03/12/2018 at 11:23:31 AM by asmirnov

  • Review URL(s) modified (diff)

comment:15 Changed on 03/12/2018 at 11:52:40 AM by asmirnov

I've modified V8 build configuration to build V8 as shared library even in Release mode. We need it to link libadblockplus-android with Chromium's V8. So now we can get apk with libv8.cr.so inside. But it crashes in runtime:

03-12 13:08:25.204 18651-18709 I/cr_LibraryLoader: Loading adblockplus-jni
03-12 13:08:25.464 300-300 I/DEBUG:     #00 pc 0003c9d0  /data/app/org.chromium.chrome-1/lib/arm/libadblockplus-jni.so
03-12 13:08:26.534 791-791 D/CrashAnrDetector: Build: samsung/hltexx/hlte:5.0/LRX21V/N9005XXSGBPL7:user/release-keys
                                               Hardware: MSM8974
                                               Revision: 8
                                               Bootloader: N9005XXSGBPL7
                                               Radio: unknown
                                               Kernel: Linux version 3.4.0-4540543 (dpi@SWDD6401) (gcc version 4.8 (GCC) ) #1 SMP PREEMPT Tue Dec 27 16:06:02 KST 2016
                                               
                                               *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
                                               Build fingerprint: 'samsung/hltexx/hlte:5.0/LRX21V/N9005XXSGBPL7:user/release-keys'
                                               Revision: '8'
                                               ABI: 'arm'
                                               pid: 18651, tid: 18709, name: AsyncTask #5  >>> org.chromium.chrome <<<
                                               signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xe9b03c00
                                                   r0 f4d81e00  r1 f4d81e00  r2 f4d81e00  r3 0000074d
                                                   r4 f4d81e00  r5 f4d81e00  r6 afc00504  r7 b6fa6d10
                                                   r8 00000005  r9 b6fab82c  sl 00000001  fp 0012b750
                                                   ip 00000009  sp 9fbf6d30  lr b6f9ea8f  pc 000449d0  cpsr a00b0030
                                                   d0  0000000000000000  d1  0000000000000000
                                                   d2  0000000000000000  d3  0000000000000000
                                                   d4  2c31202b20646e45  d5  22203d2120293220
                                                   d6  2020200a29222f2f  d7  6e20776f72687420
                                                   d8  41dfffffffc00000  d9  c1e0000000000000
                                                   d10 43e0000000000000  d11 c3e0000000000000
                                                   d12 df0000005f000000  d13 0000000000000000
                                                   d14 0000000000000000  d15 0000000000000000
                                                   d16 0000000000050000  d17 72632e6573616262
                                                   d18 006100620069006c  d19 006f006c00620064
                                                   d20 70e683e800000000  d21 130e507000000000
                                                   d22 0000000112fc41d0  d23 000049150000006c
                                                   d24 0000000000ffffff  d25 0000000000000000
                                                   d26 0000000000000000  d27 ffffffffffffffff
                                                   d28 ffffffffffffffff  d29 3c08080800000000
                                                   d30 0000000000000000  d31 003c000800080008
                                                   scr 20000011
                                               
                                               backtrace:
                                                   #00 pc 0003c9d0  /data/app/org.chromium.chrome-1/lib/arm/libadblockplus-jni.so
                                                   #01 pc 00001a8d  /system/bin/linker (__dl__ZN6soinfo12CallFunctionEPKcPFvvE+44)
                                                   #02 pc 00001b61  /system/bin/linker (__dl__ZN6soinfo9CallArrayEPKcPPFvvEjb+140)
                                                   #03 pc 00001e41  /system/bin/linker (__dl__ZN6soinfo16CallConstructorsEv+144)
                                                   #04 pc 00002495  /system/bin/linker (__dl__Z9do_dlopenPKciPK17android_dlextinfo+136)
                                                   #05 pc 00000ea1  /system/bin/linker (__dl__ZL10dlopen_extPKciPK17android_dlextinfo+24)
                                                   #06 pc 001d4297  /system/lib/libart.so (art::JavaVMExt::LoadNativeLibrary(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, art::Handle<art::mirror::ClassLoader>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+502)
                                                   #07 pc 001fc2e9  /system/lib/libart.so (art::Runtime_nativeLoad(_JNIEnv*, _jclass*, _jstring*, _jobject*, _jstring*)+548)
                                                   #08 pc 00019811  /system/framework/arm/boot.oat
                                               
                                               stack:
                                                        9fbf6cb0  001200a7  /data/app/org.chromium.chrome-1/lib/arm/libadblockplus-jni.so
                                                        9fbf6cb4  00000000  
                                                        9fbf6cb8  ffffffff  
                                                        9fbf6cbc  af55a0c0  [anon:libc_malloc]
                                                        9fbf6cc0  0000002a  
                                                        9fbf6cc4  464c457f  /dev/ashmem/dalvik-main space (deleted)
                                                        9fbf6cc8  00010101  /data/app/org.chromium.chrome-1/lib/arm/libadblockplus-jni.so
                                                        9fbf6ccc  00000000  
                                                        9fbf6cd0  00000000  
                                                        9fbf6cd4  00280003  
                                                        9fbf6cd8  00000001  
                                                        9fbf6cdc  00000000  
                                                        9fbf6ce0  00000034  
                                                        9fbf6ce4  00123940  /data/app/org.chromium.chrome-1/lib/arm/libadblockplus-jni.so
                                                        9fbf6ce8  05000200  
                                                        9fbf6cec  00200034  
                                                        9fbf6cf0  00280009  
                                                        9fbf6cf4  001b001c  
                                                        9fbf6cf8  00000009  
                                                        9fbf6cfc  a94e4000  
                                                        9fbf6d00  a94e4034  
                                                        9fbf6d04  00001000  
                                                        9fbf6d08  00008000  /data/app/org.chromium.chrome-1/lib/arm/libadblockplus-jni.so
                                                        9fbf6d0c  00126000  /data/app/org.chromium.chrome-1/lib/arm/libadblockplus-jni.so
                                                        9fbf6d10  00004000  
                                                        9fbf6d14  00008034  /data/app/org.chromium.chrome-1/lib/arm/libadblockplus-jni.so
                                                        9fbf6d18  afc00644  [anon:linker_alloc]
                                                        9fbf6d1c  b6fa6c0f  /system/bin/linker
                                                        9fbf6d20  00000001  
                                                        9fbf6d24  00000000  
                                                        9fbf6d28  afc00644  [anon:linker_alloc]
                                                        9fbf6d2c  b6f9eb65  /system/bin/linker (__dl__ZN

It seems like it fails to load some library (i assume libv8.cr.so is not loaded before loading of 'libadblockplus-jni.so').
Also i think it's because it's is_component_build=true so it does not actually try to load v8 shared library before (this should be done).

comment:17 Changed on 03/23/2018 at 08:05:42 AM by asmirnov

log on another device (nougat, using android linker):

03-23 11:53:01.619 21217-21228 I/cr_LibraryLoader: Using linker: org.chromium.base.library_loader.ModernLinker
03-23 11:53:01.638 21217-21231 I/cr_LibraryLoader: Loading v8_libbase.cr
03-23 11:53:01.640 21217-21231 I/cr_LibraryLoader: Loading v8.cr
03-23 11:53:01.641 21217-21231 E/cr_ChromiumAndroidLinker: LoadLibrary: Failed to obtain fixed address for load
03-23 11:53:01.641 21217-21231 E/cr_LibraryLoader: Unable to load library: libv8.cr.so
03-23 11:53:01.641 21217-21231 E/cr_LibraryLoader: Unable to load library: v8.cr
03-23 11:53:01.641 21217-21231 W/cr_ContentCPSDelegate: Failed to load native library with shared RELRO, retrying without
03-23 11:53:01.641 21217-21231 I/cr_LibraryLoader: Loading v8_libbase.cr
03-23 11:53:01.641 21217-21231 E/cr_ChromiumAndroidLinker: GetLibraryLoadSize: Failed to find library at address 0xbc5a0000
03-23 11:53:01.641 21217-21231 E/cr_ChromiumAndroidLinker: LoadLibrary: Unable to find size for load at 0xbc5a0000
03-23 11:53:01.641 21217-21231 E/cr_LibraryLoader: Unable to load library: libv8_libbase.cr.so
03-23 11:53:01.642 21217-21231 E/cr_LibraryLoader: Unable to load library: v8_libbase.cr
03-23 11:53:01.642 21217-21231 E/cr_ContentCPSDelegate: Failed to load native library on retry
                                                        org.chromium.base.library_loader.ProcessInitException
                                                            at org.chromium.base.library_loader.LibraryLoader.loadAlreadyLocked(LibraryLoader.java:375)
                                                            at org.chromium.base.library_loader.LibraryLoader.loadNowOverrideApplicationContext(LibraryLoader.java:186)
                                                            at org.chromium.content.app.ContentChildProcessServiceDelegate.loadNativeLibrary(ContentChildProcessServiceDelegate.java:131)
                                                            at org.chromium.base.process_launcher.ChildProcessServiceImpl$2.run(ChildProcessServiceImpl.java:188)
                                                            at java.lang.Thread.run(Thread.java:761)
                                                         Caused by: java.lang.UnsatisfiedLinkError: Unable to load library: libv8_libbase.cr.so
                                                            at org.chromium.base.library_loader.ModernLinker.loadLibraryImpl(ModernLinker.java:413)
                                                            at org.chromium.base.library_loader.LibraryLoader.loadAlreadyLocked(LibraryLoader.java:4569)
                                                            at org.chromium.base.library_loader.LibraryLoader.loadNowOverrideApplicationContext(LibraryLoader.java:186) 
                                                            at org.chromium.content.app.ContentChildProcessServiceDelegate.loadNativeLibrary(ContentChildProcessServiceDelegate.java:131) 
                                                            at org.chromium.base.process_launcher.ChildProcessServiceImpl$2.run(ChildProcessServiceImpl.java:188) 
                                                            at java.lang.Thread.run(Thread.java:761) 
03-23 11:53:01.643 21217-21231 I/art: System.exit called, status: -1
03-23 11:53:01.643 21217-21231 I/AndroidRuntime: VM exiting with result code -1, cleanup skipped.

comment:18 Changed on 03/26/2018 at 06:44:49 AM by asmirnov

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:19 Changed on 03/26/2018 at 10:53:15 AM by asmirnov

  • Review URL(s) modified (diff)

comment:20 Changed on 04/12/2018 at 11:54:56 AM by asmirnov

  • Resolution set to fixed
  • Status changed from reviewing to closed

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none).
 
Note: See TracTickets for help on using tickets.