Skip to content
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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

niranjanyardi
Copy link
Contributor

@niranjanyardi niranjanyardi commented Dec 14, 2024

b/371241293

@niranjanyardi niranjanyardi requested review from a team as code owners December 14, 2024 04:17
@niranjanyardi niranjanyardi marked this pull request as draft December 14, 2024 04:17
@niranjanyardi niranjanyardi changed the title Add buildtools/third_party/libc++/trunk Build base/allocator/partition_allocator:partition_alloc hermetically Dec 14, 2024
@niranjanyardi niranjanyardi removed the request for review from johnxwork December 14, 2024 04:24
@niranjanyardi niranjanyardi changed the title Build base/allocator/partition_allocator:partition_alloc hermetically Build nplb hermetically Dec 17, 2024
@niranjanyardi
Copy link
Contributor Author

Would like some initial feedback on the PR.

Please ignore starboard/BUILD.gn - that still needs to be refactored

base/BUILD.gn Show resolved Hide resolved
@@ -1641,6 +1649,24 @@ component("base") {
]
}

# TODO: b/384652502 - Cobalt: Fix compiler errors building hermetically.
if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
import("//cobalt/build/configs/modular_variables.gni")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the import be in the if statement below?

Copy link
Contributor Author

@niranjanyardi niranjanyardi Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the variable needs to be imported before it can be used. My plan is to remove

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

when the hermetic build is complete.

if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
import("//cobalt/build/configs/modular_variables.gni")
if (use_custom_libc) {
deps += [ "//starboard:starboard_group" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the partition_allocator actually use from //starboard_group?

Copy link
Contributor Author

@niranjanyardi niranjanyardi Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got a compiler error, lemme dig that up or amybe this is not needed. I'll double check

@@ -320,6 +330,13 @@ component("partition_alloc") {
# tagging.cc requires __arm_mte_set_* functions.
deps += [ "//third_party/android_ndk:cpu_features" ]
}

if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
import("//cobalt/build/configs/modular_variables.gni")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the modular_variables.gni be included somewhere early on instead of adding it to every target?

Copy link
Contributor Author

@niranjanyardi niranjanyardi Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think andrew was saying we should imported it only where needed. Also, many of these instances will be deleted when hermetically building is complete for all targets

@@ -54,6 +54,13 @@ target(_libcxx_target_type, "libc++") {
"//build/config:common_deps",
"//third_party/catapult/devil:devil",
]
if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What starboard APIs does libc++ use? Maybe we don't need this dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will revisit

if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
import("//cobalt/build/configs/modular_variables.gni")
if (use_custom_libc) {
cflags_cc += [
Copy link
Contributor Author

@niranjanyardi niranjanyardi Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is funky, i tried cflags and that didnt work, i had to split it out . If needed can dig up the error

if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
import("//cobalt/build/configs/modular_variables.gni")
if (use_custom_libc) {
visibility += [ "//starboard:starboard_group" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does starboard need to depend on this if it's already a dependency of every executable/shlib when use_custom_libcxx is true?

@@ -1087,6 +1087,14 @@ component("base") {
"//third_party/abseil-cpp:absl",
]

if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
import("//cobalt/build/configs/modular_variables.gni")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throughout this PR, imports should be done at the top of the file

if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
import("//cobalt/build/configs/modular_variables.gni")
if (use_custom_libc) {
deps -= [ "//base/allocator/partition_allocator:raw_ptr" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a TODO to get this to work?

@@ -1087,6 +1087,14 @@ component("base") {
"//third_party/abseil-cpp:absl",
]

if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minimize conditional statements by i.e. combining this with the one below (do this in general)

@@ -92,6 +109,15 @@ config("runtime_library") {
"m",
"rt",
]
if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this only be necessary if is_clang is false (which I wouldn't expect)?

if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
import("//cobalt/build/configs/modular_variables.gni")
if (use_custom_libc) {
visibility += [ "//starboard:starboard_group" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also seems strange, let's talk offline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants