Skip to content

Instantly share code, notes, and snippets.

@petewarden
petewarden / ..build-protobuf-3.0.0.md
Last active September 27, 2022 08:19 — forked from BennettSmith/..build-protbuf-2.5.0.md
Script used to build Google Protobuf 3.0.0 for use with Xcode 7 / iOS 9. Builds all supported architectures and produces a universal binary static library.

Google Protobuf 3.0.1 - Mac OS X and iOS Support

The script in this gist will help you buid the Google Protobuf library for use with Mac OS X and iOS. Other methods (such as homebrew or direct compilation) have issues that prevent their use. The libraries built by this script are universal and support all iOS device architectures including the simulator.

This gist was adapted from the original at https://gist.github.com/BennettSmith/7150245, and updated to deal with Xcode 7 and iOS 9, and download protobuf version 3.0.0.

mkdir ~/projects
cd ~/projects
git clone --recurse-submodules https://github.com/petewarden/tensorflow_ios.git tensorflow_ios
cd tensorflow_ios
mkdir tools
mkdir tools/objc
echo '
filegroup(
name = "default_provisioning_profile",
srcs = ["default_provisioning_profile.mobileprovision"],
#!/bin/bash
# Script for building TensorFlow and its dependencies on the Nvidia TX1. Based on
# https://github.com/neo-titans/odroid
sudo apt-get install -y curl openjdk-8-jdk swig python3-numpy python3-dev swig zlib1g-dev
git clone https://github.com/neo-titans/odroid
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo apt-get install -y curl openjdk-8-jdk swig python3-numpy python3-dev python3 python-virtualenv python3-virtualenv swig zlib1g-dev
cd ~
mkdir projects
virtualenv -p python3 --system-site-packages projects
cd ~/projects
git clone https://github.com/neo-titans/odroid
sudo fallocate -l 1G /swapfile
git clone https://github.com/ebrevdo/tensorflow tensorflow_ebrevdo
cd tensorflow_ebrevdo
docker build -t "tf-pi" -f tensorflow/tools/ci_build/Dockerfile.cpu tensorflow/tools/ci_build/
docker run -it tf-pi
# All commands after this are run on the Docker instance.
git clone https://github.com/ebrevdo/tensorflow
sudo dpkg --add-architecture armhf
echo "deb [arch=armhf] http://ports.ubuntu.com/ trusty main universe" \
sudo tee -a /etc/apt/sources.list.d/armhf.list
sudo apt-get update
git clone https://github.com/tensorflow/tensorflow tensorflow
cd tensorflow
docker build -t "tf-pi" -f tensorflow/tools/ci_build/Dockerfile.cpu tensorflow/tools/ci_build/
docker run -it tf-pi
# Commands after this are run on the Docker instance.
dpkg --add-architecture armhf
echo 'deb [arch=armhf] http://ports.ubuntu.com/ trusty main restricted universe multiverse' >> /etc/apt/sources.list.d/armhf.list
echo 'deb [arch=armhf] http://ports.ubuntu.com/ trusty-updates main restricted universe multiverse' >> /etc/apt/sources.list.d/armhf.list
echo 'deb [arch=armhf] http://ports.ubuntu.com/ trusty-security main restricted universe multiverse' >> /etc/apt/sources.list.d/armhf.list
echo 'deb [arch=armhf] http://ports.ubuntu.com/ trusty-backports main restricted universe multiverse' >> /etc/apt/sources.list.d/armhf.list
allprojects {
repositories {
jcenter()
}
}
dependencies {
compile 'org.tensorflow:tensorflow-android:+'
}
android_sdk_repository(
name = "androidsdk",
api_level = 23,
build_tools_version = "23.0.2",
path = "/home/petewarden/android-sdk-linux/",
)
android_ndk_repository(
name="androidndk",
path="/home/petewarden/android-ndk-r10e/",
api_level=19)
bazel build -c opt //tensorflow/examples/android:tensorflow_demo
bazel build tensorflow/examples/android:tensorflow_demo
adb install -r \
bazel-bin/tensorflow/examples/android/tensorflow_demo.apk