Ubuntu22.04 installing older OpenCV version

Hi all!

I was trying to install OpenCV3.1.0 today, but I ran into a problem during the building process.

I am using gcc-11 on Ubuntu22.04, so I thought there might be a problem with the compiler being too recent, because I managed to build OpenCV4.9.0 successfully.

Did anybody else come across a situation similar to this and managed to solve it?