Skip to content

Instantly share code, notes, and snippets.

@openedev
Last active March 15, 2020 14:21
Show Gist options
  • Select an option

  • Save openedev/7f7cb16af644d09f11fc49f42cbc2de9 to your computer and use it in GitHub Desktop.

Select an option

Save openedev/7f7cb16af644d09f11fc49f42cbc2de9 to your computer and use it in GitHub Desktop.
Tensorflow-2.2.0-rc1 for aarch64
cd output/build/python-tensorflow-2.2.0-rc1
add endof WORKSPACE file
new_local_repository(
name = "aarch64_compiler",
path = "/mnt/br/output/host",
build_file = "aarch64-compiler/aarch64_compiler.BUILD",
)
mkdir -p aarch64-compiler
cd aarch64-compiler
cat BUILD
package(default_visibility = ["//visibility:public"])
cc_toolchain_suite(
name = "toolchain",
toolchains = {
"aarch64|compiler":":cc-compiler-aarch64",
},
)
filegroup(
name = "empty",
srcs = [],
)
cc_toolchain(
name = "cc-compiler-aarch64",
all_files = ":aarch64_linux_all_files",
compiler_files = ":aarch64_linux_all_files",
cpu = "aarch64",
dwp_files = ":empty",
#dynamic_runtime_libs = [":empty"],
linker_files = ":aarch64_linux_all_files",
objcopy_files = "aarch64_linux_all_files",
#static_runtime_libs = [":empty"],
strip_files = "aarch64_linux_all_files",
supports_param_files = 1,
)
cat aarch64_compiler.BUILD
package(default_visibility = ['//visibility:public'])
filegroup(
name = 'gcc',
srcs = [
'bin/aarch64-buildroot-linux-gnu-gcc',
],
)
filegroup(
name = 'ar',
srcs = [
'bin/aarch64-buildroot-linux-gnu-ar',
],
)
filegroup(
name = 'ld',
srcs = [
'bin/aarch64-buildroot-linux-gnu-ld',
],
)
filegroup(
name = 'nm',
srcs = [
'bin/aarch64-buildroot-linux-gnu-nm',
],
)
filegroup(
name = 'objcopy',
srcs = [
'bin/aarch64-buildroot-linux-gnu-objcopy',
],
)
filegroup(
name = 'objdump',
srcs = [
'bin/aarch64-buildroot-linux-gnu-objdump',
],
)
filegroup(
name = 'strip',
srcs = [
'bin/aarch64-buildroot-linux-gnu-strip',
],
)
filegroup(
name = 'as',
srcs = [
'bin/aarch64-buildroot-linux-gnu-as',
],
)
filegroup(
name = 'compiler_pieces',
srcs = glob([
'aarch64-buildroot-linux-gnu/**',
'libexec/**',
'lib/gcc/aarch64-buildroot-linux-gnu/7.4.0/**',
'include/**',
]),
)
filegroup(
name = 'compiler_components',
srcs = [
':gcc',
':ar',
':ld',
':nm',
':objcopy',
':objdump',
':strip',
':as',
],
)
cat CROSSTOOL
major_version: "local"
minor_version: ""
default_target_cpu: "aarch64"
default_toolchain {
cpu: "aarch64"
toolchain_identifier: "aarch64-buildroot-linux-gnu"
}
toolchain {
abi_version: "aarch64"
abi_libc_version: "aarch64"
builtin_sysroot: ""
compiler: "compiler"
host_system_name: "aarch64"
needsPic: true
supports_gold_linker: true
supports_incremental_linker: false
supports_fission: false
supports_interface_shared_objects: false
supports_normalizing_ar: false
supports_start_end_lib: true
target_libc: "aarch64"
target_cpu: "aarch64"
target_system_name: "aarch64"
toolchain_identifier: "aarch64-buildroot-linux-gnu"
cxx_flag: "-std=c++11"
linker_flag: "-lstdc++"
linker_flag: "-lm"
linker_flag: "-fuse-ld=gold"
linker_flag: "-Wl,-no-as-needed"
linker_flag: "-Wl,-z,relro,-z,now"
linker_flag: "-pass-exit-codes"
cxx_builtin_include_directory: "/mnt/br/output/host/aarch64-buildroot-linux-gnu/include/c++/7.4.0/"
cxx_builtin_include_directory: "/mnt/br/output/host/aarch64-buildroot-linux-gnu/include/c++/7.4.0/backward"
cxx_builtin_include_directory: "/mnt/br/output/host/aarch64-buildroot-linux-gnu/include/"
cxx_builtin_include_directory: "/mnt/br/output/host/lib/gcc/aarch64-buildroot-linux-gnu/7.4.0/include"
cxx_builtin_include_directory: "/mnt/br/output/host/lib/gcc/aarch64-buildroot-linux-gnu/7.4.0/include-fixed"
objcopy_embed_flag: "-I"
objcopy_embed_flag: "binary"
unfiltered_cxx_flag: "-fno-canonical-system-headers"
unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
compiler_flag: "-U_FORTIFY_SOURCE"
compiler_flag: "-fstack-protector"
compiler_flag: "-Wall"
compiler_flag: "-Wunused-but-set-parameter"
compiler_flag: "-Wno-free-nonheap-object"
compiler_flag: "-fno-omit-frame-pointer"
tool_path { name: "ld" path: "/mnt/br/output/host/bin/aarch64-buildroot-linux-gnu-ld" }
tool_path { name: "cpp" path: "/mnt/br/output/host/bin/aarch64-buildroot-linux-gnu-cpp" }
tool_path { name: "dwp" path: "/mnt/br/output/host/bin/aarch64-buildroot-linux-gnu-dwp" }
tool_path { name: "gcov" path: "/mnt/br/output/host/bin/aarch64-buildroot-linux-gnu-gcov" }
tool_path { name: "nm" path: "/mnt/br/output/host/bin/aarch64-buildroot-linux-gnu-nm" }
tool_path { name: "objcopy" path: "/mnt/br/output/host/bin/aarch64-buildroot-linux-gnu-objcopy" }
tool_path { name: "objdump" path: "/mnt/br/output/host/bin/aarch64-buildroot-linux-gnu-objdump" }
tool_path { name: "strip" path: "/mnt/br/output/host/bin/aarch64-buildroot-linux-gnu-strip" }
tool_path { name: "gcc" path: "/mnt/br/output/host/bin/aarch64-buildroot-linux-gnu-gcc" }
tool_path { name: "ar" path: "/mnt/br/output/host/bin/aarch64-buildroot-linux-gnu-ar" }
compilation_mode_flags {
mode: DBG
# Enable debug symbols.
compiler_flag: "-g"
}
compilation_mode_flags {
mode: OPT
# No debug symbols.
# Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or
# even generally? However, that can't happen here, as it requires special
# handling in Bazel.
compiler_flag: "-g0"
# Conservative choice for -O
# -O3 can increase binary size and even slow down the resulting binaries.
# Profile first and / or use FDO if you need better performance than this.
compiler_flag: "-O2"
compiler_flag: "-D_FORTIFY_SOURCE=1"
# Disable assertions
compiler_flag: "-DNDEBUG"
# Removal of unused code and data at link time (can this increase binary size in some cases?).
compiler_flag: "-ffunction-sections"
compiler_flag: "-fdata-sections"
linker_flag: "-Wl,--gc-sections"
}
linking_mode_flags { mode: DYNAMIC }
feature {
name: 'coverage'
provides: 'profile'
flag_set {
action: 'preprocess-assemble'
action: 'c-compile'
action: 'c++-compile'
action: 'c++-header-parsing'
action: 'c++-header-preprocessing'
action: 'c++-module-compile'
flag_group {
flag: '-fprofile-arcs'
flag: '-ftest-coverage'
}
}
flag_set {
action: 'c++-link-interface-dynamic-library'
action: 'c++-link-dynamic-library'
action: 'c++-link-executable'
flag_group {
flag: '-lgcov'
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment