Fix misuage of pkg_emit_errorno
Fix registering shlibs with a stage directory