Skip to content

Instantly share code, notes, and snippets.

@sigma-andex
Created January 24, 2022 10:22
Show Gist options
  • Save sigma-andex/9888586a676d2d9ee2ed24cf5bcc1f20 to your computer and use it in GitHub Desktop.
Save sigma-andex/9888586a676d2d9ee2ed24cf5bcc1f20 to your computer and use it in GitHub Desktop.
tensorflow 2.7.0 applle m1 rust

Build tensorflow 2.7.0

bazel build --compilation_mode=opt --jobs=4 --config=macos_arm64 tensorflow:libtensorflow.so
bazel build --compilation_mode=opt --jobs=4 --config=macos_arm64 tensorflow/tools/lib_package:libtensorflow

Export variables

export TF_VERSION=v2.7.0
export PKG_CONFIG_PATH=$HOME/.pkg-config
export LD_LIBRARY_PATH=:/usr/local/lib
export LIBRARY_PATH=$HOME/.tensorflow/lib

Put build files in place

➜ ls $HOME/.tensorflow/lib
libtensorflow.2.7.0.dylib           libtensorflow.so.2.7.0
libtensorflow.2.dylib               libtensorflow.so.2.7.0-2.params
libtensorflow.dylib                 libtensorflow_framework.2.7.0.dylib
libtensorflow.so                    libtensorflow_framework.2.dylib
libtensorflow.so.2                  libtensorflow_framework.dylib


➜ ls $HOME/.pkg-config
tensorflow.pc

build

cargo build --target aarch64-apple-darwin -j 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment