I'm doing some tutorials on Motif. I'm really just getting started. I'm doing something ignorant while linking and I'm not sure what it is. What happens is that I'm able to get Motif and Xtoolkit linked to my little test program, but the program won't run unless LD_LIBRARY_PATH is set. Yet other programs linked to Motif run fine without even setting that env variable. Here's what it looks like (let me know if you care what's in my silly little program, I believe this to be my own problem with linking):
So, my fundamental question is: Why does ldd see that 'plan' is linked to Motif versus my silly hello program that can't. Understand that if I set LD_LIBRARY_PATH to include /usr/pkg/lib, everything works fine.
sgriggs@m83 ~/code/motif $ gcc -g -Wall -I/usr/pkg/include -I/usr/X11R7/include -lXm -L/usr/pkg/lib -o hello hello.c sgriggs@m83 ~/code/motif $ unset LD_LIBRARY_PATH sgriggs@m83 ~/code/motif $ ./hello Shared object "libXm.so.4" not found sgriggs@m83 ~/code/motif $ ldd hello hello: -lXm.4 => not found -lgcc_s.1 => /usr/lib/libgcc_s.so.1 -lc.12 => /usr/lib/libc.so.12 -lXt.7 => not found sgriggs@m83 ~/code/motif $ ldd /usr/pkg/bin/plan /usr/pkg/bin/plan: -lXm.4 => /usr/pkg/lib/libXm.so.4 -lXmu.7 => /usr/X11R7/lib/libXmu.so.7 -lXt.7 => /usr/X11R7/lib/libXt.so.7 -lX11.7 => /usr/X11R7/lib/libX11.so.7 -lxcb.2 => /usr/X11R7/lib/libxcb.so.2 -lXau.7 => /usr/X11R7/lib/libXau.so.7 -lgcc_s.1 => /usr/lib/libgcc_s.so.1 -lc.12 => /usr/lib/libc.so.12 -lXdmcp.7 => /usr/X11R7/lib/libXdmcp.so.7 -lSM.7 => /usr/X11R7/lib/libSM.so.7 -lICE.7 => /usr/X11R7/lib/libICE.so.7 -lXext.7 => /usr/X11R7/lib/libXext.so.7 -lXrender.2 => /usr/X11R7/lib/libXrender.so.2 -lXft.3 => /usr/X11R7/lib/libXft.so.3 -lfontconfig.2 => /usr/X11R7/lib/libfontconfig.so.2 -lexpat.2 => /usr/lib/libexpat.so.2 -lfreetype.17 => /usr/X11R7/lib/libfreetype.so.17 -lz.1 => /usr/lib/libz.so.1 -lbz2.1 => /usr/lib/libbz2.so.1 -lXrandr.3 => /usr/X11R7/lib/libXrandr.so.3 -ljpeg.9 => /usr/pkg/lib/libjpeg.so.9 -lpng16.16 => /usr/pkg/lib/libpng16.so.16 -lm.0 => /usr/lib/libm.so.0 Any ideas? -Swift