Blender headless build on Amazon Linux 2

I am trying to build headless blender version for executing the binary on Lambda.
The issue I have is at the very beginning :).

I want to use specific blender release 2.79b so before I have done any commands I have updated the repos submodules and then checkedout the release I want.

Than my issues came. I’ve run the script to install dependencies. build_files/build_environment/

The command runs fine until specific library, which fails to build.

OpenShadingLanguage-1.7.5 failed to compile, exiting

The specific error is

[ 23%] Generating llvm_ops.bc.cpp
llvm_ops.cpp:101:10: fatal error: 'iostream' file not found
#include <iostream>

On my Ubuntu machine compiling this specific version is successfull.

I guessed somebody could point me what should I install in order for this to work.

The easiest workaround would be to run --skip-osl.

If you need OSL, this version is probably incompatible with a more recent compiler or other system configuration. You could try modifying to use a newer OSL version.

Thanks for interest in my issue.
Thing is I can perfectly fine compile Blender on Ubuntu 18.03.
So my thinking is that some build tools are out of date. But I can’t figure out which one.

So far I have cmake3 version 3.13.1 and gcc (GCC) 9.3.0

After the update of these two. I have progress. This is new build error.

[ 31%] Linking CXX shared library
[ 31%] Built target oslcomp
make: *** [all] Error 2
ERROR! OpenShadingLanguage-1.7.5 failed to compile, exiting

And before that one

[  9%] Generating testsuite/
llvm_ops.cpp:101:10: fatal error: 'iostream' file not found
#include <iostream>
[ 10%] Generating oslgram.cpp
[ 12%] Generating osllex.cpp
[ 12%] Built target CopyFiles

When I --skip-osl I still run into compilation error for the next dependency.