build: add -Wall and -fno-common, fix reported issues