I am trying to build tensorflow from source and in that i have to install bazel. So i tried to install it with the custom apt-get command as given on the official bazel site, but it gives error that no package found. After that i tried the second method but that also does not properly builds bazel and gives error as exec format not supported.
Sounds like it was built for the wrong architecture (e.g., trying to run desktop PC software on a Jetson). Where did you find the source code (or what is the bazel site URL you used)?
You can follow the directions at https://www.tensorflow.org/install/install_linux#InstallingNativePip
But when you get to the section, skip step 1 and go to step 2 except don’t use the wheel they give, instead use one of the wheels you find here: https://devtalk.nvidia.com/default/topic/1031300/jetson-tx2/tensorflow-1-7-wheel-with-jetpack-3-2-/
(This assumes you want TF v1.7 on Jetpack 3.2. If you don’t, you can search for wheels that match your desired stack.)
Jason over at NVIDIA has a repository to build TensorFlow from source, along with some prebuilt .whl files:
Requires L4T 28.2, CUDA 9.0, cuDNN 7.0.5 installed by JetPack 3.2.
Article and video on build: http://www.jetsonhacks.com/2018/03/26/build-tensorflow-on-nvidia-jetson-tx-development-kits/