From dd02edce8bc87733de0623e3ad31fd874c2e4b1d Mon Sep 17 00:00:00 2001 From: Karim Nosir Date: Fri, 14 Feb 2020 16:05:56 -0800 Subject: [PATCH] Update build commands Tested: bazel build -c opt --fat_apk_cpu=x86,x86_64,arm64-v8a,armeabi-v7a //tensorflow/lite/java:tensorflow-lite With NDK r17c PiperOrigin-RevId: 295248025 Change-Id: Ice7895ffb5ef53f5885532fdf66ae6ee9d012892 --- tensorflow/lite/c/README.md | 2 +- .../examples/unity/TensorFlowLitePlugin/README.md | 5 ++--- tensorflow/lite/g3doc/guide/android.md | 3 +-- tensorflow/lite/g3doc/guide/ops_select.md | 4 ++-- tensorflow/lite/java/BUILD | 2 +- tensorflow/lite/java/build_aar_for_release.sh | 2 +- tensorflow/lite/java/demo/README.md | 3 +-- tensorflow/lite/java/ovic/README.md | 8 ++++---- tensorflow/lite/tools/accuracy/ilsvrc/README.md | 1 - tensorflow/lite/tools/benchmark/android/README.md | 1 - .../evaluation/tasks/coco_object_detection/README.md | 1 - .../tasks/imagenet_image_classification/README.md | 1 - tensorflow/lite/tools/make/Makefile | 1 - tensorflow/lite/tools/pip_package/setup.py | 1 - 14 files changed, 13 insertions(+), 22 deletions(-) diff --git a/tensorflow/lite/c/README.md b/tensorflow/lite/c/README.md index 06579199393..7b1f806a115 100644 --- a/tensorflow/lite/c/README.md +++ b/tensorflow/lite/c/README.md @@ -30,7 +30,7 @@ provided. Assuming a working [bazel](https://bazel.build/versions/master/docs/in configuration, this can be built as follows: ```sh -bazel build -c opt --cxxopt=--std=c++11 //tensorflow/lite/c:tensorflowlite_c +bazel build -c opt //tensorflow/lite/c:tensorflowlite_c ``` and for Android (replace `android_arm` with `android_arm64` for 64-bit), diff --git a/tensorflow/lite/experimental/examples/unity/TensorFlowLitePlugin/README.md b/tensorflow/lite/experimental/examples/unity/TensorFlowLitePlugin/README.md index cbd1d016b83..107a59b1693 100644 --- a/tensorflow/lite/experimental/examples/unity/TensorFlowLitePlugin/README.md +++ b/tensorflow/lite/experimental/examples/unity/TensorFlowLitePlugin/README.md @@ -9,14 +9,13 @@ Plugin, and placed in Assets/TensorFlowLite/SDK/Plugins/. For the editor (note that the generated shared library name and suffix are platform-dependent): ```sh -bazel build -c opt --cxxopt=--std=c++11 //tensorflow/lite/c:tensorflowlite_c +bazel build -c opt //tensorflow/lite/c:tensorflowlite_c ``` and for Android (replace `android_arm` with `android_arm64` for 64-bit): ```sh -bazel build -c opt --cxxopt=--std=c++11 --config=android_arm \ - //tensorflow/lite/c:tensorflowlite_c +bazel build -c opt --config=android_arm //tensorflow/lite/c:tensorflowlite_c ``` If you encounter issues with native plugin discovery on Mac ("Darwin") diff --git a/tensorflow/lite/g3doc/guide/android.md b/tensorflow/lite/g3doc/guide/android.md index 0a52cc7afe8..8e9207c683c 100644 --- a/tensorflow/lite/g3doc/guide/android.md +++ b/tensorflow/lite/g3doc/guide/android.md @@ -144,8 +144,7 @@ Once Bazel is properly configured, you can build the TensorFlow Lite AAR from the root checkout directory as follows: ```sh -bazel build --cxxopt='-std=c++11' -c opt \ - --fat_apk_cpu=x86,x86_64,arm64-v8a,armeabi-v7a \ +bazel build -c opt --fat_apk_cpu=x86,x86_64,arm64-v8a,armeabi-v7a \ //tensorflow/lite/java:tensorflow-lite ``` diff --git a/tensorflow/lite/g3doc/guide/ops_select.md b/tensorflow/lite/g3doc/guide/ops_select.md index b516fa2772c..8a9109cf54c 100644 --- a/tensorflow/lite/g3doc/guide/ops_select.md +++ b/tensorflow/lite/g3doc/guide/ops_select.md @@ -148,9 +148,9 @@ AAR to your local Maven repository: ```sh mvn install:install-file \ - -Dfile=bazel-bin/tensorflow/lite/java/tensorflow-lite-with-select-tf-ops.aar \ + -Dfile=bazel-bin/tensorflow/lite/java/tensorflow-lite-select-tf-ops.aar \ -DgroupId=org.tensorflow \ - -DartifactId=tensorflow-lite-with-select-tf-ops -Dversion=0.1.100 -Dpackaging=aar + -DartifactId=tensorflow-lite-select-tf-ops -Dversion=0.1.100 -Dpackaging=aar ``` Finally, in your app's `build.gradle`, ensure you have the `mavenLocal()` diff --git a/tensorflow/lite/java/BUILD b/tensorflow/lite/java/BUILD index 76544ef661e..a9db5ddbe88 100644 --- a/tensorflow/lite/java/BUILD +++ b/tensorflow/lite/java/BUILD @@ -20,7 +20,7 @@ JAVA_SRCS = glob([ # Building tensorflow-lite.aar including 4 variants of .so # To build an aar for release, run below command: -# bazel build --cxxopt='-std=c++11' -c opt --fat_apk_cpu=x86,x86_64,arm64-v8a,armeabi-v7a \ +# bazel build -c opt --fat_apk_cpu=x86,x86_64,arm64-v8a,armeabi-v7a \ # tensorflow/lite/java:tensorflow-lite aar_with_jni( name = "tensorflow-lite", diff --git a/tensorflow/lite/java/build_aar_for_release.sh b/tensorflow/lite/java/build_aar_for_release.sh index 54be643fc7e..2de3f4b1a0a 100755 --- a/tensorflow/lite/java/build_aar_for_release.sh +++ b/tensorflow/lite/java/build_aar_for_release.sh @@ -26,7 +26,7 @@ BASEDIR=tensorflow/lite CROSSTOOL="//external:android/crosstool" HOST_CROSSTOOL="@bazel_tools//tools/cpp:toolchain" -BUILD_OPTS="--cxxopt=--std=c++11 -c opt" +BUILD_OPTS="-c opt" CROSSTOOL_OPTS="--crosstool_top=$CROSSTOOL --host_crosstool_top=$HOST_CROSSTOOL" test -d $BASEDIR || (echo "Aborting: not at top-level build directory"; exit 1) diff --git a/tensorflow/lite/java/demo/README.md b/tensorflow/lite/java/demo/README.md index 00eedaaa8be..2593fcb40d6 100644 --- a/tensorflow/lite/java/demo/README.md +++ b/tensorflow/lite/java/demo/README.md @@ -41,8 +41,7 @@ code to merge. 2. Build the app with Bazel. The demo needs C++11: ```shell - bazel build -c opt --cxxopt='--std=c++11' \ - //tensorflow/lite/java/demo/app/src/main:TfLiteCameraDemo + bazel build -c opt //tensorflow/lite/java/demo/app/src/main:TfLiteCameraDemo ``` 3. Install the demo on a diff --git a/tensorflow/lite/java/ovic/README.md b/tensorflow/lite/java/ovic/README.md index 626ebbb61e8..95e503e5a05 100644 --- a/tensorflow/lite/java/ovic/README.md +++ b/tensorflow/lite/java/ovic/README.md @@ -37,9 +37,9 @@ unzip -j /tmp/ovic.zip -d tensorflow/lite/java/ovic/src/testdata/ You can run test with Bazel as below. This helps to ensure that the installation is correct. ```sh -bazel test --cxxopt=--std=c++11 //tensorflow/lite/java/ovic:OvicClassifierTest --cxxopt=-Wno-all --test_output=all +bazel test //tensorflow/lite/java/ovic:OvicClassifierTest --cxxopt=-Wno-all --test_output=all -bazel test --cxxopt=--std=c++11 //tensorflow/lite/java/ovic:OvicDetectorTest --cxxopt=-Wno-all --test_output=all +bazel test //tensorflow/lite/java/ovic:OvicDetectorTest --cxxopt=-Wno-all --test_output=all ``` ### Test your submissions @@ -51,7 +51,7 @@ Once you have a submission that follows the instructions from the [competition s You can call the validator binary below to verify that your model fits the format requirements. This often helps you to catch size mismatches (e.g. output for classification should be [1, 1001] instead of [1,1,1,1001]). Let say the submission file is located at `/path/to/my_model.lite`, then call: ```sh -bazel build --cxxopt=--std=c++11 //tensorflow/lite/java/ovic:ovic_validator --cxxopt=-Wno-all +bazel build //tensorflow/lite/java/ovic:ovic_validator --cxxopt=-Wno-all bazel-bin/tensorflow/lite/java/ovic/ovic_validator /path/to/my_model.lite classify ``` @@ -160,7 +160,7 @@ Note: You'll need ROOT access to the phone to change processor affinity. * Build and install the app. ``` -bazel build -c opt --cxxopt=--std=c++11 --cxxopt=-Wno-all //tensorflow/lite/java/ovic/demo/app:ovic_benchmarker_binary +bazel build -c opt --cxxopt=-Wno-all //tensorflow/lite/java/ovic/demo/app:ovic_benchmarker_binary adb install -r bazel-bin/tensorflow/lite/java/ovic/demo/app/ovic_benchmarker_binary.apk ``` diff --git a/tensorflow/lite/tools/accuracy/ilsvrc/README.md b/tensorflow/lite/tools/accuracy/ilsvrc/README.md index f88144c0281..f6c96591c1e 100644 --- a/tensorflow/lite/tools/accuracy/ilsvrc/README.md +++ b/tensorflow/lite/tools/accuracy/ilsvrc/README.md @@ -159,7 +159,6 @@ adb shell /data/local/tmp/imagenet_accuracy_eval \ ``` bazel run -c opt \ - --cxxopt='--std=c++11' \ -- \ //tensorflow/lite/tools/accuracy/ilsvrc:imagenet_accuracy_eval \ --model_file=mobilenet_quant_v1_224.tflite \ diff --git a/tensorflow/lite/tools/benchmark/android/README.md b/tensorflow/lite/tools/benchmark/android/README.md index 1ff91230684..76463517db9 100644 --- a/tensorflow/lite/tools/benchmark/android/README.md +++ b/tensorflow/lite/tools/benchmark/android/README.md @@ -28,7 +28,6 @@ to edit the `WORKSPACE` to configure the android NDK/SDK. ``` bazel build -c opt \ --config=android_arm64 \ - --cxxopt='--std=c++11' \ tensorflow/lite/tools/benchmark/android:benchmark_model ``` diff --git a/tensorflow/lite/tools/evaluation/tasks/coco_object_detection/README.md b/tensorflow/lite/tools/evaluation/tasks/coco_object_detection/README.md index e7dc46d05d9..96eb694f796 100644 --- a/tensorflow/lite/tools/evaluation/tasks/coco_object_detection/README.md +++ b/tensorflow/lite/tools/evaluation/tasks/coco_object_detection/README.md @@ -256,7 +256,6 @@ Optionally, you could also pass in the `--num_interpreter_threads` & ``` bazel run -c opt \ - --cxxopt='--std=c++11' \ -- \ //tensorflow/lite/tools/evaluation/tasks/coco_object_detection:run_eval \ --model_file=/path/to/ssd_mobilenet_v1_float.tflite \ diff --git a/tensorflow/lite/tools/evaluation/tasks/imagenet_image_classification/README.md b/tensorflow/lite/tools/evaluation/tasks/imagenet_image_classification/README.md index ef8142e3d5d..7fcd7e53639 100644 --- a/tensorflow/lite/tools/evaluation/tasks/imagenet_image_classification/README.md +++ b/tensorflow/lite/tools/evaluation/tasks/imagenet_image_classification/README.md @@ -204,7 +204,6 @@ adb shell /data/local/tmp/run_eval \ ``` bazel run -c opt \ - --cxxopt='--std=c++11' \ -- \ //tensorflow/lite/tools/evaluation/tasks/imagenet_image_classification:run_eval \ --model_file=mobilenet_quant_v1_224.tflite \ diff --git a/tensorflow/lite/tools/make/Makefile b/tensorflow/lite/tools/make/Makefile index f933469139b..5bbb7f6a034 100644 --- a/tensorflow/lite/tools/make/Makefile +++ b/tensorflow/lite/tools/make/Makefile @@ -59,7 +59,6 @@ LIBS := \ CXXFLAGS := -O3 -DNDEBUG -fPIC CXXFLAGS += $(EXTRA_CXXFLAGS) CFLAGS := ${CXXFLAGS} -CXXFLAGS += --std=c++11 LDOPTS := -L/usr/local/lib ARFLAGS := -r TARGET_TOOLCHAIN_PREFIX := diff --git a/tensorflow/lite/tools/pip_package/setup.py b/tensorflow/lite/tools/pip_package/setup.py index 90416b77bc7..3a08fa2f06f 100644 --- a/tensorflow/lite/tools/pip_package/setup.py +++ b/tensorflow/lite/tools/pip_package/setup.py @@ -139,7 +139,6 @@ ext = Extension( '-I%s' % TENSORFLOW_DIR, '-module', 'interpreter_wrapper', '-outdir', PACKAGE_NAME], - extra_compile_args=['-std=c++11'], include_dirs=[TENSORFLOW_DIR, os.path.join(TENSORFLOW_DIR, 'tensorflow', 'lite', 'tools', 'pip_package'),