Sorry, in addition to my above question:

I've started to set up my environment to build v8 (14.0.263.4).

When I run the following command:

local arch=$1
local output_dir=$2

local config=()

# building for Android on a specific arch
config+=('target_os="android"')
config+=("target_cpu=\"$arch\"")
config+=("v8_target_cpu=\"$arch\"")

# release configuration
config+=('is_debug=false')
config+=('symbol_level=0')
config+=('android_unstripped_runtime_outputs=false')

# static library
config+=('is_component_build=false')
config+=('v8_static_library=true')
config+=('v8_monolithic=true')

# use builtin snapshotting
config+=('v8_use_external_startup_data=false')

# disable i18n to reduce size
config+=('v8_enable_i18n_support=false')

# log everything to stdout on Android
config+=('v8_android_log_stdout=true')

# starting from v8 9.9 custom libc compiler causes overlaping issues with 
libstdc++.
# we should explicitly disable it
config+=('use_custom_libcxx=false')

tools/dev/v8gen.py -vv -b android.arm.release "$output_dir" -- "${config[@
]}"

It fails with the following message:

  /mnt/upstream/v8/buildtools/linux64/gn gen out.gn/arm64-v8a --check
    -> returned 1
  ERROR at //gni/snapshot_toolchain.gni:115:1: Assertion failed.
  assert(v8_snapshot_toolchain != "",
  ^-----
  Do not know how to build a snapshot for 
//build/toolchain/android:android_clang_arm on linux arm64
  See //BUILD.gn:17:1: whence it was imported.
  import("gni/snapshot_toolchain.gni")
  ^----------------------------------
  GN gen failed: 1

And I also get this (before):

  Writing """\
  android_unstripped_runtime_outputs = false
  dcheck_always_on = false
  default_min_sdk_version = 21
  is_debug = false
  target_cpu = "arm"
  target_os = "android"
  v8_android_log_stdout = true
  """ to /mnt/upstream/v8/out.gn/arm64-v8a/args.gn.

It looks like my arguments are being ignored. However, if I go to 
*v8/infra/mb/mb_config.pyl 
*and I hardcode my flags in the android mixin it works properly.
Is there a bug or am I running something wrong?

Thanks,
Mati.


On Tuesday, September 16, 2025 at 12:53:10 PM UTC-4 Mati Cohen wrote:

> I'm willing to recompile the latest stable version. I am looking at 
> build_config.h and for it's using the following implementation:
>
> #if (defined(V8_OS_MACOS) && defined(V8_HOST_ARCH_ARM64)) || \
> (defined(V8_OS_ANDROID) && \
> (defined(V8_HOST_ARCH_ARM64) || defined(V8_HOST_ARCH_X64))) || \
> defined(V8_HOST_ARCH_LOONG64) || defined(V8_HOST_ARCH_MIPS64) || \
> defined(V8_OS_IOS)
> // Android 64 bit has experimental support for 16kB pages.
> // MacOS & iOS on arm64 uses 16kB pages.
> // LOONG64 and MIPS64 also use 16kB pages.
> constexpr int kMinimumOSPageSize = 16 * 1024;
> #elif defined(V8_OS_LINUX) && !defined(V8_OS_ANDROID) && \
> (defined(V8_HOST_ARCH_ARM64) || defined(V8_HOST_ARCH_PPC64))
> // Linux on arm64 (excluding android) and PPC64 can be configured for up 
> to 64kB
> // pages.
> constexpr int kMinimumOSPageSize = 64 * 1024;
> #else
> // Everything else uses 4kB pages.
> constexpr int kMinimumOSPageSize = 4 * 1024;
> #endif
>
> Sorry for my ignorance, but does it mean that all Android devices with 
> *arm64-v8a* and *x86_64* architectures will use a size of 16KB. Is this 
> correct? I am trying to understand if there are devices with *arm64-v8a*
>  and *x86_64* architectures which still use 4KB for page sizes.
>
> Thanks,
> Matias.
>
> On Saturday, September 13, 2025 at 7:17:56 AM UTC-4 Ben Noordhuis wrote:
>
>> Assuming recompiling is not a problem for you: just edit 
>> build_config.h and change it to 16k. 
>>
>> IIRC, stdout and stderr are not normally hooked up to anything on 
>> Android but it should be possible to freopen them to a log file. 
>>
>> On Fri, Sep 12, 2025 at 4:15 PM 'Matias Cohen' via v8-users 
>> <v8-u...@googlegroups.com> wrote: 
>> > 
>> > Thanks Ben. 
>> > 
>> > Yeah, that’s strange. I also noticed that SetDataReadOnly didn’t exist 
>> in 10.4.132. Moreover, the V8_FATAL exception that is raised was added even 
>> later. Maybe my records about 10.4.132 are wrong, but I am sure that we 
>> built v8 last time in August 2022, so I can’t explain it. 
>> > 
>> > Android Studio don’t show any error message more than the stacktrace I 
>> already shared. 
>> > 
>> > My guess is that kMinimumOSPageSize was still 4KB for Android back then 
>> when I built v8 (yet I can’t explain why SetDataReadOnly is part of the 
>> stacktrace). 
>> > 
>> > Is there any way for me to overwrite kMinimumOSPageSize from “outside” 
>> v8, just to test if that makes a difference? 
>> > 
>> > Thanks! 
>> > 
>> > > On Sep 12, 2025, at 5:20 AM, Ben Noordhuis <in...@bnoordhuis.nl> 
>> wrote: 
>> > > 
>> > > On Fri, Sep 12, 2025 at 8:26 AM 'Mati Cohen' via v8-users 
>> > > <v8-u...@googlegroups.com> wrote: 
>> > >> 
>> > >> Hi, 
>> > >> 
>> > >> My app is using v8 to run a JS environment. Last time I built v8 was 
>> about 3 years ago by pointing to 10.4.132. 
>> > >> 
>> > >> As per Google policy, my app needs to support 16 KB page size and 
>> I've been checking all my dependencies to meet that criteria. 
>> > >> 
>> > >> Apparently, based on my checks, my v8 build does support it and I 
>> managed to run the app on my device. 
>> > >> However, v8 is crashing as soon as I call V8::Initialize(); with the 
>> following stack trace: 
>> > >> 
>> > >> /base.apk!liben8.so (offset 0x8ad8000) (v8::base::OS::Abort()+28) 
>> > >> /base.apk!liben8.so (offset 0x8ad8000) (V8_Fatal(char const*, 
>> ...)+376) 
>> > >> /base.apk!liben8.so (offset 0x8ad8000) 
>> (v8::base::OS::SetDataReadOnly(void*, unsigned long)+52) 
>> > >> /base.apk!liben8.so (offset 0x8ad8000) 
>> (v8::internal::V8::Initialize()+1552) 
>> > >> /base.apk!liben8.so (offset 0x8ad8000) (v8::V8::Initialize(int)+28) 
>> > >> /base.apk!liben8.so (offset 0x8ad8000) 
>> (Runtime::Runtime(_JNIEnv*)+172) 
>> > >> 
>> > >> As explained at 
>> https://www.google.com/url?q=https://developer.android.com/guide/practices/page-sizes%23check-code&source=gmail-imap&ust=1758273654000000&usg=AOvVaw2eBFhXRa0E0P-iWsikoJCW,
>>  
>> I was trying to look for references to PAGE_SIZE and 4096 to see if I was 
>> setting up something wrong, but I didn't find anything. 
>> > >> 
>> > >> Does anyone have any knowledge about this? 
>> > >> Thanks a lot, 
>> > >> Mati 
>> > > 
>> > > V8 doesn't use PAGE_SIZE, it uses sysconf(_SC_PAGESIZE). 
>> > > 
>> > > You mention 10.4.132 but that stack trace is from a different 
>> version, 
>> > > isn't it? Because SetDataReadOnly didn't exist back then. 
>> > > 
>> > > It crashes when trying to mprotect(PROT_READ) the command line flags, 
>> > > v8_flags. v8_flags is aligned to kMinimumOSPageSize and that _should_ 
>> > > be 16k on Android but you'll want to double-check that. It's defined 
>> > > in src/base/build_config.h. 
>> > > 
>> > > What error message did V8 print? 
>> > > 
>> > > -- 
>> > > -- 
>> > > v8-users mailing list 
>> > > v8-u...@googlegroups.com 
>> > > 
>> https://www.google.com/url?q=http://groups.google.com/group/v8-users&source=gmail-imap&ust=1758273654000000&usg=AOvVaw3Vi2w6FFQXBkM9c-JZXWPp
>>  
>> > > --- 
>> > > You received this message because you are subscribed to a topic in 
>> the Google Groups "v8-users" group. 
>> > > To unsubscribe from this topic, visit 
>> https://www.google.com/url?q=https://groups.google.com/d/topic/v8-users/7XDxoIaXdV4/unsubscribe&source=gmail-imap&ust=1758273654000000&usg=AOvVaw0flrzsS8NN-9t4czOPfrqp.
>>  
>>
>> > > To unsubscribe from this group and all its topics, send an email to 
>> v8-users+u...@googlegroups.com. 
>> > > To view this discussion visit 
>> https://www.google.com/url?q=https://groups.google.com/d/msgid/v8-users/CAHQurc-SN0whK9Y3U8%253DSEdMPOVJLfhQ7fVPcqUi_kAjDJywGeQ%2540mail.gmail.com&source=gmail-imap&ust=1758273654000000&usg=AOvVaw0W3G7qAhJMvkfEdoop6uqR.
>>  
>>
>> > 
>> > -- 
>> > -- 
>> > v8-users mailing list 
>> > v8-u...@googlegroups.com 
>> > http://groups.google.com/group/v8-users 
>> > --- 
>> > You received this message because you are subscribed to the Google 
>> Groups "v8-users" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an email to v8-users+u...@googlegroups.com. 
>> > To view this discussion visit 
>> https://groups.google.com/d/msgid/v8-users/D27EC591-82E7-43AB-B309-D7D01E9B3123%40encircleapp.com.
>>  
>>
>>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/v8-users/0e4b03d5-b0e4-44ff-a6db-7ecf3a8205c8n%40googlegroups.com.

Reply via email to