From 60435a818d5d5582858f2ef7d693ff17c30bbad4 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Thu, 7 Mar 2024 10:05:43 -0500 Subject: [PATCH 01/36] Add support for TF 2.16.0-rc0 --- README.md | 6 +++--- debian/changelog | 3 +++ docker/Dockerfile | 2 +- docker/Dockerfile.windows | 2 +- workspace.bzl | 10 +++++++--- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3ece434..760d43d 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,9 @@ debuild -us -uc -tc -b -a amd64 -d ``` ### Bazel -The version of `bazel` needs to be the same as that recommended for the corresponding version of tensorflow. For example, it requires `Bazel 6.1.0` to compile TF 2.15.0. +The version of `bazel` needs to be the same as that recommended for the corresponding version of tensorflow. For example, it requires `Bazel 6.5.0` to compile TF 2.16.0. -Current version of tensorflow supported is `2.15.0`. +Current version of tensorflow supported is `2.16.0`. Build native binaries on Linux and macOS: ``` @@ -85,7 +85,7 @@ sudo apt install libabsl-dev libflatbuffers-dev Next, you'll need to clone the [Tensorflow Repo](https://github.com/tensorflow/tensorflow) at the desired checkout (using TF head isn't advised). If you are planning to use libcoral or pycoral libraries, this should match the ones in those repos' WORKSPACE files. For example, if you are using TF2.15, we can check that [tag in the TF Repo](https://github.com/tensorflow/tensorflow/tree/r2.15) get the latest commit for that stable release and then checkout that address: ``` git clone https://github.com/tensorflow/tensorflow -git checkout r2.15 +git checkout v2.16.0 ``` To build the library: diff --git a/debian/changelog b/debian/changelog index dcb14f0..b41e940 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,6 @@ +libedgetpu (16.0.1~tf2.16.0-1) stable; urgency=medium + * Build against TF v2.16.0 +-- Nicola Ferralis < feranick@hotmail.com> Thu, 07 Mar 2024 10:01:34 -0500 libedgetpu (16.0tf2.15.0-1) stable; urgency=medium * Build against TF v2.15.0 -- Nicola Ferralis Tue, 31 Jan 2024 09:10:34 -0500 diff --git a/docker/Dockerfile b/docker/Dockerfile index f440551..0fcbcb4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -54,7 +54,7 @@ RUN if grep 'Bionic Beaver' /etc/os-release > /dev/null; then \ && DEBIAN_FRONTEND=noninteractive apt-get install -y gcc-9 g++-9; \ fi -ARG BAZEL_VERSION=6.1.0 +ARG BAZEL_VERSION=6.5.0 RUN wget -O /bazel https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh && \ bash /bazel && \ rm -f /bazel diff --git a/docker/Dockerfile.windows b/docker/Dockerfile.windows index e607917..89d5cd5 100644 --- a/docker/Dockerfile.windows +++ b/docker/Dockerfile.windows @@ -52,5 +52,5 @@ ADD https://github.com/libusb/libusb/releases/download/v${LIBUSB_VERSION}/libusb RUN 7z x -oc:\libusb c:\windows\temp\libusb-$env:LIBUSB_VERSION.7z # Install Bazel -ARG BAZEL_VERSION=6.1.0 +ARG BAZEL_VERSION=6.5.0 ADD https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-windows-x86_64.exe c:/windows/system32/bazel.exe diff --git a/workspace.bzl b/workspace.bzl index 6610037..d1f2151 100644 --- a/workspace.bzl +++ b/workspace.bzl @@ -41,9 +41,13 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") #TENSORFLOW_COMMIT = "99d80a9e254c9df7940b2902b14d15914dbbbcd9" #TENSORFLOW_SHA256 = "bede963ce97c4badcbb3149acd7c35a6a4954fa3361b777272a58a300e7e8f1d" -# TF release 2.15.0 as of 11/10/2023. Current -TENSORFLOW_COMMIT = "6887368d6d46223f460358323c4b76d61d1558a8" -TENSORFLOW_SHA256 = "bb25fa4574e42ea4d452979e1d2ba3b86b39569d6b8106a846a238b880d73652" +#TENSORFLOW_COMMIT = "6887368d6d46223f460358323c4b76d61d1558a8"| +#TENSORFLOW_SHA256 = "bb25fa4574e42ea4d452979e1d2ba3b86b39569d6b8106a846a238b880d73652" + +# TF release 2.16.0-rc® as of 02/27/2024. +Current - Pre-Release +TENSORFLOW_COMMIT = "4bdc149ac84738b06a592473595c1c9c2bd2a9a3"| +TENSORFLOW_SHA256 = "1bbdd3dd266de720e08b7093d2441a9bca183c32d7c8e4c84e05d17e770974bf" #CORAL_CROSSTOOL_COMMIT = "6bcc2261d9fc60dff386b557428d98917f0af491" #CORAL_CROSSTOOL_SHA256 = "38cb4da13009d07ebc2fed4a9d055b0f914191b344dd2d1ca5803096343958b4" From 27b12882e45afa3ee29071302f99e63933c53eba Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Thu, 7 Mar 2024 10:07:33 -0500 Subject: [PATCH 02/36] Use c++17 for all platforms --- .bazelrc | 5 +++-- WORKSPACE | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.bazelrc b/.bazelrc index 49d2bb8..7e05507 100644 --- a/.bazelrc +++ b/.bazelrc @@ -7,10 +7,11 @@ build --enable_platform_specific_config build:linux --crosstool_top=@crosstool//:toolchains build:linux --compiler=gcc +build:linux --cxxopt=-std=c++17 -build:macos --cxxopt=-std=c++14 +build:macos --cxxopt=-std=c++17 build:macos --copt=-fvisibility=hidden build:windows --incompatible_restrict_string_escapes=false build:windows --copt=/DWIN32_LEAN_AND_MEAN -build:windows --cxxopt=/std:c++14 +build:windows --cxxopt=/std:c++17 diff --git a/WORKSPACE b/WORKSPACE index 84afa94..3d031a4 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -102,4 +102,4 @@ load("@org_tensorflow//tensorflow:workspace0.bzl", "tf_workspace0") tf_workspace0() load("@coral_crosstool//:configure.bzl", "cc_crosstool") -cc_crosstool(name = "crosstool", cpp_version = "c++14") +cc_crosstool(name = "crosstool", cpp_version = "c++17") From 5c3cae5064a8ef74cecbb747a0d51d5c12d39fec Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Thu, 7 Mar 2024 15:46:10 -0500 Subject: [PATCH 03/36] Add support for TF 2.16.1 stable --- README.md | 6 +++--- debian/changelog | 6 +++--- workspace.bzl | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 760d43d..a8f85cc 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,9 @@ debuild -us -uc -tc -b -a amd64 -d ``` ### Bazel -The version of `bazel` needs to be the same as that recommended for the corresponding version of tensorflow. For example, it requires `Bazel 6.5.0` to compile TF 2.16.0. +The version of `bazel` needs to be the same as that recommended for the corresponding version of tensorflow. For example, it requires `Bazel 6.5.0` to compile TF 2.16.1. -Current version of tensorflow supported is `2.16.0`. +Current version of tensorflow supported is `2.16.1`. Build native binaries on Linux and macOS: ``` @@ -85,7 +85,7 @@ sudo apt install libabsl-dev libflatbuffers-dev Next, you'll need to clone the [Tensorflow Repo](https://github.com/tensorflow/tensorflow) at the desired checkout (using TF head isn't advised). If you are planning to use libcoral or pycoral libraries, this should match the ones in those repos' WORKSPACE files. For example, if you are using TF2.15, we can check that [tag in the TF Repo](https://github.com/tensorflow/tensorflow/tree/r2.15) get the latest commit for that stable release and then checkout that address: ``` git clone https://github.com/tensorflow/tensorflow -git checkout v2.16.0 +git checkout v2.16.1 ``` To build the library: diff --git a/debian/changelog b/debian/changelog index b41e940..6786f49 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ -libedgetpu (16.0.1~tf2.16.0-1) stable; urgency=medium - * Build against TF v2.16.0 --- Nicola Ferralis < feranick@hotmail.com> Thu, 07 Mar 2024 10:01:34 -0500 +libedgetpu (16.0.1~tf2.16.1-1) stable; urgency=medium + * Build against TF v2.16.1 +-- Nicola Ferralis < feranick@hotmail.com> Thu, 07 Mar 2024 14:01:34 -0500 libedgetpu (16.0tf2.15.0-1) stable; urgency=medium * Build against TF v2.15.0 -- Nicola Ferralis Tue, 31 Jan 2024 09:10:34 -0500 diff --git a/workspace.bzl b/workspace.bzl index d1f2151..979e44d 100644 --- a/workspace.bzl +++ b/workspace.bzl @@ -41,13 +41,13 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") #TENSORFLOW_COMMIT = "99d80a9e254c9df7940b2902b14d15914dbbbcd9" #TENSORFLOW_SHA256 = "bede963ce97c4badcbb3149acd7c35a6a4954fa3361b777272a58a300e7e8f1d" -#TENSORFLOW_COMMIT = "6887368d6d46223f460358323c4b76d61d1558a8"| +# TF release 2.15.0 as of 11/10/2023. +#TENSORFLOW_COMMIT = "6887368d6d46223f460358323c4b76d61d1558a8" #TENSORFLOW_SHA256 = "bb25fa4574e42ea4d452979e1d2ba3b86b39569d6b8106a846a238b880d73652" -# TF release 2.16.0-rc® as of 02/27/2024. -Current - Pre-Release -TENSORFLOW_COMMIT = "4bdc149ac84738b06a592473595c1c9c2bd2a9a3"| -TENSORFLOW_SHA256 = "1bbdd3dd266de720e08b7093d2441a9bca183c32d7c8e4c84e05d17e770974bf" +# TF release 2.16.1 as of 03/07/2024. Current. +TENSORFLOW_COMMIT = "5bc9d26649cca274750ad3625bd93422617eed4b" +TENSORFLOW_SHA256 = "fe592915c85d1a89c20f3dd89db0772ee22a0fbda78e39aa46a778d638a96abc" #CORAL_CROSSTOOL_COMMIT = "6bcc2261d9fc60dff386b557428d98917f0af491" #CORAL_CROSSTOOL_SHA256 = "38cb4da13009d07ebc2fed4a9d055b0f914191b344dd2d1ca5803096343958b4" From f3e9264865e85b7f2d66dc5eccd6581cec1b12f5 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Thu, 7 Mar 2024 16:07:56 -0500 Subject: [PATCH 04/36] Simplify versioning in debian To conform with git tag --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 6786f49..d0f73ba 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -libedgetpu (16.0.1~tf2.16.1-1) stable; urgency=medium +libedgetpu (16.0tf2.16.1-1) stable; urgency=medium * Build against TF v2.16.1 -- Nicola Ferralis < feranick@hotmail.com> Thu, 07 Mar 2024 14:01:34 -0500 libedgetpu (16.0tf2.15.0-1) stable; urgency=medium From 1adc5c5132ddcb53293204b98298a0ab523e506b Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Fri, 21 Jun 2024 00:01:56 +0200 Subject: [PATCH 05/36] Initial support for TF 2.17.0-rc0 --- workspace.bzl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/workspace.bzl b/workspace.bzl index 979e44d..227a24f 100644 --- a/workspace.bzl +++ b/workspace.bzl @@ -49,6 +49,10 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") TENSORFLOW_COMMIT = "5bc9d26649cca274750ad3625bd93422617eed4b" TENSORFLOW_SHA256 = "fe592915c85d1a89c20f3dd89db0772ee22a0fbda78e39aa46a778d638a96abc" +# TF release 2.17.0-rc0 as of 06/18/2024. Pre-release. +TENSORFLOW_COMMIT = "c12935684083ee1f182530d417afde060a60a7a5" +TENSORFLOW_SHA256 = "6567aa89da9ecd9b82a816fd6986d463bf30d3df8718b2260639260a2fd871d8" + #CORAL_CROSSTOOL_COMMIT = "6bcc2261d9fc60dff386b557428d98917f0af491" #CORAL_CROSSTOOL_SHA256 = "38cb4da13009d07ebc2fed4a9d055b0f914191b344dd2d1ca5803096343958b4" From a3e55fb6a7dcb78fdb5625efa185d796920c4083 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Fri, 21 Jun 2024 00:03:45 +0200 Subject: [PATCH 06/36] Updated debian changelog for TF 2.17.0-rc0 --- debian/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/changelog b/debian/changelog index d0f73ba..3b60fe2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,6 @@ +libedgetpu (16.0tf2.17.0rc0-1) stable; urgency=medium + * Build against TF v2.17.0-rc0 +-- Nicola Ferralis < feranick@hotmail.com> Thu, 20 Jun 2024 16:02:34 -0500 libedgetpu (16.0tf2.16.1-1) stable; urgency=medium * Build against TF v2.16.1 -- Nicola Ferralis < feranick@hotmail.com> Thu, 07 Mar 2024 14:01:34 -0500 From ef12033097ac561c8458e8284bb737ac8f834583 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Fri, 21 Jun 2024 00:06:48 +0200 Subject: [PATCH 07/36] Disable previous version of TF in workspace.bzl --- workspace.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workspace.bzl b/workspace.bzl index 227a24f..856b955 100644 --- a/workspace.bzl +++ b/workspace.bzl @@ -46,8 +46,8 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") #TENSORFLOW_SHA256 = "bb25fa4574e42ea4d452979e1d2ba3b86b39569d6b8106a846a238b880d73652" # TF release 2.16.1 as of 03/07/2024. Current. -TENSORFLOW_COMMIT = "5bc9d26649cca274750ad3625bd93422617eed4b" -TENSORFLOW_SHA256 = "fe592915c85d1a89c20f3dd89db0772ee22a0fbda78e39aa46a778d638a96abc" +#TENSORFLOW_COMMIT = "5bc9d26649cca274750ad3625bd93422617eed4b" +#TENSORFLOW_SHA256 = "fe592915c85d1a89c20f3dd89db0772ee22a0fbda78e39aa46a778d638a96abc" # TF release 2.17.0-rc0 as of 06/18/2024. Pre-release. TENSORFLOW_COMMIT = "c12935684083ee1f182530d417afde060a60a7a5" From d167fd74e59a06c5261d59c99722314df73764a8 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Fri, 21 Jun 2024 00:20:50 +0200 Subject: [PATCH 08/36] Bug fixes on debian changelog --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 3b60fe2..f655cf3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,9 @@ libedgetpu (16.0tf2.17.0rc0-1) stable; urgency=medium * Build against TF v2.17.0-rc0 --- Nicola Ferralis < feranick@hotmail.com> Thu, 20 Jun 2024 16:02:34 -0500 +-- Nicola Ferralis Thu, 20 Jun 2024 18:19:48 -0400 libedgetpu (16.0tf2.16.1-1) stable; urgency=medium * Build against TF v2.16.1 --- Nicola Ferralis < feranick@hotmail.com> Thu, 07 Mar 2024 14:01:34 -0500 +-- Nicola Ferralis Thu, 07 Mar 2024 14:01:34 -0500 libedgetpu (16.0tf2.15.0-1) stable; urgency=medium * Build against TF v2.15.0 -- Nicola Ferralis Tue, 31 Jan 2024 09:10:34 -0500 From 1494008c2c8013d2f739934ae12936ff9fb28a97 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Fri, 21 Jun 2024 10:16:12 +0200 Subject: [PATCH 09/36] Updated README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a8f85cc..82bbcf2 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,9 @@ debuild -us -uc -tc -b -a amd64 -d ``` ### Bazel -The version of `bazel` needs to be the same as that recommended for the corresponding version of tensorflow. For example, it requires `Bazel 6.5.0` to compile TF 2.16.1. +The version of `bazel` needs to be the same as that recommended for the corresponding version of tensorflow. For example, it requires `Bazel 6.5.0` to compile TF 2.16.1 (or 2.17.0). -Current version of tensorflow supported is `2.16.1`. +The current version of Tensorflow supported is `2.17.0`. Build native binaries on Linux and macOS: ``` @@ -85,7 +85,7 @@ sudo apt install libabsl-dev libflatbuffers-dev Next, you'll need to clone the [Tensorflow Repo](https://github.com/tensorflow/tensorflow) at the desired checkout (using TF head isn't advised). If you are planning to use libcoral or pycoral libraries, this should match the ones in those repos' WORKSPACE files. For example, if you are using TF2.15, we can check that [tag in the TF Repo](https://github.com/tensorflow/tensorflow/tree/r2.15) get the latest commit for that stable release and then checkout that address: ``` git clone https://github.com/tensorflow/tensorflow -git checkout v2.16.1 +git checkout v2.17.0 ``` To build the library: From 05beb38362c0afd77f993920a6f24ff57aac9683 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Fri, 21 Jun 2024 13:57:48 +0200 Subject: [PATCH 10/36] Updated Dockerfile.windows with latest dependencies --- docker/Dockerfile.windows | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile.windows b/docker/Dockerfile.windows index 89d5cd5..8976839 100644 --- a/docker/Dockerfile.windows +++ b/docker/Dockerfile.windows @@ -28,7 +28,7 @@ RUN choco install -y 7zip RUN setx /M PATH $($Env:PATH + ';C:\Program Files\7-Zip') # Install msys2 -ARG MSYS_VERSION=20240113 +ARG MSYS_VERSION=20240507 ADD http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-${MSYS_VERSION}.tar.xz c:/windows/temp RUN 7z.exe x c:\windows\temp\msys2-base-x86_64-$env:MSYS_VERSION.tar.xz RUN 7z.exe x c:\msys2-base-x86_64-$env:MSYS_VERSION.tar -o"c:\\" @@ -41,7 +41,7 @@ RUN 7z.exe x -y c:\windows\temp\patch-$env:PATCH_VERSION-x86_64.pkg.tar.xz RUN 7z.exe x -y c:\patch-$env:PATCH_VERSION-x86_64.pkg.tar -o"c:\\msys64" # Install vim (for xxd) -ARG VIM_VERSION=9.1.0000-1 +ARG VIM_VERSION=9.1.0445-1 ADD http://repo.msys2.org/msys/x86_64/vim-${VIM_VERSION}-x86_64.pkg.tar.zst c:/windows/temp RUN 7z.exe x -y c:\windows\temp\vim-$env:VIM_VERSION-x86_64.pkg.tar.zst RUN 7z.exe x -y c:\vim-$env:VIM_VERSION-x86_64.pkg.tar -o"c:\\msys64" From d609eaa614b06856d55185464cedbe4b6e384045 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Sun, 7 Jul 2024 12:22:59 +0200 Subject: [PATCH 11/36] Added Support for TF 2.17.0-rc1 --- README.md | 4 ++-- debian/changelog | 3 +++ workspace.bzl | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 82bbcf2..57252a8 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ debuild -us -uc -tc -b -a amd64 -d ``` ### Bazel -The version of `bazel` needs to be the same as that recommended for the corresponding version of tensorflow. For example, it requires `Bazel 6.5.0` to compile TF 2.16.1 (or 2.17.0). +The version of `bazel` needs to be the same as that recommended for the corresponding version of tensorflow. For example, it requires `Bazel 6.5.0` to compile TF 2.17.0. The current version of Tensorflow supported is `2.17.0`. @@ -82,7 +82,7 @@ To prepare your system, you'll need the following packages (both available on De sudo apt install libabsl-dev libflatbuffers-dev ``` -Next, you'll need to clone the [Tensorflow Repo](https://github.com/tensorflow/tensorflow) at the desired checkout (using TF head isn't advised). If you are planning to use libcoral or pycoral libraries, this should match the ones in those repos' WORKSPACE files. For example, if you are using TF2.15, we can check that [tag in the TF Repo](https://github.com/tensorflow/tensorflow/tree/r2.15) get the latest commit for that stable release and then checkout that address: +Next, you'll need to clone the [Tensorflow Repo](https://github.com/tensorflow/tensorflow) at the desired checkout (using TF head isn't advised). If you are planning to use libcoral or pycoral libraries, this should match the ones in those repos' WORKSPACE files. For example, if you are using TF 2.17, we can check that [tag in the TF Repo](https://github.com/tensorflow/tensorflow/tree/r2.15) get the latest commit for that stable release and then checkout that address: ``` git clone https://github.com/tensorflow/tensorflow git checkout v2.17.0 diff --git a/debian/changelog b/debian/changelog index f655cf3..a66b154 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,6 @@ +libedgetpu (16.0tf2.17.0rc1-1) stable; urgency=medium + * Build against TF v2.17.0-rc1 +-- Nicola Ferralis < feranick@hotmail.com> Sun, 07 Jul 2024 06:16:58 -0400 libedgetpu (16.0tf2.17.0rc0-1) stable; urgency=medium * Build against TF v2.17.0-rc0 -- Nicola Ferralis Thu, 20 Jun 2024 18:19:48 -0400 diff --git a/workspace.bzl b/workspace.bzl index 856b955..3c8aa31 100644 --- a/workspace.bzl +++ b/workspace.bzl @@ -49,9 +49,9 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") #TENSORFLOW_COMMIT = "5bc9d26649cca274750ad3625bd93422617eed4b" #TENSORFLOW_SHA256 = "fe592915c85d1a89c20f3dd89db0772ee22a0fbda78e39aa46a778d638a96abc" -# TF release 2.17.0-rc0 as of 06/18/2024. Pre-release. -TENSORFLOW_COMMIT = "c12935684083ee1f182530d417afde060a60a7a5" -TENSORFLOW_SHA256 = "6567aa89da9ecd9b82a816fd6986d463bf30d3df8718b2260639260a2fd871d8" +# TF release 2.17.0-rc1 as of 07/02/2024. Pre-release. +TENSORFLOW_COMMIT = "b3dcff925010e3be83cbc8556ad4e66012f3a44e" +TENSORFLOW_SHA256 = "3fa364c2e480271152f164075a0b7895ceb311e3d488b35128500346f4cbb578" #CORAL_CROSSTOOL_COMMIT = "6bcc2261d9fc60dff386b557428d98917f0af491" #CORAL_CROSSTOOL_SHA256 = "38cb4da13009d07ebc2fed4a9d055b0f914191b344dd2d1ca5803096343958b4" From 28287cf2fd7bbcbebf52855036e9be571584a266 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Fri, 12 Jul 2024 15:42:37 +0200 Subject: [PATCH 12/36] Add support for TF 2.17.0 stable. --- debian/changelog | 9 +++------ workspace.bzl | 6 +++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/debian/changelog b/debian/changelog index a66b154..4e37774 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,6 @@ -libedgetpu (16.0tf2.17.0rc1-1) stable; urgency=medium - * Build against TF v2.17.0-rc1 --- Nicola Ferralis < feranick@hotmail.com> Sun, 07 Jul 2024 06:16:58 -0400 -libedgetpu (16.0tf2.17.0rc0-1) stable; urgency=medium - * Build against TF v2.17.0-rc0 --- Nicola Ferralis Thu, 20 Jun 2024 18:19:48 -0400 +libedgetpu (16.0tf2.17.0-1) stable; urgency=medium + * Build against TF v2.17.0 +-- Nicola Ferralis < feranick@hotmail.com> Fri, 12 Jul 2024 09:41:18 -0400 libedgetpu (16.0tf2.16.1-1) stable; urgency=medium * Build against TF v2.16.1 -- Nicola Ferralis Thu, 07 Mar 2024 14:01:34 -0500 diff --git a/workspace.bzl b/workspace.bzl index 3c8aa31..fca33ee 100644 --- a/workspace.bzl +++ b/workspace.bzl @@ -49,9 +49,9 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") #TENSORFLOW_COMMIT = "5bc9d26649cca274750ad3625bd93422617eed4b" #TENSORFLOW_SHA256 = "fe592915c85d1a89c20f3dd89db0772ee22a0fbda78e39aa46a778d638a96abc" -# TF release 2.17.0-rc1 as of 07/02/2024. Pre-release. -TENSORFLOW_COMMIT = "b3dcff925010e3be83cbc8556ad4e66012f3a44e" -TENSORFLOW_SHA256 = "3fa364c2e480271152f164075a0b7895ceb311e3d488b35128500346f4cbb578" +# TF release 2.17.0 as of 07/12/2024. +TENSORFLOW_COMMIT = "ad6d8cc177d0c868982e39e0823d0efbfb95f04c" +TENSORFLOW_SHA256 = "75b8dc9b33afff6f2e2d2e2dacc26dd0973bdcee94eec2af290828c1bc574bdc" #CORAL_CROSSTOOL_COMMIT = "6bcc2261d9fc60dff386b557428d98917f0af491" #CORAL_CROSSTOOL_SHA256 = "38cb4da13009d07ebc2fed4a9d055b0f914191b344dd2d1ca5803096343958b4" From d254c1ad29b585d449ec0843d95a501575ed337d Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Sun, 11 Aug 2024 11:57:10 +0200 Subject: [PATCH 13/36] Added support for Ubuntu:24.04 Change su user to root to allow compilation in Ubuntu 24.04 24.04 introduces a new way to handle repositories, using sources rather than lists. --- Makefile | 2 +- docker/update_sources.sh | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d1479b8..6ebba5c 100644 --- a/Makefile +++ b/Makefile @@ -172,7 +172,7 @@ chmod a+w /; \ groupadd --gid $(shell id -g) $(shell id -g -n); \ useradd -m -e '' -s /bin/bash --gid $(shell id -g) --uid $(shell id -u) $(shell id -u -n); \ echo '$(shell id -u -n) ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers; \ -su $(shell id -u -n) $(if $(1),-c '$(1)',) +su $(if $(1),-c '$(1)',) endef docker-image: diff --git a/docker/update_sources.sh b/docker/update_sources.sh index 19ddaa1..7913d7e 100755 --- a/docker/update_sources.sh +++ b/docker/update_sources.sh @@ -18,8 +18,47 @@ sed -i "s/deb\ /deb \[arch=amd64\]\ /g" /etc/apt/sources.list +if [ ${UBUNTU_CODENAME} == "noble" ]; then + +echo "NOBLE" + +rm /etc/apt/sources.list.d/ubuntu.sources +cat <> /etc/apt/sources.list.d/ubuntu.sources + +Types: deb +URIs: http://archive.ubuntu.com/ubuntu/ +Suites: ${UBUNTU_CODENAME} ${UBUNTU_CODENAME}-updates ${UBUNTU_CODENAME}-backports +Components: main universe restricted multiverse +Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg +Architectures: amd64 + +## Ubuntu security updates. Aside from URIs and Suites, +## this should mirror your choices in the previous section. +Types: deb +URIs: http://security.ubuntu.com/ubuntu/ +Suites: ${UBUNTU_CODENAME}-security +Components: main universe restricted multiverse +Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg +Architectures: amd64 + +Types: deb +URIs: http://ports.ubuntu.com/ubuntu-ports +Suites: ${UBUNTU_CODENAME} ${UBUNTU_CODENAME}-updates ${UBUNTU_CODENAME}-security +Components: main universe +Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg +Architectures: arm64 armhf + +EOT + +else + cat <> /etc/apt/sources.list deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_CODENAME} main universe deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_CODENAME}-updates main universe deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_CODENAME}-security main universe EOT + +fi + + + From 1390341866d6dff8b5bce7f7c765a112b3c36205 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Sun, 11 Aug 2024 12:04:45 +0200 Subject: [PATCH 14/36] Updated third party libraries Docker.windows --- docker/Dockerfile.windows | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile.windows b/docker/Dockerfile.windows index 8976839..307912c 100644 --- a/docker/Dockerfile.windows +++ b/docker/Dockerfile.windows @@ -28,20 +28,20 @@ RUN choco install -y 7zip RUN setx /M PATH $($Env:PATH + ';C:\Program Files\7-Zip') # Install msys2 -ARG MSYS_VERSION=20240507 +ARG MSYS_VERSION=20240727 ADD http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-${MSYS_VERSION}.tar.xz c:/windows/temp RUN 7z.exe x c:\windows\temp\msys2-base-x86_64-$env:MSYS_VERSION.tar.xz RUN 7z.exe x c:\msys2-base-x86_64-$env:MSYS_VERSION.tar -o"c:\\" RUN setx /M PATH $($Env:PATH + ';C:\msys64\usr\bin') # Install patch -ARG PATCH_VERSION=2.7.6-1 +ARG PATCH_VERSION=2.7.6-2 ADD http://repo.msys2.org/msys/x86_64/patch-${PATCH_VERSION}-x86_64.pkg.tar.xz c:/windows/temp RUN 7z.exe x -y c:\windows\temp\patch-$env:PATCH_VERSION-x86_64.pkg.tar.xz RUN 7z.exe x -y c:\patch-$env:PATCH_VERSION-x86_64.pkg.tar -o"c:\\msys64" # Install vim (for xxd) -ARG VIM_VERSION=9.1.0445-1 +ARG VIM_VERSION=9.1.0643-1 ADD http://repo.msys2.org/msys/x86_64/vim-${VIM_VERSION}-x86_64.pkg.tar.zst c:/windows/temp RUN 7z.exe x -y c:\windows\temp\vim-$env:VIM_VERSION-x86_64.pkg.tar.zst RUN 7z.exe x -y c:\vim-$env:VIM_VERSION-x86_64.pkg.tar -o"c:\\msys64" From 4f8de82c8e5599af974f87693e4a904a9e392988 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Wed, 18 Sep 2024 18:53:57 -0400 Subject: [PATCH 15/36] Updates Makefile for modern versions of Tensorflow Referred in https://github.com/google-coral/libedgetpu/issues/72 --- makefile_build/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/makefile_build/Makefile b/makefile_build/Makefile index ef7d290..20f740e 100644 --- a/makefile_build/Makefile +++ b/makefile_build/Makefile @@ -22,7 +22,7 @@ LIBEDGETPU_CFLAGS := \ LIBEDGETPU_CXXFLAGS := \ -fPIC \ -Wall \ - -std=c++14 \ + -std=c++17 \ -DDARWINN_PORT_DEFAULT LIBEDGETPU_LDFLAGS := \ @@ -59,7 +59,7 @@ LIBEDGETPU_INCLUDES := \ $(BUILDDIR)/$(BUILDROOT) LIBEDGETPU_INCLUDES := $(addprefix -I,$(LIBEDGETPU_INCLUDES)) -LIBEDGETPU_CSRCS := $(TFROOT)/tensorflow/lite/c/common.c +LIBEDGETPU_CSRCS := $(TFROOT)/tensorflow/lite/c/common_internal.cc LIBEDGETPU_COBJS := $(call TOBUILDDIR,$(patsubst %.c,%.o,$(LIBEDGETPU_CSRCS))) LIBEDGETPU_CCSRCS := \ From 0f7fb7a74cb439970a08fc2019d8339961b0ce6b Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Wed, 18 Sep 2024 19:05:21 -0400 Subject: [PATCH 16/36] Update makefile_build/README.md Still refers to ancient versions of TF. In reference to: https://github.com/google-coral/libedgetpu/pull/66 https://github.com/google-coral/libedgetpu/issues/72 --- makefile_build/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/makefile_build/README.md b/makefile_build/README.md index a0ed003..c48a28e 100644 --- a/makefile_build/README.md +++ b/makefile_build/README.md @@ -7,10 +7,10 @@ To prepare your system, you'll need the following packages (both available on De sudo apt install libabsl-dev libflatbuffers-dev ``` -Next, you'll need to clone the [Tensorflow Repo](https://github.com/tensorflow/tensorflow) at the desired checkout (using TF head isn't advised). If you are planning to use libcoral or pycoral libraries, this should match the ones in those repos' WORKSPACE files. For example, if you are using TF2.5, we can check that [tag in the TF Repo](https://github.com/tensorflow/tensorflow/commit/a4dfb8d1a71385bd6d122e4f27f86dcebb96712d) and then checkout that address: +Next, you'll need to clone the [Tensorflow Repo](https://github.com/tensorflow/tensorflow) at the desired checkout (using TF head isn't advised). If you are planning to use libcoral or pycoral libraries, this should match the ones in those repos' WORKSPACE files. For example, if you are using TF2.17.0, we can check that [tag in the TF Repo](https://github.com/tensorflow/tensorflow/commit/ad6d8cc177d0c868982e39e0823d0efbfb95f04c) and then checkout that address: ``` git clone https://github.com/tensorflow/tensorflow -git checkout a4dfb8d1a71385bd6d122e4f27f86dcebb96712d -b tf2.5 +git checkout v2.17.0 ``` To build the library: From 16d801e9964fa243f8f1bfb1589a819c89a28ea2 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Mon, 30 Sep 2024 11:50:41 -0400 Subject: [PATCH 17/36] Updated README.md --- README.md | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 57252a8..21c7a58 100644 --- a/README.md +++ b/README.md @@ -77,18 +77,42 @@ Repeat compilation. If only building for native systems, it is possible to significantly reduce the complexity of the build by removing Bazel (and Docker). This simple approach builds only what is needed, removes build-time depenency fetching, increases the speed, and uses upstream Debian packages. -To prepare your system, you'll need the following packages (both available on Debian Bookworm, Bullseye or Buster-Backports): +To prepare your system, you'll need the following packages: ``` sudo apt install libabsl-dev libflatbuffers-dev ``` +For Ubuntu 24.10 or newer you also need: +``` +sudo apt install libflatbuffers-dev +``` +For previous versions, you need a newer version of `libflatbuffers-dev` than the one available from the distribution: + +``` +git clone https://github.com/google/flatbuffers.git +cd flatbuffers/ +git checkout v23.5.26 +mkdir build && cd build +cmake .. -DFLATBUFFERS_BUILD_SHAREDLIB=ON -DFLATBUFFERS_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr +make +sudo make install +``` + + Next, you'll need to clone the [Tensorflow Repo](https://github.com/tensorflow/tensorflow) at the desired checkout (using TF head isn't advised). If you are planning to use libcoral or pycoral libraries, this should match the ones in those repos' WORKSPACE files. For example, if you are using TF 2.17, we can check that [tag in the TF Repo](https://github.com/tensorflow/tensorflow/tree/r2.15) get the latest commit for that stable release and then checkout that address: ``` git clone https://github.com/tensorflow/tensorflow git checkout v2.17.0 ``` -To build the library: +To build the library for Debian/Ubuntu: +``` +TFROOT=/ LD_LIBRARY_PATH=/usr/local/lib/ make -f makefile_build/Makefile libedgetpu-throttled +TFROOT=/ LD_LIBRARY_PATH=/usr/local/lib/ make -f makefile_build/Makefile libedgetpu-throttled +debuild -us -uc -tc -b -a amd64 -d +``` + +To build the library for MacOS: ``` TFROOT= make -f makefile_build/Makefile -j$(nproc) libedgetpu ``` From 7a23e51658a5a6b643cc83239f8150dc939d50c9 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Tue, 1 Oct 2024 11:34:31 -0400 Subject: [PATCH 18/36] Added support for TF 2.18.0-rc0 --- debian/changelog | 3 +++ workspace.bzl | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4e37774..cebfa72 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,6 @@ +libedgetpu (16.0tf2.18.0rc0-1) stable; urgency=medium + * Build against TF v2.18.0-rc0 +-- Nicola Ferralis Tue, 01 Oct 2024 11:33:39 -0400 libedgetpu (16.0tf2.17.0-1) stable; urgency=medium * Build against TF v2.17.0 -- Nicola Ferralis < feranick@hotmail.com> Fri, 12 Jul 2024 09:41:18 -0400 diff --git a/workspace.bzl b/workspace.bzl index fca33ee..34abfc8 100644 --- a/workspace.bzl +++ b/workspace.bzl @@ -50,8 +50,12 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") #TENSORFLOW_SHA256 = "fe592915c85d1a89c20f3dd89db0772ee22a0fbda78e39aa46a778d638a96abc" # TF release 2.17.0 as of 07/12/2024. -TENSORFLOW_COMMIT = "ad6d8cc177d0c868982e39e0823d0efbfb95f04c" -TENSORFLOW_SHA256 = "75b8dc9b33afff6f2e2d2e2dacc26dd0973bdcee94eec2af290828c1bc574bdc" +#TENSORFLOW_COMMIT = "ad6d8cc177d0c868982e39e0823d0efbfb95f04c" +#TENSORFLOW_SHA256 = "75b8dc9b33afff6f2e2d2e2dacc26dd0973bdcee94eec2af290828c1bc574bdc" + +# TF release 2.18.0-rc0 as of 09/30/2024. +TENSORFLOW_COMMIT = "4b55ed05d34b5be52067e450a2876d656f5ca7d801" +TENSORFLOW_SHA256 = "8e219d51dcc846c983188bfb6a2a3b8113507d269e71c88a81d0ffbcfa3e4880" #CORAL_CROSSTOOL_COMMIT = "6bcc2261d9fc60dff386b557428d98917f0af491" #CORAL_CROSSTOOL_SHA256 = "38cb4da13009d07ebc2fed4a9d055b0f914191b344dd2d1ca5803096343958b4" From 3347dd6d15fb8d9d7558e915b628f4fc814edfe7 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Tue, 1 Oct 2024 11:37:47 -0400 Subject: [PATCH 19/36] Updated Software sources for Docker-windows --- docker/Dockerfile.windows | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile.windows b/docker/Dockerfile.windows index 307912c..cf85092 100644 --- a/docker/Dockerfile.windows +++ b/docker/Dockerfile.windows @@ -41,7 +41,7 @@ RUN 7z.exe x -y c:\windows\temp\patch-$env:PATCH_VERSION-x86_64.pkg.tar.xz RUN 7z.exe x -y c:\patch-$env:PATCH_VERSION-x86_64.pkg.tar -o"c:\\msys64" # Install vim (for xxd) -ARG VIM_VERSION=9.1.0643-1 +ARG VIM_VERSION=9.1.0707-1 ADD http://repo.msys2.org/msys/x86_64/vim-${VIM_VERSION}-x86_64.pkg.tar.zst c:/windows/temp RUN 7z.exe x -y c:\windows\temp\vim-$env:VIM_VERSION-x86_64.pkg.tar.zst RUN 7z.exe x -y c:\vim-$env:VIM_VERSION-x86_64.pkg.tar -o"c:\\msys64" From 242f25828119c53695942b4db8102652ff2e92ad Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Tue, 1 Oct 2024 11:56:45 -0400 Subject: [PATCH 20/36] Bug fix --- workspace.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace.bzl b/workspace.bzl index 34abfc8..90243db 100644 --- a/workspace.bzl +++ b/workspace.bzl @@ -54,7 +54,7 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") #TENSORFLOW_SHA256 = "75b8dc9b33afff6f2e2d2e2dacc26dd0973bdcee94eec2af290828c1bc574bdc" # TF release 2.18.0-rc0 as of 09/30/2024. -TENSORFLOW_COMMIT = "4b55ed05d34b5be52067e450a2876d656f5ca7d801" +TENSORFLOW_COMMIT = "4b55ed05d34b5be52067e450a2876d656f5ca7d8" TENSORFLOW_SHA256 = "8e219d51dcc846c983188bfb6a2a3b8113507d269e71c88a81d0ffbcfa3e4880" #CORAL_CROSSTOOL_COMMIT = "6bcc2261d9fc60dff386b557428d98917f0af491" From b281c5510744069a78a18f1c5753c85badd59f30 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Sun, 6 Oct 2024 21:20:23 -0400 Subject: [PATCH 21/36] Update building only with a Makefile --- makefile_build/Makefile | 18 +++++++----------- makefile_build/README.md | 30 ++++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/makefile_build/Makefile b/makefile_build/Makefile index 20f740e..fc1893a 100644 --- a/makefile_build/Makefile +++ b/makefile_build/Makefile @@ -140,7 +140,9 @@ LIBEDGETPU_CCSRCS := \ $(BUILDROOT)/tflite/edgetpu_c.cc \ $(BUILDROOT)/tflite/edgetpu_delegate_for_custom_op.cc \ $(BUILDROOT)/tflite/edgetpu_delegate_for_custom_op_tflite_plugin.cc \ - $(TFROOT)/tensorflow/lite/util.cc + $(TFROOT)/tensorflow/lite/core/c/common.cc \ + $(TFROOT)/tensorflow/lite/util.cc \ + $(TFROOT)/tensorflow/lite/array.cc LIBEDGETPU_CCOBJS := $(call TOBUILDDIR,$(patsubst %.cc,%.o,$(LIBEDGETPU_CCSRCS))) # In order to support direct and throttled mode - we need to compile two files @@ -180,12 +182,6 @@ firmware: done @echo "} // namespace" >> $(LIBEDGETPU_FW_OUTPUT) - -$(LIBEDGETPU_COBJS) : $(BUILDDIR)/%.o: %.c - @$(MKDIR) - @echo "Compiling $<" - @$(CC) $(LIBEDGETPU_CFLAGS) $(LIBEDGETPU_INCLUDES) -c $< -MD -MT $@ -MF $(@:%o=%d) -o $@ - $(LIBEDGETPU_CCOBJS) : $(BUILDDIR)/%.o: %.cc @$(MKDIR) @echo "Compiling $<" @@ -201,14 +197,14 @@ $(LIBEDGETPU_STD_CCOBJS) : $(BUILDDIR)/%-throttled.o: %.cc @echo "Compiling $<" @$(CXX) -DTHROTTLE_EDGE_TPU $(LIBEDGETPU_CXXFLAGS) $(LIBEDGETPU_INCLUDES) -c $< -MD -MT $@ -MF $(@:%o=%d) -o $@ -libedgetpu: | firmware $(LIBEDGETPU_FLATC_OBJS) $(LIBEDGETPU_COBJS) $(LIBEDGETPU_CCOBJS) $(LIBEDGETPU_MAX_CCOBJS) +libedgetpu: | firmware $(LIBEDGETPU_FLATC_OBJS) $(LIBEDGETPU_CCOBJS) $(LIBEDGETPU_MAX_CCOBJS) @mkdir -p $(BUILDDIR)/direct/k8 @echo "Building libedgetpu.so" - @$(CXX) $(LIBEDGETPU_CCFLAGS) $(LIBEDGETPU_LDFLAGS) $(LIBEDGETPU_COBJS) $(LIBEDGETPU_CCOBJS) $(LIBEDGETPU_MAX_CCOBJS) -o $(BUILDDIR)/direct/k8/libedgetpu.so.1.0 + @$(CXX) $(LIBEDGETPU_CCFLAGS) $(LIBEDGETPU_LDFLAGS) ${LDFLAGS} $(LIBEDGETPU_CCOBJS) $(LIBEDGETPU_MAX_CCOBJS) -o $(BUILDDIR)/direct/k8/libedgetpu.so.1.0 @ln -sf $(BUILDDIR)/direct/k8/libedgetpu.so.1.0 $(BUILDDIR)/direct/k8/libedgetpu.so.1 -libedgetpu-throttled: | firmware $(LIBEDGETPU_FLATC_OBJS) $(LIBEDGETPU_COBJS) $(LIBEDGETPU_CCOBJS) $(LIBEDGETPU_STD_CCOBJS) +libedgetpu-throttled: | firmware $(LIBEDGETPU_FLATC_OBJS) $(LIBEDGETPU_CCOBJS) $(LIBEDGETPU_STD_CCOBJS) @mkdir -p $(BUILDDIR)/throttled/k8 @echo "Building throttled libedgetpu.so" - @$(CXX) $(LIBEDGETPU_CCFLAGS) $(LIBEDGETPU_LDFLAGS) $(LIBEDGETPU_COBJS) $(LIBEDGETPU_CCOBJS) $(LIBEDGETPU_STD_CCOBJS) -o $(BUILDDIR)/throttled/k8/libedgetpu.so.1.0 + @$(CXX) $(LIBEDGETPU_CCFLAGS) $(LIBEDGETPU_LDFLAGS) ${LDFLAGS} $(LIBEDGETPU_CCOBJS) $(LIBEDGETPU_STD_CCOBJS) -o $(BUILDDIR)/throttled/k8/libedgetpu.so.1.0 @ln -sf $(BUILDDIR)/throttled/k8/libedgetpu.so.1.0 $(BUILDDIR)/throttled/k8/libedgetpu.so.1 diff --git a/makefile_build/README.md b/makefile_build/README.md index c48a28e..8bcfea9 100644 --- a/makefile_build/README.md +++ b/makefile_build/README.md @@ -2,18 +2,40 @@ If only building for native systems, it is possible to significantly reduce the complexity of the build by removing Bazel (and Docker). This simple approach builds only what is needed, removes build-time depenency fetching, increases the speed, and uses upstream Debian packages. -To prepare your system, you'll need the following packages (both available on Debian Bullseye): +To prepare your system, you'll need the following packages (both available on Debian Bookworm / Ubuntu 22.04): ``` -sudo apt install libabsl-dev libflatbuffers-dev +sudo apt install libabsl-dev libusb-1.0-0-dev xxd ``` -Next, you'll need to clone the [Tensorflow Repo](https://github.com/tensorflow/tensorflow) at the desired checkout (using TF head isn't advised). If you are planning to use libcoral or pycoral libraries, this should match the ones in those repos' WORKSPACE files. For example, if you are using TF2.17.0, we can check that [tag in the TF Repo](https://github.com/tensorflow/tensorflow/commit/ad6d8cc177d0c868982e39e0823d0efbfb95f04c) and then checkout that address: +Next, build [FlatBuffers](https://github.com/google/flatbuffers) from source. This is because the version of Flatbuffers provided in the package is different from the version required by TensorFlow v2.16.1. + +``` +git clone https://github.com/google/flatbuffers.git +cd flatbuffers/ +git checkout v23.5.26 +mkdir build && cd build +cmake .. \ + -DFLATBUFFERS_BUILD_SHAREDLIB=ON \ + -DFLATBUFFERS_BUILD_TESTS=OFF \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr/local +make -j$(nproc) +sudo make install +``` + +Next, you'll need to clone the [Tensorflow Repo](https://github.com/tensorflow/tensorflow) at the desired checkout (using TF head isn't advised). If you are planning to use libcoral or pycoral libraries, this should match the ones in those repos' WORKSPACE files. For example, if you are using TF2.16.1, we can check that [tag in the TF Repo](https://github.com/tensorflow/tensorflow/tree/v2.16.1) and then checkout that address: + ``` git clone https://github.com/tensorflow/tensorflow +cd tensorflow git checkout v2.17.0 ``` To build the library: +Note: The `LDFLAGS` flag is required if you specify flatbuffers to be installed to `"/usr/local"`. + ``` -TFROOT= make -j$(nproc) libedgetpu +git clone https://github.com/google-coral/libedgetpu.git +cd libedgetpu/makefile_build +TFROOT=/home/pi/tensorflow/ LDFLAGS="-L/usr/local/lib" make -j$(nproc) libedgetpu ``` From b68ae6862fb7cab4bf4808520fb2b76bd08eb410 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Mon, 28 Oct 2024 18:21:57 -0400 Subject: [PATCH 22/36] Added support for Tensorflow 2.17.1 --- debian/changelog | 6 +++--- workspace.bzl | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index cebfa72..4e4ab94 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ -libedgetpu (16.0tf2.18.0rc0-1) stable; urgency=medium - * Build against TF v2.18.0-rc0 --- Nicola Ferralis Tue, 01 Oct 2024 11:33:39 -0400 +libedgetpu (16.0tf2.17.1-1) stable; urgency=medium + * Build against TF v2.17.1 +-- Nicola Ferralis Mon, 24 Oct 2024 11:33:39 -0ß400 libedgetpu (16.0tf2.17.0-1) stable; urgency=medium * Build against TF v2.17.0 -- Nicola Ferralis < feranick@hotmail.com> Fri, 12 Jul 2024 09:41:18 -0400 diff --git a/workspace.bzl b/workspace.bzl index 90243db..137cee2 100644 --- a/workspace.bzl +++ b/workspace.bzl @@ -53,9 +53,13 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") #TENSORFLOW_COMMIT = "ad6d8cc177d0c868982e39e0823d0efbfb95f04c" #TENSORFLOW_SHA256 = "75b8dc9b33afff6f2e2d2e2dacc26dd0973bdcee94eec2af290828c1bc574bdc" -# TF release 2.18.0-rc0 as of 09/30/2024. -TENSORFLOW_COMMIT = "4b55ed05d34b5be52067e450a2876d656f5ca7d8" -TENSORFLOW_SHA256 = "8e219d51dcc846c983188bfb6a2a3b8113507d269e71c88a81d0ffbcfa3e4880" +# TF release 2.17.1 as of 10/24/2024. +ßTENSORFLOW_COMMIT = "3c92ac03cab816044f7b18a86eb86aa01a294d95" +TENSORFLOW_SHA256 = "317dd95c4830a408b14f3e802698eb68d70d81c7c7cfcd3d28b0ba023fe84a68" + +# TF release 2.18.0 as of 10/24/2024. +#TENSORFLOW_COMMIT = "6550e4bd80223cdb8be6c3afd1f81e86a4d433c3" +#TENSORFLOW_SHA256 = "403916fbcfcbd5657cd891a871debc72433d7a8c56760297a79085e1abc8f18a" #CORAL_CROSSTOOL_COMMIT = "6bcc2261d9fc60dff386b557428d98917f0af491" #CORAL_CROSSTOOL_SHA256 = "38cb4da13009d07ebc2fed4a9d055b0f914191b344dd2d1ca5803096343958b4" From 2dc1461151a36b2f63db18898fa573e2e7bf68a5 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Mon, 28 Oct 2024 18:24:29 -0400 Subject: [PATCH 23/36] Updated README.md --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 21c7a58..0d65d54 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,9 @@ debuild -us -uc -tc -b -a amd64 -d ``` ### Bazel -The version of `bazel` needs to be the same as that recommended for the corresponding version of tensorflow. For example, it requires `Bazel 6.5.0` to compile TF 2.17.0. +The version of `bazel` needs to be the same as that recommended for the corresponding version of tensorflow. For example, it requires `Bazel 6.5.0` to compile TF 2.17.1. -The current version of Tensorflow supported is `2.17.0`. +The current version of Tensorflow supported is `2.17.1`. Build native binaries on Linux and macOS: ``` @@ -99,10 +99,10 @@ sudo make install ``` -Next, you'll need to clone the [Tensorflow Repo](https://github.com/tensorflow/tensorflow) at the desired checkout (using TF head isn't advised). If you are planning to use libcoral or pycoral libraries, this should match the ones in those repos' WORKSPACE files. For example, if you are using TF 2.17, we can check that [tag in the TF Repo](https://github.com/tensorflow/tensorflow/tree/r2.15) get the latest commit for that stable release and then checkout that address: +Next, you'll need to clone the [Tensorflow Repo](https://github.com/tensorflow/tensorflow) at the desired checkout (using TF head isn't advised). If you are planning to use libcoral or pycoral libraries, this should match the ones in those repos' WORKSPACE files. For example, if you are using TF 2.17.1, we can check that [tag in the TF Repo](https://github.com/tensorflow/tensorflow/tree/r2.15) get the latest commit for that stable release and then checkout that address: ``` git clone https://github.com/tensorflow/tensorflow -git checkout v2.17.0 +git checkout v2.17.1 ``` To build the library for Debian/Ubuntu: @@ -140,3 +140,4 @@ Google does not accept any responsibility for any loss or damage if the device is operated outside of the recommended ambient temperature range. Note: This issue affects only USB-based Coral devices, and is irrelevant for PCIe devices. +ß From ba7db819f7958eff00e94148b6d749e2ef23a1fe Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Mon, 28 Oct 2024 18:26:41 -0400 Subject: [PATCH 24/36] Typo fix. --- workspace.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace.bzl b/workspace.bzl index 137cee2..bbda68e 100644 --- a/workspace.bzl +++ b/workspace.bzl @@ -54,7 +54,7 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") #TENSORFLOW_SHA256 = "75b8dc9b33afff6f2e2d2e2dacc26dd0973bdcee94eec2af290828c1bc574bdc" # TF release 2.17.1 as of 10/24/2024. -ßTENSORFLOW_COMMIT = "3c92ac03cab816044f7b18a86eb86aa01a294d95" +TENSORFLOW_COMMIT = "3c92ac03cab816044f7b18a86eb86aa01a294d95" TENSORFLOW_SHA256 = "317dd95c4830a408b14f3e802698eb68d70d81c7c7cfcd3d28b0ba023fe84a68" # TF release 2.18.0 as of 10/24/2024. From ea190a7f983e7d8588248081b1dde3aa0a5ad789 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Mon, 28 Oct 2024 21:25:27 -0400 Subject: [PATCH 25/36] Typo fix --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 4e4ab94..b3fdf55 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ libedgetpu (16.0tf2.17.1-1) stable; urgency=medium * Build against TF v2.17.1 --- Nicola Ferralis Mon, 24 Oct 2024 11:33:39 -0ß400 +-- Nicola Ferralis Mon, 24 Oct 2024 11:33:39 -0400 libedgetpu (16.0tf2.17.0-1) stable; urgency=medium * Build against TF v2.17.0 -- Nicola Ferralis < feranick@hotmail.com> Fri, 12 Jul 2024 09:41:18 -0400 From bf2a7fdcd5cbc657265413533abffd224a525f94 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Tue, 29 Oct 2024 10:57:24 -0400 Subject: [PATCH 26/36] Update README.md with info about MacOS cross-compilation --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 0d65d54..dc5d55b 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,12 @@ $ CPU=armv7a make $ CPU=aarch64 make ``` +Cross-compile for Apple Silicon (arm64), or Intel (x86_64) on MacOS: +``` +$ CPU=darwin_arm64 make +$ CPU=darwin_x86_64 make +``` + To package a Debian deb: ``` debuild -us -uc -tc -b From 8f1cb87c20afdd339429c124cf7d45d3731e41e9 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Tue, 29 Apr 2025 13:20:34 -0400 Subject: [PATCH 27/36] Updated Windows libraries --- docker/Dockerfile.windows | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile.windows b/docker/Dockerfile.windows index cf85092..c51c75d 100644 --- a/docker/Dockerfile.windows +++ b/docker/Dockerfile.windows @@ -28,7 +28,7 @@ RUN choco install -y 7zip RUN setx /M PATH $($Env:PATH + ';C:\Program Files\7-Zip') # Install msys2 -ARG MSYS_VERSION=20240727 +ARG MSYS_VERSION=20250221 ADD http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-${MSYS_VERSION}.tar.xz c:/windows/temp RUN 7z.exe x c:\windows\temp\msys2-base-x86_64-$env:MSYS_VERSION.tar.xz RUN 7z.exe x c:\msys2-base-x86_64-$env:MSYS_VERSION.tar -o"c:\\" @@ -41,13 +41,13 @@ RUN 7z.exe x -y c:\windows\temp\patch-$env:PATCH_VERSION-x86_64.pkg.tar.xz RUN 7z.exe x -y c:\patch-$env:PATCH_VERSION-x86_64.pkg.tar -o"c:\\msys64" # Install vim (for xxd) -ARG VIM_VERSION=9.1.0707-1 +ARG VIM_VERSION=9.1.1236-1 ADD http://repo.msys2.org/msys/x86_64/vim-${VIM_VERSION}-x86_64.pkg.tar.zst c:/windows/temp RUN 7z.exe x -y c:\windows\temp\vim-$env:VIM_VERSION-x86_64.pkg.tar.zst RUN 7z.exe x -y c:\vim-$env:VIM_VERSION-x86_64.pkg.tar -o"c:\\msys64" # Install libusb release package -ARG LIBUSB_VERSION=1.0.27 +ARG LIBUSB_VERSION=1.0.28 ADD https://github.com/libusb/libusb/releases/download/v${LIBUSB_VERSION}/libusb-${LIBUSB_VERSION}.7z c:/windows/temp RUN 7z x -oc:\libusb c:\windows\temp\libusb-$env:LIBUSB_VERSION.7z From aa9ae6c1b3718a63dcf51f30ceacc994a70af4f6 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Fri, 5 Sep 2025 11:04:03 -0400 Subject: [PATCH 28/36] Removed software-properties-common No longer available in trixie and not needed in previous versions --- docker/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 0fcbcb4..9979c31 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -45,7 +45,6 @@ RUN apt-get update \ wget \ git \ tree \ - software-properties-common \ $(grep Ubuntu /etc/os-release > /dev/null && echo vim-common || echo xxd) # Bionic Beaver == Ubuntu 18.04 From 71a5dfb97deaa547df6f386c4bc79f01c1962ea8 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Fri, 5 Sep 2025 11:10:46 -0400 Subject: [PATCH 29/36] Update Windows build libraries --- docker/Dockerfile.windows | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile.windows b/docker/Dockerfile.windows index c51c75d..b5c7fe7 100644 --- a/docker/Dockerfile.windows +++ b/docker/Dockerfile.windows @@ -28,26 +28,26 @@ RUN choco install -y 7zip RUN setx /M PATH $($Env:PATH + ';C:\Program Files\7-Zip') # Install msys2 -ARG MSYS_VERSION=20250221 +ARG MSYS_VERSION=20250830 ADD http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-${MSYS_VERSION}.tar.xz c:/windows/temp RUN 7z.exe x c:\windows\temp\msys2-base-x86_64-$env:MSYS_VERSION.tar.xz RUN 7z.exe x c:\msys2-base-x86_64-$env:MSYS_VERSION.tar -o"c:\\" RUN setx /M PATH $($Env:PATH + ';C:\msys64\usr\bin') # Install patch -ARG PATCH_VERSION=2.7.6-2 +ARG PATCH_VERSION=2.7.6-3 ADD http://repo.msys2.org/msys/x86_64/patch-${PATCH_VERSION}-x86_64.pkg.tar.xz c:/windows/temp RUN 7z.exe x -y c:\windows\temp\patch-$env:PATCH_VERSION-x86_64.pkg.tar.xz RUN 7z.exe x -y c:\patch-$env:PATCH_VERSION-x86_64.pkg.tar -o"c:\\msys64" # Install vim (for xxd) -ARG VIM_VERSION=9.1.1236-1 +ARG VIM_VERSION=9.1.1730-1 ADD http://repo.msys2.org/msys/x86_64/vim-${VIM_VERSION}-x86_64.pkg.tar.zst c:/windows/temp RUN 7z.exe x -y c:\windows\temp\vim-$env:VIM_VERSION-x86_64.pkg.tar.zst RUN 7z.exe x -y c:\vim-$env:VIM_VERSION-x86_64.pkg.tar -o"c:\\msys64" # Install libusb release package -ARG LIBUSB_VERSION=1.0.28 +ARG LIBUSB_VERSION=1.0.29 ADD https://github.com/libusb/libusb/releases/download/v${LIBUSB_VERSION}/libusb-${LIBUSB_VERSION}.7z c:/windows/temp RUN 7z x -oc:\libusb c:\windows\temp\libusb-$env:LIBUSB_VERSION.7z From 266f54241aea2191a66ea86015966ed272d6822b Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Fri, 5 Sep 2025 13:41:20 -0400 Subject: [PATCH 30/36] Added support for Debian Trixie --- docker/Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 9979c31..450f821 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -47,6 +47,15 @@ RUN apt-get update \ tree \ $(grep Ubuntu /etc/os-release > /dev/null && echo vim-common || echo xxd) +# Debian Trixie +RUN if grep 'trixie' /etc/os-release > /dev/null; then \ + DEBIAN_FRONTEND=noninteractive apt-get install -y \ + binutils-gold \ + binutils-gold-aarch64-linux-gnu \ + binutils-gold-arm-linux-gnueabihf \ + && export TF_PYTHON_VERSION=3.13; \ + fi + # Bionic Beaver == Ubuntu 18.04 RUN if grep 'Bionic Beaver' /etc/os-release > /dev/null; then \ add-apt-repository ppa:ubuntu-toolchain-r/test \ From 277c2710492565b3d2550eb9ac1ad3f93e9827d4 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Fri, 5 Sep 2025 14:02:16 -0400 Subject: [PATCH 31/36] Added links for recent TF versions --- workspace.bzl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/workspace.bzl b/workspace.bzl index bbda68e..f1034b1 100644 --- a/workspace.bzl +++ b/workspace.bzl @@ -61,6 +61,22 @@ TENSORFLOW_SHA256 = "317dd95c4830a408b14f3e802698eb68d70d81c7c7cfcd3d28b0ba023fe #TENSORFLOW_COMMIT = "6550e4bd80223cdb8be6c3afd1f81e86a4d433c3" #TENSORFLOW_SHA256 = "403916fbcfcbd5657cd891a871debc72433d7a8c56760297a79085e1abc8f18a" +# TF release 2.18.1 as of 03/07/2025. +#TENSORFLOW_COMMIT = "cb64295ec7308f770b22db6047a1e755b35b7bee" +#TENSORFLOW_SHA256 = "5fcca4ec0732e146547fc26f6966cf92236c2f85a9e086b85c83d303e2c38980" + +# TF release 2.19.0 as of 03/05/2025. +#TENSORFLOW_COMMIT = "e36baa302922ea3c7131b302c2996bd2051ee5c4" +#TENSORFLOW_SHA256 = "49279646fe4effe3bdc8f5227724566991adc70cf2fd2d22e5591c397db9b037" + +# TF release 2.19.1 as of 08/11/2025. +#TENSORFLOW_COMMIT = "f4247ebb6f9e7421f38c3f01a9a5d5cd54bd24fd" +#TENSORFLOW_SHA256 = "b4cbd03710db2f05a0f4f5f238c496f39e6be34bab1a168e5c0ade1b23d74dfe" + +# TF release 2.20.0 as of 08/06/2025. +#TENSORFLOW_COMMIT = "72fbba3d20f4616d7312b5e2b7f79daf6e82f2fa" +#TENSORFLOW_SHA256 = "86150d55ce57b2298d8ed42caa7b91c466ad33d9f7f347117c2257cc576d3413" + #CORAL_CROSSTOOL_COMMIT = "6bcc2261d9fc60dff386b557428d98917f0af491" #CORAL_CROSSTOOL_SHA256 = "38cb4da13009d07ebc2fed4a9d055b0f914191b344dd2d1ca5803096343958b4" From ea44e12ce0d503931610ae245066cb4a1fe949fb Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Wed, 17 Sep 2025 14:06:11 -0400 Subject: [PATCH 32/36] Add support for Tensorflow 2.18.1 This requires redefining configure_cuda, which was dropped in TF when moving to hermetic CUDA builds. --- patches/BUILD.bazel | 0 patches/add_configure_cuda.diff | 19 +++++++++++++++++++ workspace.bzl | 10 ++++++---- 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 patches/BUILD.bazel create mode 100644 patches/add_configure_cuda.diff diff --git a/patches/BUILD.bazel b/patches/BUILD.bazel new file mode 100644 index 0000000..e69de29 diff --git a/patches/add_configure_cuda.diff b/patches/add_configure_cuda.diff new file mode 100644 index 0000000..1faef8c --- /dev/null +++ b/patches/add_configure_cuda.diff @@ -0,0 +1,19 @@ +diff -Nru org_tensorflow.orig/tensorflow/workspace2.bzl org_tensorflow/tensorflow/workspace2.bzl +--- org_tensorflow.orig/tensorflow/workspace2.bzl 2025-09-17 13:39:35 ++++ org_tensorflow/tensorflow/workspace2.bzl 2025-09-17 13:40:35 +@@ -29,6 +29,7 @@ + load("//third_party/FP16:workspace.bzl", FP16 = "repo") + load("//third_party/gemmlowp:workspace.bzl", gemmlowp = "repo") + load("//third_party/git:git_configure.bzl", "git_configure") ++load("//third_party/gpus:cuda_configure.bzl", "cuda_configure") + load("//third_party/gpus:rocm_configure.bzl", "rocm_configure") + load("//third_party/gpus:sycl_configure.bzl", "sycl_configure") + load("//third_party/hexagon:workspace.bzl", hexagon_nn = "repo") +@@ -104,6 +105,7 @@ + # Note that we check the minimum bazel version in WORKSPACE. + clang6_configure(name = "local_config_clang6") + cc_download_clang_toolchain(name = "local_config_download_clang") ++ cuda_configure(name = "local_config_cuda") + tensorrt_configure(name = "local_config_tensorrt") + git_configure(name = "local_config_git") + syslibs_configure(name = "local_config_syslibs") diff --git a/workspace.bzl b/workspace.bzl index f1034b1..b7d6f2c 100644 --- a/workspace.bzl +++ b/workspace.bzl @@ -54,16 +54,16 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") #TENSORFLOW_SHA256 = "75b8dc9b33afff6f2e2d2e2dacc26dd0973bdcee94eec2af290828c1bc574bdc" # TF release 2.17.1 as of 10/24/2024. -TENSORFLOW_COMMIT = "3c92ac03cab816044f7b18a86eb86aa01a294d95" -TENSORFLOW_SHA256 = "317dd95c4830a408b14f3e802698eb68d70d81c7c7cfcd3d28b0ba023fe84a68" +#TENSORFLOW_COMMIT = "3c92ac03cab816044f7b18a86eb86aa01a294d95" +#TENSORFLOW_SHA256 = "317dd95c4830a408b14f3e802698eb68d70d81c7c7cfcd3d28b0ba023fe84a68" # TF release 2.18.0 as of 10/24/2024. #TENSORFLOW_COMMIT = "6550e4bd80223cdb8be6c3afd1f81e86a4d433c3" #TENSORFLOW_SHA256 = "403916fbcfcbd5657cd891a871debc72433d7a8c56760297a79085e1abc8f18a" # TF release 2.18.1 as of 03/07/2025. -#TENSORFLOW_COMMIT = "cb64295ec7308f770b22db6047a1e755b35b7bee" -#TENSORFLOW_SHA256 = "5fcca4ec0732e146547fc26f6966cf92236c2f85a9e086b85c83d303e2c38980" +TENSORFLOW_COMMIT = "cb64295ec7308f770b22db6047a1e755b35b7bee" +TENSORFLOW_SHA256 = "5fcca4ec0732e146547fc26f6966cf92236c2f85a9e086b85c83d303e2c38980" # TF release 2.19.0 as of 03/05/2025. #TENSORFLOW_COMMIT = "e36baa302922ea3c7131b302c2996bd2051ee5c4" @@ -105,6 +105,8 @@ def libedgetpu_dependencies( ], sha256 = tensorflow_sha256, strip_prefix = "tensorflow-" + tensorflow_commit, + patches = ["//patches:add_configure_cuda.diff"], + patch_args = ["-p1"], ) maybe( From 68b69c11c020d1cedf8b947f23c5812878a784cd Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Wed, 17 Sep 2025 14:17:58 -0400 Subject: [PATCH 33/36] Updated debian/changelog --- debian/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/changelog b/debian/changelog index b3fdf55..3745f25 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,6 @@ +libedgetpu (16.0tf2.18.1-1) stable; urgency=medium + * Build against TF v2.18.1 +-- Nicola Ferralis Mon, 17 Sep 2025 11:33:39 -0400 libedgetpu (16.0tf2.17.1-1) stable; urgency=medium * Build against TF v2.17.1 -- Nicola Ferralis Mon, 24 Oct 2024 11:33:39 -0400 From 2758c06a9d4a6ab021947317ac59bbbc7f437170 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Wed, 17 Sep 2025 14:25:05 -0400 Subject: [PATCH 34/36] Updated version of libusb for windows to version 1.0.29 in Makefile --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6ebba5c..b759fff 100644 --- a/Makefile +++ b/Makefile @@ -49,8 +49,10 @@ endif EDGETPU_RUNTIME_DIR := /tmp/edgetpu_runtime #LIBUSB_URL := https://github.com/libusb/libusb/releases/download/v1.0.24/libusb-1.0.24.7z #LIBUSB_SHA256 := 620cec4dbe4868202949294157da5adb75c9fbb4f04266146fc833eef85f90fb -LIBUSB_URL := https://github.com/libusb/libusb/releases/download/v1.0.27/libusb-1.0.27.7z -LIBUSB_SHA256 := 19835e290f46fab6bd8ce4be6ab7dc5209f1c04bad177065df485e51dc4118c8 +#LIBUSB_URL := https://github.com/libusb/libusb/releases/download/v1.0.27/libusb-1.0.27.7z +#LIBUSB_SHA256 := 19835e290f46fab6bd8ce4be6ab7dc5209f1c04bad177065df485e51dc4118c8 +LIBUSB_URL := https://github.com/libusb/libusb/releases/download/v1.0.29/libusb-1.0.29.7z +LIBUSB_SHA256 := 964a38152ca9a104cd00ec8d2f0617b89cd814f9b635e29763c68563d951521d USBDK_URL := https://github.com/daynix/UsbDk/releases/download/v1.00-22/UsbDk_1.0.22_x64.msi USBDK_SHA256 := 91f6f695e1e13c656024e6d3b55620bf08d8835ef05ee0496935ba6bb62466a5 LIBEDGETPU_BIN ?= $(MAKEFILE_DIR)/out/ From a26a2de7768edd7c0d9b837954026b70b13c72e2 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Wed, 17 Sep 2025 17:12:45 -0400 Subject: [PATCH 35/36] Added support for tensorflow 2.19.1 Uses a local version of the python_version_repo, which in its definitions misses the variable USE_PYWRAP_RULES. --- WORKSPACE | 7 ++++++- debian/changelog | 3 +++ local_repo/python_version_repo/BUILD | 0 local_repo/python_version_repo/WORKSPACE | 2 ++ local_repo/python_version_repo/py_version.bzl | 6 ++++++ workspace.bzl | 8 ++++---- 6 files changed, 21 insertions(+), 5 deletions(-) create mode 100755 local_repo/python_version_repo/BUILD create mode 100644 local_repo/python_version_repo/WORKSPACE create mode 100755 local_repo/python_version_repo/py_version.bzl diff --git a/WORKSPACE b/WORKSPACE index 3d031a4..4f81301 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -47,7 +47,12 @@ load( "python_repository", ) -python_repository(name = "python_version_repo") +#python_repository(name = "python_version_repo") + +local_repository( + name = "python_version_repo", + path = "local_repo/python_version_repo" +) load("@python_version_repo//:py_version.bzl", "HERMETIC_PYTHON_VERSION") diff --git a/debian/changelog b/debian/changelog index 3745f25..e31f458 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,6 @@ +libedgetpu (16.0tf2.19.1-1) stable; urgency=medium + * Build against TF v2.19.1 +-- Nicola Ferralis Mon, 17 Sep 2025 12:34:40 -0400 libedgetpu (16.0tf2.18.1-1) stable; urgency=medium * Build against TF v2.18.1 -- Nicola Ferralis Mon, 17 Sep 2025 11:33:39 -0400 diff --git a/local_repo/python_version_repo/BUILD b/local_repo/python_version_repo/BUILD new file mode 100755 index 0000000..e69de29 diff --git a/local_repo/python_version_repo/WORKSPACE b/local_repo/python_version_repo/WORKSPACE new file mode 100644 index 0000000..e6a1738 --- /dev/null +++ b/local_repo/python_version_repo/WORKSPACE @@ -0,0 +1,2 @@ +# DO NOT EDIT: automatically generated WORKSPACE file for python_repository rule +workspace(name = "python_version_repo") diff --git a/local_repo/python_version_repo/py_version.bzl b/local_repo/python_version_repo/py_version.bzl new file mode 100755 index 0000000..cb93878 --- /dev/null +++ b/local_repo/python_version_repo/py_version.bzl @@ -0,0 +1,6 @@ + +TF_PYTHON_VERSION = "3.12" +HERMETIC_PYTHON_VERSION = "3.12" +WHEEL_NAME = "tensorflow" +WHEEL_COLLAB = "False" +USE_PYWRAP_RULES = "1" diff --git a/workspace.bzl b/workspace.bzl index b7d6f2c..66f6a25 100644 --- a/workspace.bzl +++ b/workspace.bzl @@ -62,16 +62,16 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") #TENSORFLOW_SHA256 = "403916fbcfcbd5657cd891a871debc72433d7a8c56760297a79085e1abc8f18a" # TF release 2.18.1 as of 03/07/2025. -TENSORFLOW_COMMIT = "cb64295ec7308f770b22db6047a1e755b35b7bee" -TENSORFLOW_SHA256 = "5fcca4ec0732e146547fc26f6966cf92236c2f85a9e086b85c83d303e2c38980" +#TENSORFLOW_COMMIT = "cb64295ec7308f770b22db6047a1e755b35b7bee" +#TENSORFLOW_SHA256 = "5fcca4ec0732e146547fc26f6966cf92236c2f85a9e086b85c83d303e2c38980" # TF release 2.19.0 as of 03/05/2025. #TENSORFLOW_COMMIT = "e36baa302922ea3c7131b302c2996bd2051ee5c4" #TENSORFLOW_SHA256 = "49279646fe4effe3bdc8f5227724566991adc70cf2fd2d22e5591c397db9b037" # TF release 2.19.1 as of 08/11/2025. -#TENSORFLOW_COMMIT = "f4247ebb6f9e7421f38c3f01a9a5d5cd54bd24fd" -#TENSORFLOW_SHA256 = "b4cbd03710db2f05a0f4f5f238c496f39e6be34bab1a168e5c0ade1b23d74dfe" +TENSORFLOW_COMMIT = "f4247ebb6f9e7421f38c3f01a9a5d5cd54bd24fd" +TENSORFLOW_SHA256 = "b4cbd03710db2f05a0f4f5f238c496f39e6be34bab1a168e5c0ade1b23d74dfe" # TF release 2.20.0 as of 08/06/2025. #TENSORFLOW_COMMIT = "72fbba3d20f4616d7312b5e2b7f79daf6e82f2fa" From c38ac3f6d67dcb726e5a9339ac54527868c38598 Mon Sep 17 00:00:00 2001 From: Nicola Ferralis Date: Wed, 17 Sep 2025 17:31:50 -0400 Subject: [PATCH 36/36] Updated README --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index dc5d55b..23a26ba 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,9 @@ debuild -us -uc -tc -b -a amd64 -d ``` ### Bazel -The version of `bazel` needs to be the same as that recommended for the corresponding version of tensorflow. For example, it requires `Bazel 6.5.0` to compile TF 2.17.1. +The version of `bazel` needs to be the same as that recommended for the corresponding version of tensorflow. For example, it requires `Bazel 6.5.0` to compile TF 2.19.1. -The current version of Tensorflow supported is `2.17.1`. +The current version of Tensorflow supported is `2.19.1`. Build native binaries on Linux and macOS: ``` @@ -105,10 +105,10 @@ sudo make install ``` -Next, you'll need to clone the [Tensorflow Repo](https://github.com/tensorflow/tensorflow) at the desired checkout (using TF head isn't advised). If you are planning to use libcoral or pycoral libraries, this should match the ones in those repos' WORKSPACE files. For example, if you are using TF 2.17.1, we can check that [tag in the TF Repo](https://github.com/tensorflow/tensorflow/tree/r2.15) get the latest commit for that stable release and then checkout that address: +Next, you'll need to clone the [Tensorflow Repo](https://github.com/tensorflow/tensorflow) at the desired checkout (using TF head isn't advised). If you are planning to use libcoral or pycoral libraries, this should match the ones in those repos' WORKSPACE files. For example, if you are using TF 2.19.1, we can check that [tag in the TF Repo](https://github.com/tensorflow/tensorflow/tree/r2.19) get the latest commit for that stable release and then checkout that address: ``` git clone https://github.com/tensorflow/tensorflow -git checkout v2.17.1 +git checkout v2.19.1 ``` To build the library for Debian/Ubuntu: