NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: linking issue - what am I doing wrong?




Some folks, who have had similar issues, asked what I ended up doing and if I'd post it. Here's the skinny:

I was doing this:

gcc -g -Wall -I/usr/pkg/include -I/usr/X11R7/include -lXm \
                  -L/usr/pkg/lib -o hello hello.c

I switched it to this:

gcc -Wl,-rpath,/usr/pkg/lib -Wl,-rpath,/usr/X11R7/lib -g -Wall \
                  -I/usr/pkg/include -I/usr/X11R7/include -lXm \
                  -L/usr/pkg/lib -o hello hello.c

I guess that bakes in the library search path to your resulting binary. Very helpful, actually. I just never really knew this was an alternative to something like always having to set LD_LIBRARY_PATH, but since I saw other programs that managed to pull it off, I thought I'd ask. I'm glad I did. There are so many smart folks on this list.

Thanks,
  Swift


Home | Main Index | Thread Index | Old Index