Updates to build system for extension.

Also fix some issues building on linux.