If you are still on Trusty you'll need a modern gcc toolchain.
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable
sudo apt-get update
sudo apt-get install build-essential git scons libssl-dev gcc-6 g++-6
sudo apt-get install libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-thread-dev
sudo apt-get install python-pymongo
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 1
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 1
gcc --version
Grab mongo and apply patch:
git clone https://github.com/mongodb/mongo.git
cd mongo
git checkout tags/r3.3.9
wget https://goo.gl/RkXL2j -O - | patch -p1 # or just apply the diff manually
Then build:
scons -j 4 core
sudo scons --prefix=/opt/mongo install
export PATH=/opt/mongo/bin:$PATH
The build takes a while on my crappy spinning disk machine but does complete. Basic mongo shell operations seem to work.