[build] Make the build more reproducible.
On Mac and Linux, the makes the output of non-RBE, RBE local and RBE remote builds identical, and also independent of the build directories path. On Windows, non-RBE and RBE builds still disagree because paths are rewritten from \ to / to run on the Linux workers. Bug: b/316893839 Change-Id: I5935785489c73445e4c6ca275020e6cf7464433d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506281 Reviewed-by: Alexander Aprelev <aam@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
committed by
dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
84bd4ea759
commit
feab749acb
@@ -231,26 +231,18 @@ config("compiler") {
|
||||
common_mac_flags = []
|
||||
|
||||
# CPU architecture.
|
||||
if (current_cpu == "x64") {
|
||||
common_mac_flags += [
|
||||
"-arch",
|
||||
"x86_64",
|
||||
]
|
||||
} else if (current_cpu == "x86") {
|
||||
common_mac_flags += [
|
||||
"-arch",
|
||||
"i386",
|
||||
]
|
||||
} else if (current_cpu == "arm") {
|
||||
common_mac_flags += [
|
||||
"-arch",
|
||||
"armv7",
|
||||
]
|
||||
} else if (current_cpu == "arm64") {
|
||||
common_mac_flags += [
|
||||
"-arch",
|
||||
"arm64",
|
||||
]
|
||||
if (is_mac) {
|
||||
if (current_cpu == "x64") {
|
||||
common_mac_flags += [ "--target=x86_64-apple-macos" ]
|
||||
} else if (current_cpu == "arm64") {
|
||||
common_mac_flags += [ "--target=arm64-apple-macos" ]
|
||||
}
|
||||
} else if (is_ios) {
|
||||
if (current_cpu == "x64") {
|
||||
common_mac_flags += [ "--target=x86_64-apple-darwin" ]
|
||||
} else if (current_cpu == "arm64") {
|
||||
common_mac_flags += [ "--target=arm64-apple-darwin" ]
|
||||
}
|
||||
}
|
||||
|
||||
cflags += common_mac_flags
|
||||
|
||||
+14
-22
@@ -49,29 +49,7 @@ config("no_exceptions") {
|
||||
}
|
||||
|
||||
config("relative_paths") {
|
||||
# Make builds independent of absolute file path. The file names
|
||||
# embedded in debugging information will be expressed as relative to
|
||||
# the build directory, e.g. "../.." for an "out/subdir" under //.
|
||||
# This is consistent with the file names in __FILE__ expansions
|
||||
# (e.g. in assertion messages), which the compiler doesn't provide a
|
||||
# way to remap. That way source file names in logging and
|
||||
# symbolization can all be treated the same way. This won't go well
|
||||
# if root_build_dir is not a subdirectory //, but there isn't a better
|
||||
# option to keep all source file name references uniformly relative to
|
||||
# a single root.
|
||||
if (use_rbe) {
|
||||
absolute_path = "/b/f/w/"
|
||||
} else {
|
||||
absolute_path = rebase_path("//")
|
||||
}
|
||||
relative_path = ""
|
||||
cflags = [
|
||||
# This makes sure that the DW_AT_comp_dir string (the current
|
||||
# directory while running the compiler, which is the basis for all
|
||||
# relative source file names in the DWARF info) is represented as
|
||||
# relative to //.
|
||||
"-fdebug-prefix-map=$absolute_path=$relative_path",
|
||||
|
||||
# This makes sure that include directories in the toolchain are
|
||||
# represented as relative to the build directory (because that's how
|
||||
# we invoke the compiler), rather than absolute. This can affect
|
||||
@@ -83,4 +61,18 @@ config("relative_paths") {
|
||||
# superfluous for purposes of the debugging information.
|
||||
"-no-canonical-prefixes",
|
||||
]
|
||||
ldflags = [ "-no-canonical-prefixes" ]
|
||||
|
||||
# Remove absolute paths from the debug information.
|
||||
if (is_clang) {
|
||||
cflags += [ "-ffile-compilation-dir=." ]
|
||||
asmflags = [ "-Wa,-fdebug-compilation-dir,." ]
|
||||
} else {
|
||||
absolute_path = rebase_path("//")
|
||||
relative_path = rebase_path("//", root_build_dir)
|
||||
cflags += [ "-fdebug-prefix-map=$absolute_path=$relative_path" ]
|
||||
}
|
||||
if (is_mac) {
|
||||
ldflags += [ "-Wl,-oso_prefix,." ]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ declare_args() {
|
||||
# The path to the watchOS simulator SDK.
|
||||
watchos_simulator_sdk_path = ""
|
||||
|
||||
ios_enable_relative_sdk_path = use_rbe
|
||||
ios_enable_relative_sdk_path = true
|
||||
}
|
||||
|
||||
if (ios_sdk_path == "") {
|
||||
@@ -46,7 +46,7 @@ if (ios_sdk_path == "") {
|
||||
ios_sdk_min,
|
||||
]
|
||||
|
||||
if (use_rbe) {
|
||||
if (ios_enable_relative_sdk_path) {
|
||||
_find_sdk_args += [
|
||||
"--create_symlink_at",
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ declare_args() {
|
||||
# mac_sdk_min is used.
|
||||
mac_sdk_path = ""
|
||||
|
||||
mac_enable_relative_sdk_path = use_rbe
|
||||
mac_enable_relative_sdk_path = true
|
||||
}
|
||||
|
||||
find_sdk_args = [
|
||||
@@ -21,7 +21,7 @@ find_sdk_args = [
|
||||
mac_sdk_min,
|
||||
]
|
||||
|
||||
if (use_rbe) {
|
||||
if (mac_enable_relative_sdk_path) {
|
||||
find_sdk_args += [
|
||||
"--create_symlink_at",
|
||||
|
||||
@@ -36,11 +36,5 @@ find_sdk_lines =
|
||||
exec_script("//build/mac/find_sdk.py", find_sdk_args, "list lines")
|
||||
mac_sdk_version = find_sdk_lines[1]
|
||||
if (mac_sdk_path == "") {
|
||||
# TODO(brettw) http://crbug.com/335325 when everybody moves to XCode 5 we
|
||||
# can remove the --print_sdk_path argument to find_sdk and instead just use
|
||||
# the following two lines to get the path. Although it looks longer here, it
|
||||
# saves forking a process in find_sdk.py so will be faster.
|
||||
#mac_sdk_root = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX"
|
||||
#mac_sdk_path = mac_sdk_root + mac_sdk_version + ".sdk"
|
||||
mac_sdk_path = find_sdk_lines[0]
|
||||
}
|
||||
|
||||
@@ -185,30 +185,7 @@ config("nominmax") {
|
||||
# Relative paths --------------------------------------------------------------
|
||||
|
||||
config("relative_paths") {
|
||||
# Make builds independent of absolute file path. The file names
|
||||
# embedded in debugging information will be expressed as relative to
|
||||
# the build directory, e.g. "../.." for an "out/subdir" under //.
|
||||
# This is consistent with the file names in __FILE__ expansions
|
||||
# (e.g. in assertion messages), which the compiler doesn't provide a
|
||||
# way to remap. That way source file names in logging and
|
||||
# symbolization can all be treated the same way. This won't go well
|
||||
# if root_build_dir is not a subdirectory //, but there isn't a better
|
||||
# option to keep all source file name references uniformly relative to
|
||||
# a single root.
|
||||
if (use_rbe) {
|
||||
absolute_path = "/b/f/w/"
|
||||
} else {
|
||||
absolute_path = rebase_path("//")
|
||||
}
|
||||
relative_path = ""
|
||||
cflags = [
|
||||
# This makes sure that debug information uses relative paths.
|
||||
"-fdebug-prefix-map=$absolute_path=$relative_path",
|
||||
|
||||
# Remove absolute paths from the debug information.
|
||||
"-fdebug-compilation-dir=",
|
||||
"-fcoverage-compilation-dir=",
|
||||
|
||||
# This makes sure that include directories in the toolchain are
|
||||
# represented as relative to the build directory (because that's how
|
||||
# we invoke the compiler), rather than absolute. This can affect
|
||||
@@ -219,6 +196,9 @@ config("relative_paths") {
|
||||
# in the debugging information, so this should actually be
|
||||
# superfluous for purposes of the debugging information.
|
||||
"-no-canonical-prefixes",
|
||||
|
||||
# Remove absolute paths from the debug information.
|
||||
"-ffile-compilation-dir=.",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -247,5 +227,8 @@ config("deterministic_builds") {
|
||||
# Use a fake fixed base directory for paths in the pdb to make the pdb
|
||||
# output fully deterministic and independent of the build directory.
|
||||
ldflags += [ "/PDBSourcePath:o:\fake\prefix" ]
|
||||
|
||||
# Don't include absolute path to PDB file.
|
||||
ldflags += [ "/pdbaltpath:%_PDB%" ]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,12 +88,6 @@ gcc_toolchain_suite("clang_arm") {
|
||||
cc = "${compiler_prefix}${prefix}/clang"
|
||||
cxx = "${compiler_prefix}${prefix}/clang++"
|
||||
asm = "${assembler_prefix}${prefix}/clang"
|
||||
|
||||
if (use_rbe) {
|
||||
cc = "${cc} --target=arm-linux-gnueabihf"
|
||||
cxx = "${cxx} --target=arm-linux-gnueabihf"
|
||||
}
|
||||
|
||||
readelf = "${prefix}/llvm-readelf"
|
||||
nm = "${prefix}/llvm-nm"
|
||||
ar = "${prefix}/llvm-ar"
|
||||
@@ -131,12 +125,6 @@ gcc_toolchain_suite("clang_arm64") {
|
||||
cc = "${compiler_prefix}${prefix}/clang"
|
||||
cxx = "${compiler_prefix}${prefix}/clang++"
|
||||
asm = "${assembler_prefix}${prefix}/clang"
|
||||
|
||||
if (use_rbe) {
|
||||
cc = "${cc} --target=aarch64-linux-gnu"
|
||||
cxx = "${cxx} --target=aarch64-linux-gnu"
|
||||
}
|
||||
|
||||
readelf = "${prefix}/llvm-readelf"
|
||||
nm = "${prefix}/llvm-nm"
|
||||
ar = "${prefix}/llvm-ar"
|
||||
@@ -153,12 +141,6 @@ gcc_toolchain_suite("clang_x86") {
|
||||
cc = "${compiler_prefix}${prefix}/clang"
|
||||
cxx = "${compiler_prefix}${prefix}/clang++"
|
||||
asm = "${assembler_prefix}${prefix}/clang"
|
||||
|
||||
if (use_rbe) {
|
||||
cc = "${cc} --target=i386-linux-gnu"
|
||||
cxx = "${cxx} --target=i386-linux-gnu"
|
||||
}
|
||||
|
||||
readelf = "${prefix}/llvm-readelf"
|
||||
nm = "${prefix}/llvm-nm"
|
||||
ar = "${prefix}/llvm-ar"
|
||||
@@ -195,12 +177,6 @@ gcc_toolchain_suite("clang_x64") {
|
||||
cc = "${compiler_prefix}${prefix}/clang"
|
||||
cxx = "${compiler_prefix}${prefix}/clang++"
|
||||
asm = "${assembler_prefix}${prefix}/clang"
|
||||
|
||||
if (use_rbe) {
|
||||
cc = "${cc} --target=x86_64-linux-gnu"
|
||||
cxx = "${cxx} --target=x86_64-linux-gnu"
|
||||
}
|
||||
|
||||
readelf = "${prefix}/llvm-readelf"
|
||||
nm = "${prefix}/llvm-nm"
|
||||
ar = "${prefix}/llvm-ar"
|
||||
@@ -258,12 +234,6 @@ gcc_toolchain_suite("clang_riscv32") {
|
||||
cc = "${compiler_prefix}${prefix}/clang"
|
||||
cxx = "${compiler_prefix}${prefix}/clang++"
|
||||
asm = "${assembler_prefix}${prefix}/clang"
|
||||
|
||||
if (use_rbe) {
|
||||
cc = "${cc} --target=x86_64-linux-gnu"
|
||||
cxx = "${cxx} --target=x86_64-linux-gnu"
|
||||
}
|
||||
|
||||
readelf = "${prefix}/llvm-readelf"
|
||||
nm = "${prefix}/llvm-nm"
|
||||
ar = "${prefix}/llvm-ar"
|
||||
@@ -301,12 +271,6 @@ gcc_toolchain_suite("clang_riscv64") {
|
||||
cc = "${compiler_prefix}${prefix}/clang"
|
||||
cxx = "${compiler_prefix}${prefix}/clang++"
|
||||
asm = "${assembler_prefix}${prefix}/clang"
|
||||
|
||||
if (use_rbe) {
|
||||
cc = "${cc} --target=riscv64-linux-gnu"
|
||||
cxx = "${cxx} --target=riscv64-linux-gnu"
|
||||
}
|
||||
|
||||
readelf = "${prefix}/llvm-readelf"
|
||||
nm = "${prefix}/llvm-nm"
|
||||
ar = "${prefix}/llvm-ar"
|
||||
|
||||
@@ -14,10 +14,6 @@ mac_toolchain_suite("ios_clang_arm64") {
|
||||
prefix = rebased_clang_dir
|
||||
cc = "${compiler_prefix}${prefix}/clang"
|
||||
cxx = "${compiler_prefix}${prefix}/clang++"
|
||||
if (use_rbe) {
|
||||
cc = "${cc} --target=arm64-apple-darwin"
|
||||
cxx = "${cxx} --target=arm64-apple-darwin"
|
||||
}
|
||||
asm = "${assembler_prefix}${prefix}/clang"
|
||||
ar = "${prefix}/llvm-ar"
|
||||
ld = "${link_prefix}${prefix}/clang++"
|
||||
@@ -38,10 +34,6 @@ mac_toolchain_suite("ios_clang_arm64_sim") {
|
||||
prefix = rebased_clang_dir
|
||||
cc = "${compiler_prefix}${prefix}/clang"
|
||||
cxx = "${compiler_prefix}${prefix}/clang++"
|
||||
if (use_rbe) {
|
||||
cc = "${cc} --target=arm64-apple-darwin"
|
||||
cxx = "${cxx} --target=arm64-apple-darwin"
|
||||
}
|
||||
asm = "${assembler_prefix}${prefix}/clang"
|
||||
ar = "${prefix}/llvm-ar"
|
||||
ld = "${link_prefix}${prefix}/clang++"
|
||||
@@ -63,10 +55,6 @@ mac_toolchain_suite("ios_clang_x64_sim") {
|
||||
prefix = rebased_clang_dir
|
||||
cc = "${compiler_prefix}${prefix}/clang"
|
||||
cxx = "${compiler_prefix}${prefix}/clang++"
|
||||
if (use_rbe) {
|
||||
cc = "${cc} --target=x86_64-apple-darwin"
|
||||
cxx = "${cxx} --target=x86_64-apple-darwin"
|
||||
}
|
||||
asm = "${assembler_prefix}${prefix}/clang"
|
||||
ar = "${prefix}/llvm-ar"
|
||||
ld = "${link_prefix}${prefix}/clang++"
|
||||
@@ -89,10 +77,6 @@ if (is_watchos) {
|
||||
prefix = rebased_clang_dir
|
||||
cc = "${compiler_prefix}${prefix}/clang"
|
||||
cxx = "${compiler_prefix}${prefix}/clang++"
|
||||
if (use_rbe) {
|
||||
cc = "${cc} --target=arm64-apple-darwin"
|
||||
cxx = "${cxx} --target=arm64-apple-darwin"
|
||||
}
|
||||
asm = "${assembler_prefix}${prefix}/clang"
|
||||
ar = "${prefix}/llvm-ar"
|
||||
ld = "${link_prefix}${prefix}/clang++"
|
||||
@@ -113,10 +97,6 @@ if (is_watchos) {
|
||||
prefix = rebased_clang_dir
|
||||
cc = "${compiler_prefix}${prefix}/clang"
|
||||
cxx = "${compiler_prefix}${prefix}/clang++"
|
||||
if (use_rbe) {
|
||||
cc = "${cc} --target=arm64-apple-darwin"
|
||||
cxx = "${cxx} --target=arm64-apple-darwin"
|
||||
}
|
||||
asm = "${assembler_prefix}${prefix}/clang"
|
||||
ar = "${prefix}/llvm-ar"
|
||||
ld = "${link_prefix}${prefix}/clang++"
|
||||
@@ -138,10 +118,6 @@ mac_toolchain_suite("clang_x64") {
|
||||
prefix = rebased_clang_dir
|
||||
cc = "${compiler_prefix}${prefix}/clang"
|
||||
cxx = "${compiler_prefix}${prefix}/clang++"
|
||||
if (use_rbe) {
|
||||
cc = "${cc} --target=x86_64-apple-macos"
|
||||
cxx = "${cxx} --target=x86_64-apple-macos"
|
||||
}
|
||||
asm = "${assembler_prefix}${prefix}/clang"
|
||||
ar = "${prefix}/llvm-ar"
|
||||
ld = "${link_prefix}${prefix}/clang++"
|
||||
@@ -161,10 +137,6 @@ mac_toolchain_suite("clang_arm64") {
|
||||
prefix = rebased_clang_dir
|
||||
cc = "${compiler_prefix}${prefix}/clang"
|
||||
cxx = "${compiler_prefix}${prefix}/clang++"
|
||||
if (use_rbe) {
|
||||
cc = "${cc} --target=arm64-apple-macos"
|
||||
cxx = "${cxx} --target=arm64-apple-macos"
|
||||
}
|
||||
asm = "${assembler_prefix}${prefix}/clang"
|
||||
ar = "${prefix}/llvm-ar"
|
||||
ld = "${link_prefix}${prefix}/clang++"
|
||||
|
||||
@@ -43,12 +43,12 @@ template("win_toolchains") {
|
||||
environment = "environment." + toolchain_arch
|
||||
prefix = rebase_path("$clang_base_path/bin", root_build_dir)
|
||||
cl = "${compiler_prefix}$prefix/clang-cl.exe"
|
||||
if (use_rbe) {
|
||||
if (toolchain_arch == "x86") {
|
||||
cl = "${cl} --target=i686-pc-windows-msvc"
|
||||
} else if (toolchain_arch == "x64") {
|
||||
cl = "${cl} --target=x86_64-pc-windows-msvc"
|
||||
}
|
||||
if (toolchain_arch == "x86") {
|
||||
cl = "${cl} --target=i686-pc-windows-msvc"
|
||||
} else if (toolchain_arch == "x64") {
|
||||
cl = "${cl} --target=x86_64-pc-windows-msvc"
|
||||
} else if (toolchain_arch == "arm64") {
|
||||
cl = "${cl} --target=aarch64-pc-windows-msvc"
|
||||
}
|
||||
toolchain_args = {
|
||||
if (defined(invoker.toolchain_args)) {
|
||||
|
||||
@@ -175,7 +175,7 @@ template("kernel_service_dill") {
|
||||
"--packages=" + scheme + ":///.dart_tool/package_config.json",
|
||||
"--platform=" + rebase_path("$root_out_dir/vm_platform.dill",
|
||||
root_build_dir),
|
||||
"--filesystem-root=" + rebase_path("../../"),
|
||||
"--filesystem-root=" + rebase_path("../../", root_build_dir),
|
||||
"--filesystem-scheme=" + scheme,
|
||||
"--no-aot",
|
||||
"--no-embed-sources",
|
||||
|
||||
Reference in New Issue
Block a user