ROOTaaS C++ kernel sdtout or stderr malformed message with zmq

Ok, I managed to build ROOT6 master (6.07.03) in Debian stretch (sid), by downgrading first the default gcc compiler (5.3) to 4.8. Now all error messages about ABIs, zmq and so on have disappeared.

I did this with the update-alternatives method described here: http://askubuntu.com/a/26518. I post the complete workflow, in case someone has the same problem.

sudo apt-get install git dpkg-dev make g++ gcc binutils libx11-dev libxpm-dev \
libxft-dev libxext-dev
sudo apt-get install gfortran libssl-dev libpcre3-dev \
xlibmesa-glu-dev libglew1.5-dev libftgl-dev \
libmysqlclient-dev libfftw3-dev cfitsio-dev \
graphviz-dev libavahi-compat-libdnssd-dev \
libldap2-dev python-dev libxml2-dev libkrb5-dev \
libgsl0-dev libqt4-dev ccache

sudo update-alternatives --remove-all g++
sudo update-alternatives --remove-all gcc 
sudo update-alternatives --remove-all gfortran 
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 20
sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-4.8 10
sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-5 20
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
sudo update-alternatives --config gfortran

sudo mkdir /opt/root6
sudo chown myusername /opt/root6
#No need to use sudo anymore.
#Alternatively, just do mkdir /home/myuser/root6 and replace below all /opt/root6
cd /opt/root6
git clone http://root.cern.ch/git/root.git root6_src
cmake -Droofit=ON -Dhttp=ON -Dccache=ON /opt/root6/root6_src/
cmake --build .
#or make -j8 instead
source /opt/root6/bin/thisroot.sh
# Or add previous line in your ~/.bashrc
root --notebook