Tensorflow 1.4 and cudnn

I am trying to install tensorflow. I did successful configuration with CUDA 8.0 and cudnn 5. However, when I tried to build, I got the following error for cudnn:

In member function ‘cudnnStatus_t perftools::gputools::cuda::wrap::WrapperShim__cudnnSetRNNDescriptor_v6::operator()(perftools::gputools::cuda::CUDAExecutor*, Args …)’:
tensorflow/stream_executor/cuda/cuda_dnn.cc:140:30: error: ‘::cudnnSetRNNDescriptor_v6’ has not been declared
cudnnStatus_t retval = ::__name(args…); \

After this, my compilation terminated.