check duplicate pkgs when build, Fix #844