Skip to content

Instantly share code, notes, and snippets.

@iwatake2222
Last active January 17, 2022 10:34
Show Gist options
  • Save iwatake2222/3017d9ac3112b27cc9f5011ece993009 to your computer and use it in GitHub Desktop.
Save iwatake2222/3017d9ac3112b27cc9f5011ece993009 to your computer and use it in GitHub Desktop.
How to generate tensorflowlite.dll for Visual Studio (Windows)
# On Git Bash
cd path-to-tensorflow
git checkout 00cb358ab2e67d0b06a21901ded13c57fd47e673
./tensorflow/lite/tools/make/download_dependencies.sh
nano tensorflow/lite/build_def.bzl
###
# --- a/tensorflow/lite/build_def.bzl
# +++ b/tensorflow/lite/build_def.bzl
# @@ -159,6 +159,7 @@ def tflite_cc_shared_object(
# tf_cc_shared_object(
# name = name,
# copts = copts,
# + features = ["windows_export_all_symbols"],
# linkstatic = linkstatic,
# linkopts = linkopts + tflite_jni_linkopts(),
# framework_so = [],
###
# On Anaconda Powershell prompt (Miniconda3)
conda create -n build_tflite
conda activate build_tflite
conda install python
conda install numpy
cd path-to-tensorflow
python configure.py
bazel build -c opt //tensorflow/lite:tensorflowlite
ls ./bazel-bin/tensorflow/lite/tensorflowlite.dll
- Windows 10
- Visual Studio 2017
- Bazel
- bazel-1.2.1-windows-x86_64.zip
- Add path to bazel.exe
- Python 3.8.1 (on Miniconda)
@iwatake2222
Copy link
Author

It's weird, the lib file should be generated automatically.
Did you use the same commit id as my sample? If not, the build script might changed.

By the way, you can actually create the lib file from DLL using dumpbin and lib commands in Developer Command Prompt for VS 20xx.

@PharrellWANG
Copy link

It's weird, the lib file should be generated automatically.
Did you use the same commit id as my sample? If not, the build script might changed.

By the way, you can actually create the lib file from DLL using dumpbin and lib commands in Developer Command Prompt for VS 20xx.

  1. The same commit id was used in my trial.
  2. The tip of creating lib from dll is so helpful.

Thanks a lot, iwatake!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment