Skip to content

Commit 4a14142

Browse files
committed
update cross-compile toolchain to clang 11
update workspace dependencies to latest update libevent BUILD file with updated toolchain capabilities remove project local platform definitions in favor of using platforms defined by the bazel-tools project
1 parent 2e508f4 commit 4a14142

File tree

5 files changed

+51
-64
lines changed

5 files changed

+51
-64
lines changed

Diff for: .bazelrc

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# upstream tensorflow/serving version
2-
build --embed_label=2.4.1
2+
build --embed_label=2.5.0
33

44
common --experimental_repo_remote_exec
55

@@ -30,7 +30,7 @@ import %workspace%/third_party/tensorflow/.bazelrc
3030

3131
# linux_amd64 base config group. use this config when cross-building
3232
# for custom amd64 targets (i.e. ones not defined here)
33-
build:linux_amd64 --platforms=//:linux_amd64
33+
build:linux_amd64 --platforms=@com_github_emacski_bazeltools//platform:linux_amd64
3434

3535
build:linux_amd64_avx_sse4.2 --config=linux_amd64
3636
build:linux_amd64_avx_sse4.2 --copt=-mavx
@@ -41,7 +41,7 @@ build:linux_amd64_avx_sse4.2 --define=tag_suffix=linux_amd64_avx_sse4.2
4141

4242
# this config group should not be invoked directly on the command-line
4343
# TODO: remove legacy crosstool when tf supports toolchain resolution
44-
build:common_arm --crosstool_top=@com_github_emacski_bazeltools//toolchain/cpp/clang:toolchain
44+
build:common_arm --crosstool_top=@com_github_emacski_bazeltools//toolchain/cpp/clang:clang11_crosstool
4545
build:common_arm --copt=-funsafe-math-optimizations
4646
build:common_arm --copt=-ftree-vectorize
4747
build:common_arm --copt=-fomit-frame-pointer
@@ -52,7 +52,7 @@ build:common_arm --copt=-fomit-frame-pointer
5252
# for custom 64 bit arm targets (i.e. ones not defined here)
5353
build:linux_arm64 --config=common_arm
5454
build:linux_arm64 --cpu=aarch64
55-
build:linux_arm64 --platforms=//:linux_arm64
55+
build:linux_arm64 --platforms=@com_github_emacski_bazeltools//platform:linux_arm64
5656
build:linux_arm64 --copt=-march=armv8-a
5757

5858
build:linux_arm64_armv8-a --config=linux_arm64
@@ -68,7 +68,7 @@ build:linux_arm64_armv8.2-a --define=tag_suffix=linux_arm64_armv8.2-a
6868
# custom 32 bit arm targets (i.e. ones not defined here)
6969
build:linux_arm --config=common_arm
7070
build:linux_arm --cpu=arm
71-
build:linux_arm --platforms=//:linux_arm
71+
build:linux_arm --platforms=@com_github_emacski_bazeltools//platform:linux_arm
7272
build:linux_arm --copt=-march=armv7-a
7373

7474
build:linux_arm_armv7-a_neon_vfpv4 --config=linux_arm

Diff for: BUILD

+1-41
Original file line numberDiff line numberDiff line change
@@ -1,41 +1 @@
1-
# Copyright 2020 Erik Maciejewski
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
15-
# this build file serves to make the workspace root a bazel package so that
16-
# WORKSPACE can be referenced by label (//:WORKSPACE) regardless if any build
17-
# targets are defined here
18-
19-
platform(
20-
name = "linux_amd64",
21-
constraint_values = [
22-
"@platforms//os:linux",
23-
"@platforms//cpu:x86_64",
24-
],
25-
)
26-
27-
platform(
28-
name = "linux_arm64",
29-
constraint_values = [
30-
"@platforms//os:linux",
31-
"@platforms//cpu:aarch64",
32-
],
33-
)
34-
35-
platform(
36-
name = "linux_arm",
37-
constraint_values = [
38-
"@platforms//os:linux",
39-
"@platforms//cpu:arm",
40-
],
41-
)
1+
# intentionally blank

Diff for: WORKSPACE

+39-10
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,24 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file"
1818

1919
http_archive(
2020
name = "com_github_emacski_bazeltools",
21-
sha256 = "ac040d00f7f00c9947d61c7b8970a877d907c92e088966c24a0eaeeba5551b19",
22-
strip_prefix = "bazel-tools-250e4a98908fa0c6631ebccdeae930a60fd4c0d5",
23-
urls = ["https://github.com/emacski/bazel-tools/archive/250e4a98908fa0c6631ebccdeae930a60fd4c0d5.tar.gz"],
21+
sha256 = "36c3fb806547b202c98c137a41d2bb2aebf3a52dfc8dedc7d972c1731368e7c7",
22+
strip_prefix = "bazel-tools-7d90c92c3b361b0345451425d85d58a25de80ad9",
23+
urls = ["https://github.com/emacski/bazel-tools/archive/7d90c92c3b361b0345451425d85d58a25de80ad9.tar.gz"],
24+
)
25+
26+
load(
27+
"@com_github_emacski_bazeltools//toolchain/cpp/clang:defs.bzl",
28+
"register_clang_cross_toolchains",
2429
)
2530

2631
# x86_64 to arm(64) cross-compile toolchains
27-
register_toolchains("@com_github_emacski_bazeltools//toolchain/cpp/clang:all")
32+
register_clang_cross_toolchains(clang_version = "11")
2833

2934
http_archive(
3035
name = "io_bazel_rules_docker",
31-
sha256 = "95d39fd84ff4474babaf190450ee034d958202043e366b9fc38f438c9e6c3334",
32-
strip_prefix = "rules_docker-0.16.0",
33-
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.16.0/rules_docker-v0.16.0.tar.gz"],
36+
sha256 = "59d5b42ac315e7eadffa944e86e90c2990110a1c8075f1cd145f487e999d22b3",
37+
strip_prefix = "rules_docker-0.17.0",
38+
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.17.0/rules_docker-v0.17.0.tar.gz"],
3439
)
3540

3641
load(
@@ -66,6 +71,10 @@ http_archive(
6671
# arm (32-bit) datatype sizes
6772
"//third_party/tensorflow:curl.patch",
6873
"//third_party/tensorflow:hwloc.patch",
74+
# might be using host's cpu
75+
"//third_party/tensorflow:mkl.patch",
76+
# remove explicit dep on libgomp
77+
"//third_party/tensorflow:mkl_dnn.patch",
6978
# allow android cpu helper to be used for linux_arm and linux_arm64
7079
"//third_party/tensorflow:tensorflow.patch",
7180
],
@@ -107,10 +116,10 @@ http_archive(
107116
# tensorflow serving 2.5.0
108117
http_archive(
109118
name = "tf_serving",
110-
sha256 = "755a717e04e89ef6ef3aad12fcc3f65d276af06269e0979f11aadbf3c1f0f213",
111-
strip_prefix = "serving-84bc4e4bd5b0c624612438e8b6c6e0d39f2c9a66",
119+
sha256 = "eec408b6950c4d4d06d148ceb1567eaac0c28b9c38fbc2328fe96d07fec3e3d8",
120+
strip_prefix = "serving-bba3972185e47376a63d801ffcd2831684db114a",
112121
urls = [
113-
"https://github.com/tensorflow/serving/archive/84bc4e4bd5b0c624612438e8b6c6e0d39f2c9a66.tar.gz",
122+
"https://github.com/tensorflow/serving/archive/bba3972185e47376a63d801ffcd2831684db114a.tar.gz",
114123
],
115124
)
116125

@@ -138,6 +147,26 @@ load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
138147

139148
rules_pkg_dependencies()
140149

150+
# local cross lib repos
151+
152+
new_local_repository(
153+
name = "local_crosslib_amd64",
154+
build_file = "BUILD.local_crosslib",
155+
path = "/usr/lib/x86_64-linux-gnu",
156+
)
157+
158+
new_local_repository(
159+
name = "local_crosslib_arm64",
160+
build_file = "BUILD.local_crosslib",
161+
path = "/usr/aarch64-linux-gnu/lib",
162+
)
163+
164+
new_local_repository(
165+
name = "local_crosslib_arm",
166+
build_file = "BUILD.local_crosslib",
167+
path = "/usr/arm-linux-gnueabihf/lib",
168+
)
169+
141170
# debian packages
142171

143172
http_archive(

Diff for: tensorflow_model_server/tools/docker/Dockerfile

+5-7
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,15 @@ FROM debian:buster as build
1717
# cc toolchain
1818
RUN apt-get update && \
1919
apt-get install -y --no-install-recommends \
20+
curl ca-certificates \
2021
gcc g++ \
2122
gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \
22-
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
23-
libtinfo5 \
24-
curl xz-utils ca-certificates && \
23+
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu && \
2524
apt-get clean && \
2625
rm -rf /var/lib/apt/lists/*
27-
ENV INSTALL_LLVM_VERSION=10.0.0
28-
RUN curl -L https://raw.githubusercontent.com/emacski/bazel-tools/master/toolchain/cpp/clang/install_clang_cross.sh \
29-
-o install_clang_cross.sh && \
30-
sh install_clang_cross.sh && rm -f install_clang_cross.sh
26+
RUN curl -L https://raw.githubusercontent.com/emacski/bazel-tools/master/toolchain/cpp/clang/install_clang11_debian10.sh \
27+
-o install_clang11_debian10.sh && \
28+
sh install_clang11_debian10.sh && rm -f install_clang11_debian10.sh
3129
# python toolchain
3230
RUN apt-get update && \
3331
apt-get install -y --no-install-recommends \

Diff for: third_party/libevent/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ genrule(
6060
"cp -R $$(pwd)/external/com_github_libevent_libevent/* $$TMP_DIR",
6161
"cd $$TMP_DIR",
6262
"./autogen.sh",
63-
"CC=$(CC) CFLAGS=\"$(CC_FLAGS) -fuse-ld=lld -fPIC -O3\" CXXFLAGS=-fPIC ./configure \\",
63+
"CC=$(CC) CFLAGS=\"$(CC_FLAGS) -fPIC\" CXXFLAGS=-fPIC ./configure \\",
6464
" --prefix=$$INSTALL_DIR --host=$(TARGET_GNU_SYSTEM_NAME) \\",
6565
" --with-sysroot=$(SYSROOT) --enable-shared=no --disable-openssl \\",
6666
" --disable-libevent-regress --disable-samples",

0 commit comments

Comments
 (0)