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:
ld.so.1: ./main: fatal: libqt.so.2: open failed: No such file or directory
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
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,
In your .bashrc or .bash_profile
and see whether that does the trick.
Hope it helps!
Thank you! This has fixed the problem.
Glad I could help!
|All times are GMT -5. The time now is 04:53 PM.|