First, you should use CMake instead of "configure"as written here. Maybe, it will help you to solve this issue. I cannot say too much because usually I only use one compiler version to avoid compiling issue. So you should add the path to your gcc8 in your $PATH. The same for $LD_LIBRARY_PATH and try to compile again.