I am on a brand new 5.1 NetBSD box.

I copied the "Hello World" code from here rosettacode.org

The code compiles with this command:

cc -I /usr/X11R7/include -L /usr/X11R7/lib -lX11 helloworld.c

When I run a.out, I get the following error:

Shared object "libX11.so.6" not found

I confirmed that /usr/X11R7/lib/libX11.so.6 does exist.

ldd output:

    -lX11.6 => not found
    -c.12 => /usr/lib/libc.so.12

How do I properly link against X11 on NetBSD?


The official NetBSD answer is to use RPATH. Crazy.

  • I should have mentioned I am still a C novice. I had come across that link before posting my question, but wasnt quite sure what I was looking at. Appending -R /usr/X11R7/lib worked, thanks man! – Mad Rapper X May 8 '12 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.