Fix warnings, add automatic creation of lib