Minimal changes to restore build

CMake configuration changes (some gcc flags, etc.), and a few code changes.