Question

I compiled the original cwm tgz package (not the netbsd one) with

./configure
make

which works without error. After starting cwm with

./cwm

the error

Shared object "libX11.so.7" not found

appears. The ldd output is:

    -lXft.2 => /usr/pkg/lib/libXft.so.2
    -lfontconfig.1 => /usr/pkg/lib/libfontconfig.so.1
    -lfreetype.7 => /usr/X11R7/lib/libfreetype.so.7
    -lz.1 => /usr/lib/libz.so.1
    -lgcc_s.1 => /usr/lib/libgcc_s.so.1
    -lc.12 => /usr/lib/libc.so.12
    -lbz2.1 => /usr/lib/libbz2.so.1
    -lexpat.2 => /usr/lib/libexpat.so.2
    -lXrender.2 => /usr/X11R7/lib/libXrender.so.2
    -lXext.7 => /usr/X11R7/lib/libXext.so.7
    -lX11.7 => /usr/X11R7/lib/libX11.so.7
    -lxcb.1 => /usr/X11R7/lib/libxcb.so.1
    -lXau.7 => /usr/X11R7/lib/libXau.so.7
    -lXdmcp.7 => /usr/X11R7/lib/libXdmcp.so.7
    -lX11.7 => not found
    -lXext.7 => not found

where the "not founds" refer to the cwm binary directly. It has been linked with the command

gcc -Wall -Icompat -D_REENTRANT -I/usr/pkg/include\
  -I/usr/X11R7/include/freetype2 -I/usr/X11R7/include\
  -I/usr/X11R7/include/freetype2 -I/usr/X11R7/include -g -O2\
  -I/usr/X11R7/include   -o cwm  calmwm.o draw.o screen.o  xmalloc.o\
  client.o grab.o search.o util.o xutil.o conf.o  input.o xevents.o\
  group.o  geographic.o kbfunc.o cursor.o  font.o -L/usr/pkg/lib\
  -Wl,-R/usr/pkg/lib -lXft -L/usr/X11R7/lib -lX11 -lXext

so the linker should find libX11 and libXext.

Why does the loader complain?

Was it helpful?

Solution

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.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top