Skip to content

Commit

Permalink
[cr133][iOS][WIP] Enable use_partition_alloc.
Browse files Browse the repository at this point in the history
The build fails with

 ERROR Unresolved dependencies.
 //third_party/dawn/src/dawn/partition_alloc:partition_alloc(//build/toolchain/ios:ios_clang_x64)
   needs //base/allocator/partition_allocator:partition_alloc(//build/toolchain/ios:ios_clang_x64)

This is due to the upstream change below which doesn't expose //base/allocator/partition_allocator
target when use_partition_alloc flag is false. However, //third_party/dawn/src/dawn/partition_alloc
is only predicated on defined(dawn_partition_alloc_dir) - which is defined - and not on
use_partition_alloc. I am not sure what's causing //third_party/dawn/src/dawn/partition_alloc to
be referenced in the build in the first place.

Enabling the var for now. If it causes crashes like it used, then we'll need to track down what's
depending on dawn.

https://source.chromium.org/chromium/chromium/src/+/4dacf2b61c359950d2c2f1b5f9b9d079a01290a4

commit 4dacf2b61c359950d2c2f1b5f9b9d079a01290a4
Author: Etienne Dechamps <[email protected]>
Date:   Thu Dec 19 08:31:05 2024 -0800

    Don't build partition_alloc if it is not needed

    Currently //base has a dependency on partition_alloc code even if
    `use_partition_alloc` is false, with the rationale that this avoids
    `gn check` errors, relying on the linker to remove the dead code.

    The main problem with this approach is that even though the code does
    not make it into the final binary (hopefully... assuming no accidental
    code dependencies), we still attempt to build it. This is wasted work,
    but more importantly it can cause build failures because partition_alloc
    may contain code that does not build on all platforms where
    use_partition_alloc is false. One example is when building Cronet in
    AOSP - in this case this code is built against an older version of
    glibc that does not support memfd_create(), leading to a compilation
    error.

    We could attempt to work around such problems by making partition_alloc
    build on such platforms, but it seems silly to spend time implementing
    workarounds in what is literally dead code. Instead, it makes more sense
    to just not build partition_alloc when `use_partition_alloc` is false.
    This is what this commit does.

    Bug: b:381421702
  • Loading branch information
mkarolin committed Jan 11, 2025
1 parent 2eb63da commit e5c6248
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build/commands/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,8 @@ Config.prototype.buildArgs = function () {
// in the future to see if this is no longer needed
// https://github.com/brave/brave-browser/issues/29934
args.ios_partition_alloc_enabled = false
args.use_partition_alloc = false

args.use_partition_alloc = true
args.ios_provider_target = "//brave/ios/browser/providers:brave_providers"

args.ios_locales_pack_extra_source_patterns = [
Expand Down

0 comments on commit e5c6248

Please sign in to comment.