adding option -fdelete-pkg to -O2 for can_delete()

cherry-picked from master