Skip to content

Commit

Permalink
Fix build errors for all CI builds
Browse files Browse the repository at this point in the history
  • Loading branch information
niranjanyardi committed Jan 11, 2025
1 parent 8fbe235 commit bf7c459
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 29 deletions.
23 changes: 9 additions & 14 deletions base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ if (is_apple) {
# ../../third_party/libevent/signal.c:43:10: fatal error: 'sys/queue.h' file not found
# #include <sys/queue.h>
# Determines whether libevent should be dep.
if (is_cobalt && is_starboard) {
if (is_cobalt && is_starboard && use_custom_libc) {
dep_libevent = false
} else {
dep_libevent = !is_fuchsia && !is_win && !is_mac && !is_nacl
Expand Down Expand Up @@ -207,7 +207,7 @@ buildflag_header("ios_cronet_buildflags") {
flags = [ "CRONET_BUILD=$is_cronet_build" ]
}

if (is_cobalt && is_starboard) {
if (is_cobalt && is_starboard && use_custom_libc) {
enable_message_pump_epoll = false
} else {
enable_message_pump_epoll = is_linux || is_chromeos || is_android
Expand Down Expand Up @@ -1028,7 +1028,7 @@ component("base") {
]
}

if (is_cobalt && is_starboard) {
if (is_cobalt && is_starboard && use_custom_libc) {
sources -= [
"debug/proc_maps_linux.cc",
"debug/proc_maps_linux.h",
Expand Down Expand Up @@ -1121,12 +1121,9 @@ component("base") {
"//third_party/abseil-cpp:absl",
]

if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
# if (use_custom_libc) {
if (is_cobalt && is_starboard && use_custom_libc && current_toolchain == cobalt_toolchain) {
deps -= [ "//base/allocator/partition_allocator:raw_ptr" ]
deps += [ "//starboard:starboard_group" ]

# }
}

if (build_rust_base_conversions) {
Expand Down Expand Up @@ -1162,7 +1159,7 @@ component("base") {
"allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.h",
]
}
if (is_cobalt && is_starboard) {
if (is_cobalt && is_starboard && use_custom_libc) {
sources -= [
"allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc",
"allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.h",
Expand Down Expand Up @@ -1197,7 +1194,7 @@ component("base") {
# ^
# ../../third_party/musl/include/malloc.h:19:8: note: previous declaration is here
# size_t malloc_usable_size(void *);
if (is_cobalt && is_starboard) {
if (is_cobalt && is_starboard && use_custom_libc) {
sources -= [
"allocator/partition_allocator/shim/allocator_shim_override_cpp_symbols.h",
"allocator/partition_allocator/shim/allocator_shim_override_glibc_weak_symbols.h",
Expand Down Expand Up @@ -1708,8 +1705,7 @@ component("base") {
}

# TODO: b/384652502 - Cobalt: Fix compiler errors building hermetically.
if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
# if (use_custom_libc) {
if (is_cobalt && is_starboard && use_custom_libc && current_toolchain == cobalt_toolchain) {
sources -= [
"base_paths_posix.h",
"memory/madv_free_discardable_memory_allocator_posix.cc",
Expand All @@ -1721,7 +1717,6 @@ component("base") {
"rand_util_posix.cc",
"system/sys_info_posix.cc",
]
# }
}

if (is_posix || is_fuchsia) {
Expand All @@ -1741,7 +1736,7 @@ component("base") {
]
}

if (is_cobalt && is_starboard) {
if (is_cobalt && is_starboard && use_custom_libc) {
sources -= [
"process/process_metrics_posix.cc",
"sync_socket_posix.cc",
Expand All @@ -1767,7 +1762,7 @@ component("base") {
]
}

if (is_cobalt && is_starboard) {
if (is_cobalt && is_starboard && use_custom_libc) {
sources -= [
"native_library_posix.cc",
"posix/can_lower_nice_to.cc",
Expand Down
6 changes: 2 additions & 4 deletions base/allocator/partition_allocator/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ component("partition_alloc") {
]

# TODO: b/384652502 - Cobalt: Fix compiler errors building hermetically.
if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
if (is_cobalt && is_starboard && use_custom_libc && current_toolchain == cobalt_toolchain) {
sources -= [ "partition_alloc_base/rand_util_posix.cc" ]
}

Expand Down Expand Up @@ -330,10 +330,8 @@ component("partition_alloc") {
deps += [ "//third_party/android_ndk:cpu_features" ]
}

if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
if (use_custom_libc) {
if (is_cobalt && is_starboard && use_custom_libc && current_toolchain == cobalt_toolchain) {
deps += [ "//starboard:starboard_group" ]
}
}
if (is_fuchsia) {
public_deps += [
Expand Down
3 changes: 1 addition & 2 deletions buildtools/third_party/libc++abi/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ source_set("libc++abi") {
deps = [ "//buildtools/third_party/libunwind" ]
}

if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain &&
use_custom_libc) {
if (is_cobalt && is_starboard && use_custom_libc && current_toolchain == cobalt_toolchain) {
deps = [ "//third_party/musl:c" ]
}

Expand Down
4 changes: 3 additions & 1 deletion starboard/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
#ifndef STARBOARD_CONFIGURATION_H_
#define STARBOARD_CONFIGURATION_H_

#if !defined(STARBOARD)
#include "build/build_config.h"

#if !BUILDFLAG(IS_STARBOARD)
#error "You must define STARBOARD in Starboard builds."
#endif

Expand Down
5 changes: 4 additions & 1 deletion third_party/abseil-cpp/absl/base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# found in the LICENSE file.

import("//third_party/abseil-cpp/absl.gni")
if (is_cobalt) {
import("//cobalt/build/configs/modular_variables.gni")
}

absl_source_set("atomic_hook") {
public = [ "internal/atomic_hook.h" ]
Expand Down Expand Up @@ -39,7 +42,7 @@ absl_source_set("raw_logging_internal") {
":log_severity",
]
visibility = [ "//third_party/abseil-cpp/absl/*" ]
if (is_cobalt && is_starboard) {
if (is_cobalt && is_starboard && use_custom_libc) {
public_deps += [ "//starboard:starboard_headers_only" ]
}
}
Expand Down
6 changes: 4 additions & 2 deletions third_party/abseil-cpp/absl/base/internal/raw_logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
#include "absl/base/internal/errno_saver.h"
#include "absl/base/log_severity.h"

#if defined(STARBOARD)
#include "starboard/log.h"
#include "build/build_config.h"

#if BUILDFLAG(IS_STARBOARD) && defined(_LIBCPP_HAS_MUSL_LIBC)
#include "starboard/log.h" // nogncheck
#else
// We know how to perform low-level writes to stderr in POSIX and Windows. For
// these platforms, we define the token ABSL_LOW_LEVEL_WRITE_SUPPORTED.
Expand Down
6 changes: 5 additions & 1 deletion third_party/boringssl/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import("//testing/libfuzzer/fuzzer_test.gni")
import("BUILD.generated.gni")
import("BUILD.generated_tests.gni")

if (is_cobalt) {
import("//cobalt/build/configs/modular_variables.gni")
}

if (enable_rust) {
import("//build/rust/cargo_crate.gni")
import("//build/rust/rust_bindgen.gni")
Expand Down Expand Up @@ -164,7 +168,7 @@ component("boringssl") {
# config is forwarded to callers. In particular, boringssl_crypto_tests
# requires it.
public_deps = [ ":boringssl_asm" ]
if (is_cobalt && is_starboard) {
if (is_cobalt && is_starboard && use_custom_libc) {
public_deps += [ "//starboard/common", "//starboard:starboard_headers_only" ]
}

Expand Down
11 changes: 7 additions & 4 deletions third_party/boringssl/src/include/openssl/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@

#include <openssl/base.h>

#ifdef STARBOARD
#include "starboard/common/condition_variable.h"
#include "starboard/common/mutex.h"
#endif
#include "build/build_config.h"

#if BUILDFLAG(STARBOARD) && defined(_LIBCPP_HAS_MUSL_LIBC)
#include "starboard/common/condition_variable.h" // nogncheck
#include "starboard/common/mutex.h" // nogncheck
#endif // defined(STARBOARD) && defined(_LIBCPP_HAS_MUSL_LIBC)


#if defined(__cplusplus)
extern "C" {
Expand Down

0 comments on commit bf7c459

Please sign in to comment.