You probably can build for Oreo, something is just wrong in your build environment.
First, try to build for an officially supported device by /e/ and LineageOS on Oreo to see if it works by following the documentation : https://doc.e.foundation/how-tos/build-e
Or manually with the help of this script :