The obvious portion is that ``-Wl,-R/usr/X11R7/lib'' was not included on the loader command line at link time.
NetBSD's runtime loader (/libexec/ld.elf_so) has only the runtime library search path of ``/lib:/usr/lib'' compiled in, so any executable needing additional elements on the search path needs to explicitly add them at compile time. (like the entry for /usr/pkg/lib.)