Add a test to avoid regressions. Fixes #3412
There was a missing include path in the compilation line, leading to incorrect fstat ABI. closes #3291
that's all this commit does. further commits will fix cli flags and such. see #2221