How to install TensorFlow on JetsonTX2 from source

Hi. I want to use LipNet from https://github.com/rizkiarm/LipNet on JetsonTX2. It needs tensorflow-gpu version 1.0.1.
So I’m trying to build tensorflow on JetsonTX2 with JetPack 3.2 from source, referring to https://gist.github.com/vellamike/7c26158c93e89ef155c1cc953bbba956.

But I do the command,
$ bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
then I get the below error massage.

INFO: From Compiling external/mkl_dnn/src/cpu/ref_shuffle.cpp [for host]:
external/mkl_dnn/src/cpu/ref_shuffle.cpp:96:0: warning: ignoring #pragma omp simd [-Wunknown-pragmas]
             PRAGMA_OMP_SIMD()
 ^
external/mkl_dnn/src/cpu/ref_shuffle.cpp:104:0: warning: ignoring #pragma omp simd [-Wunknown-pragmas]
             PRAGMA_OMP_SIMD()
 ^
ERROR: /home/nvidia/.cache/bazel/_bazel_nvidia/c242bbd98573f3716705baaefd7d5e0a/external/mkl_dnn/BUILD.bazel:101:1: C++ compilation of rule '@mkl_dnn//:mkldnn_single_threaded' failed (Exit 1)
In file included from external/mkl_dnn/src/cpu/cpu_isa_traits.hpp:35:0,
                 from external/mkl_dnn/src/cpu/jit_generator.hpp:21,
                 from external/mkl_dnn/src/cpu/gemm_x8s8s32x_inner_product.hpp:28,
                 from external/mkl_dnn/src/cpu/gemm_x8s8s32x_inner_product.cpp:20:
external/mkl_dnn/src/cpu/xbyak/xbyak_util.h:84:21: fatal error: cpuid.h: No such file or directory
compilation terminated.
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 15085.477s, Critical Path: 986.01s
INFO: 6432 processes: 6432 local.
FAILED: Build did NOT complete successfully

Do you know what is “C++ compilation of rule”??
Could you give me any help?
Thanks.

Hi,

Could you try to turn off the MLK library and try it again?

bazel build --define tensorflow_mkldnn_contraction_kernel=0 ...

Thanks.

Thank you for reply.

I did the command,

$ bazel build --define tensorflow_mkldnn_contraction_kernel=0 ...

and another error appeared.

ERROR: /home/nvidia/.cache/bazel/_bazel_nvidia/c242bbd98573f3716705baaefd7d5e0a/external/io_bazel_rules_closure/java/io/bazel/rules/closure/BUILD:17:1: no such package '@com_google_dagger//': java.io.IOException: Error downloading [https://mirror.bazel.build/repo1.maven.org/maven2/com/google/dagger/dagger/2.14.1/dagger-2.14.1.jar, https://repo1.maven.org/maven2/com/google/dagger/dagger/2.14.1/dagger-2.14.1.jar] to /home/nvidia/.cache/bazel/_bazel_nvidia/c242bbd98573f3716705baaefd7d5e0a/external/com_google_dagger/dagger-2.14.1.jar: All mirrors are down: [Unknown host: mirror.bazel.build, Unknown host: repo1.maven.org] and referenced by '@io_bazel_rules_closure//java/io/bazel/rules/closure:ClosureWorker'
ERROR: Analysis of target '//tensorflow/core:example_protos_closure' failed; build aborted: Evaluation of aspect @io_bazel_rules_closure//closure/protobuf:closure_proto_library.bzl%closure_proto_aspect on //tensorflow/core:example_protos failed: com.google.devtools.build.lib.packages.BuildFileNotFoundException: no such package '@com_google_dagger//': java.io.IOException: Error downloading [https://mirror.bazel.build/repo1.maven.org/maven2/com/google/dagger/dagger/2.14.1/dagger-2.14.1.jar, https://repo1.maven.org/maven2/com/google/dagger/dagger/2.14.1/dagger-2.14.1.jar] to /home/nvidia/.cache/bazel/_bazel_nvidia/c242bbd98573f3716705baaefd7d5e0a/external/com_google_dagger/dagger-2.14.1.jar: All mirrors are down: [Unknown host: mirror.bazel.build, Unknown host: repo1.maven.org]
INFO: Elapsed time: 111.005s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (25 packages loaded, 6732 targets \
configured)

It’s a kind of my network error?
I’m trying to solve this problem now.

Thanks.

Hi,

I can download the package with both links:
https://mirror.bazel.build/repo1.maven.org/maven2/com/google/dagger/dagger/2.14.1/dagger-2.14.1.jar https://repo1.maven.org/maven2/com/google/dagger/dagger/2.14.1/dagger-2.14.1.jar

It’s recommended to try if you can download it without bazel first.
Thanks.

Hi.

I uninstalled bazel first,

$ sudo rm -rf ~/.bazel
$ sudo rm -rf ~/.bazelrc
$ sudo rm -rf ~/.cache/bazel
$ sudo rm ~/bin/bazel

and I got the package from the link you suggested.

I get the download file moved to third_party directory,

$ cp -a ~/Downloads/dagger-2.14.1 ~/bazel-0.24.0-dist/third_party

and add the below code to WORKSPACE file.

# bazel-0.24.0-dist/WORKSPACE
local_repository(
    name = "com_google_dagger",
    path = "./third_party/dagger-2.14.1/",
)

Bazel is successfully build, but I tried to last command,

$ sudo bazel build --define tensorflow_mkldnn_contraction_kernel=0 ...

I got error again.

$ bazel build --define tensorflow_mkldnn_contraction_kernel=0 ...
DEBUG: /home/nvidia/.cache/bazel/_bazel_nvidia/c242bbd98573f3716705baaefd7d5e0a/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:115:5: 
Auto-Configuration Warning: 'TMP' environment variable is not set, using 'C:\Windows\Temp' as default
DEBUG: /home/nvidia/.cache/bazel/_bazel_nvidia/c242bbd98573f3716705baaefd7d5e0a/external/bazel_tools/tools/build_defs/pkg/pkg.bzl:259:17: @//tensorflow/tools/lib_package:libtensorflow_jni: you provided a non dictionary to the pkg_tar `files` attribute. This attribute was renamed to `srcs`. Consider renaming it in your BUILD file.
DEBUG: /home/nvidia/.cache/bazel/_bazel_nvidia/c242bbd98573f3716705baaefd7d5e0a/external/bazel_tools/tools/build_defs/pkg/pkg.bzl:259:17: @//tensorflow/tools/lib_package:common_deps: you provided a non dictionary to the pkg_tar `files` attribute. This attribute was renamed to `srcs`. Consider renaming it in your BUILD file.
DEBUG: /home/nvidia/.cache/bazel/_bazel_nvidia/c242bbd98573f3716705baaefd7d5e0a/external/bazel_tools/tools/build_defs/pkg/pkg.bzl:259:17: @//tensorflow/tools/lib_package:cheaders: you provided a non dictionary to the pkg_tar `files` attribute. This attribute was renamed to `srcs`. Consider renaming it in your BUILD file.
DEBUG: /home/nvidia/.cache/bazel/_bazel_nvidia/c242bbd98573f3716705baaefd7d5e0a/external/bazel_tools/tools/build_defs/pkg/pkg.bzl:259:17: @//tensorflow/tools/lib_package:eager_cheaders: you provided a non dictionary to the pkg_tar `files` attribute. This attribute was renamed to `srcs`. Consider renaming it in your BUILD file.
DEBUG: /home/nvidia/.cache/bazel/_bazel_nvidia/c242bbd98573f3716705baaefd7d5e0a/external/bazel_tools/tools/build_defs/pkg/pkg.bzl:259:17: @//tensorflow/tools/lib_package:clicenses: you provided a non dictionary to the pkg_tar `files` attribute. This attribute was renamed to `srcs`. Consider renaming it in your BUILD file.
ERROR: /home/nvidia/Projects/buildTensorFlow_onJetsonTX2/tensorflow/third_party/toolchains/cpus/arm/BUILD:3:1: third-party rule '//third_party/toolchains/cpus/arm:toolchain' lacks a license declaration with one of the following types: notice, reciprocal, permissive, restricted, unencumbered, by_exception_only
ERROR: /home/nvidia/Projects/buildTensorFlow_onJetsonTX2/tensorflow/third_party/toolchains/cpus/arm/BUILD:16:1: third-party rule '//third_party/toolchains/cpus/arm:empty' lacks a license declaration with one of the following types: notice, reciprocal, permissive, restricted, unencumbered, by_exception_only
ERROR: /home/nvidia/Projects/buildTensorFlow_onJetsonTX2/tensorflow/third_party/toolchains/cpus/arm/BUILD:21:1: third-party rule '//third_party/toolchains/cpus/arm:arm_linux_all_files' lacks a license declaration with one of the following types: notice, reciprocal, permissive, restricted, unencumbered, by_exception_only
ERROR: /home/nvidia/Projects/buildTensorFlow_onJetsonTX2/tensorflow/third_party/toolchains/cpus/arm/BUILD:28:1: third-party rule '//third_party/toolchains/cpus/arm:cc-compiler-local' lacks a license declaration with one of the following types: notice, reciprocal, permissive, restricted, unencumbered, by_exception_only
ERROR: /home/nvidia/Projects/buildTensorFlow_onJetsonTX2/tensorflow/third_party/toolchains/cpus/arm/BUILD:41:1: third-party rule '//third_party/toolchains/cpus/arm:cc-compiler-armeabi' lacks a license declaration with one of the following types: notice, reciprocal, permissive, restricted, unencumbered, by_exception_only
ERROR: package contains errors: third_party/toolchains/cpus/arm
ERROR: error loading package 'third_party/toolchains/cpus/arm': Package 'third_party/toolchains/cpus/arm' contains errors
INFO: Elapsed time: 1.637s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)

Thanks.

Sorry, I overlooked the message

Auto-Configuration Warning: 'TMP' environment variable is not set, using 'C:\Windows\Temp' as default

I will try to change configuration tomorrow.

Hi,

Maybe try this?

$ export TEST_TMPDIR=/path/to/directory

Thanks.