problem when install caffe0.999

I need a caffe.mexa64  using GPU. So I download caffe 0.999 to compile.
My env is:
ubuntu 16.04
GPU GTX1080ti
matlab R2016b
cuda 9.0
Gcc g++ 5.4.0

caffe-master has been compiled ans output caffe_.mexa64  with in this env.
In caffe 0.999, make all is passed.

when make matcaffe:
make matcaffe 2>~/2.log
/usr/local/MATLAB/R2016b/bin/mex matlab/caffe/matcaffe.cpp build/lib/libcaffe.a \
        CXXFLAGS="\$CXXFLAGS -pthread -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I/usr/include/hdf5/serial/ -Ibuild/src -I./src -I./include -I/usr/local/cuda/include -Wall" \
        CXXLIBS="\$CXXLIBS -L/usr/lib -L/usr/local/lib -L/usr/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib -lcudart -lcublas -lcurand -lpthread -lglog -lgflags -lprotobuf -lleveldb -lsnappy -lboost_system -lhdf5_hl -lhdf5 -llmdb -lm -lcblas -lopencv_core -lopencv_highgui -lopencv_imgproc -lcblas -latlas"  -output matlab/caffe/caffe.mexa64
Building with 'g++'.
Warning: You are using gcc version '5.4.0'. The version of gcc is not supported. The version currently supported with MEX is '4.9.x'. For a list of currently supported compilers see: ... ease.
/home/zhangqing/caffe-0.999/matlab/caffe/matcaffe.cpp: In function ‘mxArray* do_get_weights()’:
/home/zhangqing/caffe-0.999/matlab/caffe/matcaffe.cpp:188:49: warning: narrowing conversion of ‘(& layer_blobs)->std::vector<_Tp, _Alloc>::size<boost::shared_ptr<caffe::Blob<float> >, std::allocator<boost::shared_ptr<caffe::Blob<float> > > >()’ from ‘std::vector<boost::shared_ptr<caffe::Blob<float> >, std::allocator<boost::shared_ptr<caffe::Blob<float> > > >::size_type {aka long unsigned int}’ to ‘mwSize {aka int}’ inside { } [-Wnarrowing]
         const mwSize dims[2] = {layer_blobs.size(), 1};
and more than 2500 lines error infomation saved to 2.log. too long to parse here.
Can anyone help me to solve?