I could find a work around for this. I was getting the above error when I was using caffe_android_lib repo. I was using that repo as I was porting caffe on mobile. Hence the architecture was ARM.
Later , I have cloned just the caffe repo(BVLC/caffe and not android_caffe_lib), built it though could not built is fully, but managed to get tools directly built.
Then I had executed these commands. It worked fine. This says, the below scripts are compatible with only x86 architecture.
cd $CAFFE_ROOT
./data/mnist/get_mnist.sh
./examples/mnist/create_mnist.sh