-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build nplb hermetically #4587
base: main
Are you sure you want to change the base?
Build nplb hermetically #4587
Conversation
0e0c67d
to
a61fe7b
Compare
a61fe7b
to
abaf11c
Compare
abaf11c
to
efba4d2
Compare
@@ -68,6 +72,18 @@ config("runtime_library") { | |||
"-isystem" + rebase_path("$libcxx_prefix/include", root_build_dir), | |||
"-isystem" + rebase_path("$libcxxabi_prefix/include", root_build_dir), | |||
] | |||
if (is_cobalt && is_cobalt_hermetic_build) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get this error:
In file included from ../../buildtools/third_party/libc++/trunk/include/__type_traits/is_trivially_copyable.h:14:
../../buildtools/third_party/libc++/trunk/include/cstdint:149:5: error: tried including <stdint.h> but didn't find libc++'s <stdint.h> header. This usually means that your header search paths are not configured properly. The header search paths should contain the C++ Standard Library headers before any C Standard Library, and you are probably using compiler flags that make that not be the case.
when i just use cflags instead of (cflags_cc and cflags_c)
#error "You must define STARBOARD in Starboard builds." | ||
#include "build/build_config.h" | ||
|
||
#if !BUILDFLAG(IS_COBALT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this whole check needs to be removed ?
had to put IS_COBALT as we need some flag which is on for android and linux and we want to remove STARBOARD, OS_STARBOARD instances and replace them with other flags we ahve defined like IS_COBALT, IS_STARBOARD
4e14f7c
to
d8354f7
Compare
# Determines whether libevent should be dep. | ||
dep_libevent = !is_fuchsia && !is_win && !is_mac && !is_nacl | ||
if (is_cobalt && is_cobalt_hermetic_build) { | ||
dep_libevent = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this won't be fixed in the scope of this PR, this variable should ideally be set by linux-evergreen's args.gn file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to add it to the args.gn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this isn't changing any DEPS repos to subtrees—is it no longer needed?
# TODO: b/384652502 - Cobalt: Fix compiler errors building hermetically. | ||
# ../../base/process/launch_posix.cc:145:18: error: use of undeclared identifier 'SYS_rt_sigaction' | ||
# return syscall(SYS_rt_sigaction, sig, act, oact, sizeof(kernel_sigset_t)); | ||
if (is_cobalt && is_cobalt_hermetic_build) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conditions should be written to minimize the number of conditional blocks.
ref: https://gn.googlesource.com/gn/+/main/docs/style_guide.md#conditions
@@ -1013,6 +1024,26 @@ component("base") { | |||
] | |||
} | |||
|
|||
# TODO: b/384652502 - Cobalt: Add source files after fixing compiler errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we add linux-specific files to our evergreen build? At some point in the evergreen build, we may want to make is_linux=false
@@ -320,6 +329,7 @@ component("partition_alloc") { | |||
# tagging.cc requires __arm_mte_set_* functions. | |||
deps += [ "//third_party/android_ndk:cpu_features" ] | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove
// /arch/generic --sysroot=../../build/linux/debian_bullseye_amd64-sysroot -fvisibility-inlines-hidden -c ../../base/allocator/partition_allocator/shim/allocator_shim.cc -o obj/base/base/allocator_shim.o | ||
// In file included from ../../base/allocator/partition_allocator/shim/allocator_shim.cc:409: | ||
// ../../base/allocator/partition_allocator/shim/allocator_shim_override_libc_symbols.h:36:26: error: exception specification in declaration does not match previous declaration | ||
#if BUILDFLAG(IS_STARBOARD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like an incorrect macro check, and I assume it's cruft as you've changed where it's included in base/allocator/partition_allocator/shim/allocator_shim.cc
// See: https://man7.org/linux/man-pages/man2/exit_group.2.html | ||
syscall(SYS_exit_group, EXIT_FAILURE); | ||
#else | ||
// No clue how to substitue , ask yavor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like something to figure out in the scope of this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sections shouldn't be run at all, you should change the conditional above to not define AlarmSignalHandler (and not have references to it in other places). Where we call _exit we may want to call SbSystemBreakIntoDebugger instead, though seems to me like we should be supporting _exit in Starboard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The call seem to be needed only as a workaround for AMD Linux shutdowns of the GPU process. We can probably just call SbSystemBreakIntoDebugger
or abort
.
@@ -135,7 +132,8 @@ if (!is_cobalt) { | |||
if (sb_is_evergreen) { | |||
public_deps += [ "//starboard/elf_loader:sabi_string" ] | |||
} else { | |||
data_deps = [ ":starboard($starboard_toolchain)" ] | |||
# Symbols resolved at buildtime, talk to yavor, andrew | |||
deps += [ ":starboard($starboard_toolchain)" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is okay
@@ -26,6 +26,10 @@ | |||
#include "starboard/configuration.h" | |||
#include "starboard/types.h" | |||
|
|||
#ifdef __cplusplus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this being added?
@@ -27,6 +27,11 @@ | |||
#include "absl/base/internal/errno_saver.h" | |||
#include "absl/base/log_severity.h" | |||
|
|||
#include "build/build_config.h" | |||
|
|||
#if BUILDFLAG(IS_STARBOARD) && defined(_LIBCPP_HAS_MUSL_LIBC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would IS_STARBOARD
be true and _LIBCPP_HAS_MUSL_LIBC
be false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should add a TODO above this . Currently _LIBCPP_HAS_MUSL_LIBC is only for the linux hermetic build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We wouldn't have non-hermetic IS_STARBOARD
. Is this a transitional step? Also _LIBCPP_HAS_MUSL_LIBC
is a variable only for libcxx
. It doesn't make sense to use it in any other modules.
@@ -211,6 +217,8 @@ void AsyncSignalSafeWriteToStderr(const char* s, size_t len) { | |||
write(STDERR_FILENO, s, len); | |||
#elif defined(ABSL_HAVE_RAW_IO) | |||
_write(/* stderr */ 2, s, static_cast<unsigned>(len)); | |||
#elif BUILDFLAG(IS_STARBOARD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
write
is supported in Starboard, why is this needed?
third_party/musl/include/pthread.h
Outdated
@@ -1,11 +1,11 @@ | |||
#ifndef _PTHREAD_H | |||
#define _PTHREAD_H | |||
|
|||
#if defined(STARBOARD) | |||
// #if defined(STARBOARD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be changed before submission?
be31396
to
8c9999a
Compare
# Determines whether libevent should be dep. | ||
dep_libevent = !is_fuchsia && !is_win && !is_mac && !is_nacl | ||
if (is_cobalt && is_cobalt_hermetic_build) { | ||
dep_libevent = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to add it to the args.gn
|
||
#include "third_party/musl/src/starboard/pthread/pthread.h" | ||
#if (BUILDFLAG(IS_STARBOARD) && !defined(_LIBCPP_HAS_MUSL_LIBC)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the _LIBCPP_HAS_MUSL_LIBC condition. It is a libcxx to flag. This header file is inside musl
.
@@ -3,6 +3,9 @@ | |||
# found in the LICENSE file. | |||
|
|||
import("//third_party/abseil-cpp/absl.gni") | |||
if (is_cobalt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why some targets need to import the modular_variables.gni and other don't?
Ideally some script early on import this file for all targets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's for the is_hermetic_build variable which is temporary—Niranjan and I talked about using is_starboard in the long term
But generally we don't want variables to be global, it's essentially the same as the c++ iwyu concept
@@ -27,6 +27,11 @@ | |||
#include "absl/base/internal/errno_saver.h" | |||
#include "absl/base/log_severity.h" | |||
|
|||
#include "build/build_config.h" | |||
|
|||
#if BUILDFLAG(IS_STARBOARD) && defined(_LIBCPP_HAS_MUSL_LIBC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We wouldn't have non-hermetic IS_STARBOARD
. Is this a transitional step? Also _LIBCPP_HAS_MUSL_LIBC
is a variable only for libcxx
. It doesn't make sense to use it in any other modules.
defines = [ | ||
# Ensure that the Starboardized __external_threading file is included. | ||
"_LIBCPP_HAS_THREAD_API_EXTERNAL", | ||
# # Ensure that the Starboardized __external_threading file is included. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cleanup those?
@@ -21,6 +24,10 @@ source_set("libc++abi") { | |||
deps = [ "//buildtools/third_party/libunwind" ] | |||
} | |||
|
|||
if (is_cobalt && is_cobalt_hermetic_build) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this dependency here? All targets would be using musl.
@@ -115,6 +120,11 @@ target(_libcxx_target_type, "libc++") { | |||
"trunk/src/verbose_abort.cpp", | |||
] | |||
|
|||
if (is_cobalt && is_cobalt_hermetic_build) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need atomics, what is he build error?
@@ -35,7 +35,7 @@ | |||
#include <sys/statvfs.h> | |||
#endif | |||
|
|||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) | |||
#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !(BUILDFLAG(IS_STARBOARD) && defined(_LIBCPP_HAS_MUSL_LIBC)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use _LIBCPP_HAS_MUSL_LIBC as this is a libcxx flag only.
// See: https://man7.org/linux/man-pages/man2/exit_group.2.html | ||
syscall(SYS_exit_group, EXIT_FAILURE); | ||
#else | ||
// No clue how to substitue , ask yavor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The call seem to be needed only as a workaround for AMD Linux shutdowns of the GPU process. We can probably just call SbSystemBreakIntoDebugger
or abort
.
currently, im modifying a file in boringssl - so my understanding is that repo needs to be added |
b/371241293