Shared libraries and linking.,
Is there a way to specify where a program looks for its shared libraries ?
For example, I have created a program using the QT library under Linux. It compiles fine with no errors and appears to link to libqt.so.2 but I can not run this program because my program can't find libqt.so.2 For this example here are the outputs: ./main ld.so.1: ./main: fatal: libqt.so.2: open failed: No such file or directory Killed ldd main libqt.so.2 => (file not found) libstdc++.so.2.10.0 => /usr/local/gnu/lib/libstdc++.so.2.10.0 libm.so.1 => /usr/lib/libm.so.1 libc.so.1 => /usr/lib/libc.so.1 libdl.so.1 => /usr/lib/libdl.so.1 /usr/platform/SUNW,Sun-Blade-100/lib/libc_psr.so.1 When I link my program I have tried linking in two ways: 1. With -L$(QTDIR)/lib -lqt 2. With $(QTDIR)/lib/libqt.so.2 (as if it were just another object) I know the easy solution would be add $(QTDIR)/lib to ld.so.conf but I do not have root access. Is there any way to tell GCC to link in the absolute path to libqt.so.2 (I know this would not be a very portable solution but I don't care right now). Thanks in advance, Devin |
In your .bashrc or .bash_profile
do export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH and see whether that does the trick. Hope it helps! Cheers, Tink |
Tinkster,
Thank you! This has fixed the problem. Devin |
Glad I could help!
Cheers, Tink |
All times are GMT -5. The time now is 03:38 PM. |