Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#4453 closed defect (worksforme)

Failed to link libadblockplus-android with Android NDK 11c

Reported by: asmirnov Assignee:
Priority: P3 Milestone:
Module: Libadblockplus-Android Keywords:
Cc: sergz, rjeschke Blocked By: #4062
Blocking: Platform: Android
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description

Environment

libadblockplus can be linked with android ndk 10 (tested with 10e), but can NOT be linked with ndk 11 (tested with 11c), both logs attached.

How to reproduce

  1. run "./gradlew clean assemble"

...

Attachments (2)

build_ndk10e.log (13.8 KB) - added by asmirnov 3 years ago.
build_ndk11c.log (28.0 KB) - added by asmirnov 3 years ago.

Download all attachments as: .zip

Change History (9)

Changed 3 years ago by asmirnov

Changed 3 years ago by asmirnov

comment:1 Changed 3 years ago by asmirnov

  • Cc sergz rjeschke added

comment:2 Changed 3 years ago by asmirnov

  • Summary changed from Failed to link libadblockplus with Android NDK 11c to Failed to link libadblockplus-android with Android NDK 11c

comment:3 Changed 3 years ago by asmirnov

  • Blocked By 4062 added

comment:4 Changed 3 years ago by asmirnov

According to release notes (https://developer.android.com/ndk/downloads/revision_history.html) ndk 11:

Changed libc++’s inline namespace to std::__ndk1 to prevent ODR issues with platform libc++

It forces us to compile both libadblockplus-android and libadblockplus with the same version of ndk (let's say ndk11).
Currently libadblockplus is compiled with ndk10 or older and using std::__1 namespace for linking and libadblockplus-android is compiled (trying) with ndk11 and using std::__ndk1 namespace.

ok. Now trying to skip using prebuilt libadblockplus files and recompile it with ndk11 too.
The latest libadblockplus is using v8 of revision:

third_party/v8 = v8-googlesource hg:28969bee9861 git:6bcca144a974f97d9496d3f7b538f90208f89c2e

It's pretty ancient and it can be compiled with gcc toolchain 4.6 only, since in "Makefile.android" "4.6" it's hardcoded.
I've tried to replace it with "4.9" which is present in ndk11 and ndk12 but got build error:

../third_party/v8/src/api.h:130:3: note: in expansion of macro 'STATIC_ASSERT'
   STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address));
   ^
  AR(target) /Users/asmirnov/Documents/dev/src/libadblockplus.ssh3/third_party/v8/../../build/android_ia32.release/obj.target/tools/gyp/libv8_base.ia32.a
i686-linux-android-ar: invalid option -- /
Usage: /softdev/android-ndk-r11c//toolchains/x86-4.9/prebuilt/darwin-x86_64/bin/i686-linux-android-ar [emulation options] [-]{dmpqrstx}[abcDfilMNoPsSTuvV] [--plugin <name>] [member-name] [count] archive-file file...
       /softdev/android-ndk-r11c//toolchains/x86-4.9/prebuilt/darwin-x86_64/bin/i686-linux-android-ar -M [<mri-script]
 commands:
 command specific modifiers:
  [a]          - put file(s) after [member-name]
  [b]          - put file(s) before [member-name] (same as [i])
  [D]          - use zero for timestamps and uids/gids
  [U]          - use actual timestamps and uids/gids (default)
  [N]          - use instance [count] of name
  [f]          - truncate inserted file names
  [P]          - use full path names when matching
  [o]          - preserve original dates
  [u]          - only replace files that are newer than current archive contents
 generic modifiers:
  [c]          - do not warn if the library had to be created
  [s]          - create an archive index (cf. ranlib)
  [S]          - do not build a symbol table
  [T]          - make a thin archive
  [v]          - be verbose
  [V]          - display the version number
  @<file>      - read options from <file>
  --target=BFDNAME - specify the target object format as BFDNAME
 optional:
  --plugin <p> - load the specified plugin
 emulation options: 
  No emulation specific options
/softdev/android-ndk-r11c//toolchains/x86-4.9/prebuilt/darwin-x86_64/bin/i686-linux-android-ar: supported targets: elf32-i386 a.out-i386-linux pei-i386 elf64-x86-64 elf32-x86-64 pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex
make[4]: *** [/Users/asmirnov/Documents/dev/src/libadblockplus.ssh3/third_party/v8/../../build/android_ia32.release/obj.target/tools/gyp/libv8_base.ia32.a] Error 1
make[3]: *** [android_ia32.release] Error 2
make[2]: *** [android_ia32.release] Error 2
make[1]: *** [v8_android_multi] Error 2
make: *** [android_x86] Error 2

We can't just update v8 to the more recent version because of blocking issue.

Will be continues after blocking task resolved.

Last edited 3 years ago by asmirnov (previous) (diff)

comment:5 Changed 3 years ago by asmirnov

i've just tried android ndk r13b and it obviously does not compile it becuase of missing 4.6 toolchain.
a symlinking toolchain 4.9 to 4.6 as a trivial workaround fails after few minutes of compilation:

...
../third_party/v8/src/checks.h:256:5: note: in expansion of macro 'SEMI_STATIC_JOIN'
     SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__)
     ^
../third_party/v8/src/checks.h:289:30: note: in expansion of macro 'STATIC_CHECK'
 #define STATIC_ASSERT(test)  STATIC_CHECK(test)
                              ^
../third_party/v8/src/api.h:130:3: note: in expansion of macro 'STATIC_ASSERT'
   STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address));
   ^
  AR(target) /Users/asmirnov/Documents/dev/src/libadblockplus.ssh2/third_party/v8/../../build/android_arm.release/obj.target/tools/gyp/libv8_base.arm.a
arm-linux-androideabi-ar: invalid option -- /
Usage: /softdev/android-ndk-r13b/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar [emulation options] [-]{dmpqrstx}[abcDfilMNoPsSTuvV] [--plugin <name>] [member-name] [count] archive-file file...
       /softdev/android-ndk-r13b/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar -M [<mri-script]
 commands:
  d            - delete file(s) from the archive
  m[ab]        - move file(s) in the archive
  p            - print file(s) found in the archive
  q[f]         - quick append file(s) to the archive
  r[ab][f][u]  - replace existing or insert new file(s) into the archive
  s            - act as ranlib
  t            - display contents of archive
  x[o]         - extract file(s) from the archive
 command specific modifiers:
  [a]          - put file(s) after [member-name]
  [b]          - put file(s) before [member-name] (same as [i])
  [D]          - use zero for timestamps and uids/gids
  [U]          - use actual timestamps and uids/gids (default)
  [N]          - use instance [count] of name
  [f]          - truncate inserted file names
  [P]          - use full path names when matching
  [o]          - preserve original dates
  [u]          - only replace files that are newer than current archive contents
 generic modifiers:
  [c]          - do not warn if the library had to be created
  [s]          - create an archive index (cf. ranlib)
  [S]          - do not build a symbol table
  [T]          - make a thin archive
  [v]          - be verbose
  [V]          - display the version number
  @<file>      - read options from <file>
  --target=BFDNAME - specify the target object format as BFDNAME
 optional:
  --plugin <p> - load the specified plugin
 emulation options: 
  No emulation specific options
/softdev/android-ndk-r13b/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar: supported targets: elf32-littlearm elf32-bigarm elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex
make[4]: *** [/Users/asmirnov/Documents/dev/src/libadblockplus.ssh2/third_party/v8/../../build/android_arm.release/obj.target/tools/gyp/libv8_base.arm.a] Error 1
make[3]: *** [android_arm.release] Error 2
make[2]: *** [android_arm.release] Error 2
make[1]: *** [v8_android_multi] Error 2
make: *** [android_arm] Error 2

comment:6 Changed 2 years ago by sergz

  • Resolution set to worksforme
  • Status changed from new to closed

As #4907 is landed and now ndk 12b is required, the version (11c) in this issue is not relevant anymore. For problems with other versions please create corresponding issues.

comment:7 Changed 2 years ago by asmirnov

Last edited 2 years ago by asmirnov (previous) (diff)
Note: See TracTickets for help on using tickets.