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

Change History (20)

comment:1 Changed 22 months ago 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 22 months ago by asmirnov

  • Cc sergz added

comment:3 Changed 22 months ago 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 22 months ago by jwangenheim (previous) (diff)

comment:4 follow-up: Changed 22 months ago 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 22 months ago by jwangenheim (previous) (diff)

comment:5 in reply to: ↑ 4 Changed 22 months ago 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 22 months ago 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 22 months ago 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 22 months ago 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 22 months ago by asmirnov (previous) (diff)

comment:9 Changed 22 months ago 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 22 months ago by jwangenheim (previous) (diff)

comment:10 Changed 22 months ago 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 22 months ago 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 22 months ago 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 22 months ago by asmirnov (previous) (diff)

comment:13 Changed 22 months ago by jwangenheim

Perfect, that sounds like a good plan!

comment:14 Changed 21 months ago by asmirnov

  • Review URL(s) modified (diff)

comment:15 Changed 21 months ago 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 21 months ago 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 21 months ago by asmirnov

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

comment:19 Changed 21 months ago by asmirnov

  • Review URL(s) modified (diff)

comment:20 Changed 20 months ago by asmirnov

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.