[2.2] Fixed build errors

| Q               | A
| --------------- | ---
| Doc fix?        | yes
| New docs?       | no
| Applies to      | 2.2+

There were a lot of build errors. Almost all of them are fixed by #2445 and 43d744461a4e22ad39cbef1afd74ebf7c6c4b8ed , this fixed the last build error.