Could you check, if your libstdc++ is properly installed?
You should find this file in /usr/include/c++/<version>/memory.
In case you can’t find it, you might need to install it via:
apt-get install build-essential