Add external repo patches to support bare-metal build Disable thread library dependency Change-Id: Id43491d30356dacace5e2f894b7661759c2806ce
diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl index b799523..597dc14 100644 --- a/tensorflow/workspace.bzl +++ b/tensorflow/workspace.bzl
@@ -35,6 +35,8 @@ "https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/gemmlowp/archive/fda83bdc38b118cc6b56753bd540caa49e570745.zip", "https://github.com/google/gemmlowp/archive/fda83bdc38b118cc6b56753bd540caa49e570745.zip", ], + patch_file = + "@tflite-micro//third_party/gemmlowp:pthread.patch", ) tf_http_archive(
diff --git a/third_party/gemmlowp/BUILD b/third_party/gemmlowp/BUILD new file mode 100644 index 0000000..c9776cc --- /dev/null +++ b/third_party/gemmlowp/BUILD
@@ -0,0 +1,6 @@ +package( + default_visibility = ["//visibility:public"], + licenses = ["notice"], +) + +exports_files(glob(["*.patch"]))
diff --git a/third_party/gemmlowp/pthread.patch b/third_party/gemmlowp/pthread.patch new file mode 100644 index 0000000..547dd52 --- /dev/null +++ b/third_party/gemmlowp/pthread.patch
@@ -0,0 +1,13 @@ +diff --git a/flags.bzl b/flags.bzl +index e35fe9e..e26a448 100644 +--- a/flags.bzl ++++ b/flags.bzl +@@ -4,7 +4,7 @@ LIB_COPTS = [] + LIB_LINKOPTS = select({ + ":android": [], + ":windows": [], +- "//conditions:default": ["-lpthread"], ++ "//conditions:default": [], + }) + + BIN_LINKOPTS = LIB_LINKOPTS \ No newline at end of file
diff --git a/third_party/ruy/BUILD b/third_party/ruy/BUILD index 4c36181..8db906a 100644 --- a/third_party/ruy/BUILD +++ b/third_party/ruy/BUILD
@@ -5,4 +5,4 @@ licenses = ["notice"], ) -exports_files(["LICENSE"]) +exports_files(glob(["*.patch"]) + ["LICENSE"])
diff --git a/third_party/ruy/pthread.patch b/third_party/ruy/pthread.patch new file mode 100644 index 0000000..c8ddf4d --- /dev/null +++ b/third_party/ruy/pthread.patch
@@ -0,0 +1,11 @@ +diff --git a/ruy/build_defs.oss.bzl b/ruy/build_defs.oss.bzl +index e405b41..1d7612b 100644 +--- a/ruy/build_defs.oss.bzl ++++ b/ruy/build_defs.oss.bzl +@@ -11,5 +11,5 @@ def ruy_linkopts_thread_standard_library(): + # https://github.com/abseil/abseil-cpp/blob/1112609635037a32435de7aa70a9188dcb591458/absl/base/BUILD.bazel#L155 + return select({ + "@bazel_tools//src/conditions:windows": [], +- "//conditions:default": ["-pthread"], ++ "//conditions:default": [], + }) \ No newline at end of file
diff --git a/third_party/ruy/workspace.bzl b/third_party/ruy/workspace.bzl index 5076962..1671ab5 100644 --- a/third_party/ruy/workspace.bzl +++ b/third_party/ruy/workspace.bzl
@@ -12,4 +12,5 @@ "https://github.com/google/ruy/archive/54774a7a2cf85963777289193629d4bd42de4a59.zip", ], build_file = "//third_party/ruy:BUILD", + patch_file = "@tflite-micro//third_party/ruy:pthread.patch", )