Results 1 to 7 of 7
Hi,
I am using both Centos & RedHat distributions.
In my RedHat one, I tried echo $LD_LIBRARY_PATH which returns a blank line. I added my lib dir as export LD_LIBRARY_PATH=/mylibdir. ...
- 07-28-2011 #1Just Joined!
- Join Date
- Jul 2011
- Posts
- 4
Segmentation Fault on export LD_LIBRARY_PATH
Hi,
I am using both Centos & RedHat distributions.
In my RedHat one, I tried echo $LD_LIBRARY_PATH which returns a blank line. I added my lib dir as export LD_LIBRARY_PATH=/mylibdir. Now after I done this, even my ls throws me segmentation fault. I even tired export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mylibdir. I couldn't run my application too. It too shows Segmentation fault.
I am doing this all under a user who is not root. I need this because my application comes in a RPM package which can be relocated and installed in the user directory instead of a default one. Now in the installed path all the libraries will be present and I have to add them to LD_LIBRARY_PATH.
But for some reason, it shows segmentation fault afterwards. I tried this in CentOS as well, even as a non root user which works fine as expected. My RedHat that shows segmentation fault is Red Hat Enterprise Linux Client release 5.7 (Tikanga).
What am I missing here?Last edited by liaK; 07-28-2011 at 06:20 AM. Reason: typo error
- 07-28-2011 #2Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
Your CentOS version is not the same as your RHEL version (b/c CentOS did not release 5.7, I believe), is that right? That might be why it works on CentOS and not on RHEL.
As to the reason for the segfault, I'm not sure. Something to do with library conflicts, I'm guessing. What is in your /mylibdir? Does it contain static libraries that the binaries installed by your RPM require?
Pick a binary from the RPM you installed and are trying to run, and do this:
What does that tell you?Code:ldd /path/to/RPM/bin
- 07-28-2011 #3Just Joined!
- Join Date
- Jul 2011
- Posts
- 4
Well, I tried ldd /home/installedDirectory/libQtCore.so.4, which tells me that
And I don't think they are static libraries. Every library has .so.* extensions.linux-vdso.so.1 => (0x00007fff98dfe000)
libz.so.1 => /home/installedDirectory/libz.so.1 (0x00007f2090745000)
libpthread.so.0 => /home/installedDirectory/libpthread.so.0 (0x00007f2090529000)
libdl.so.2 => /home/installedDirectory/libdl.so.2 (0x00007f2090325000)
libstdc++.so.6 => /home/installedDirectory/libstdc++.so.6 (0x00007f2090025000)
libm.so.6 => /home/installedDirectory/libm.so.6 (0x00007f208fda1000)
libgcc_s.so.1 => /home/installedDirectoryy/libgcc_s.so.1 (0x00007f208fb93000)
libc.so.6 => /home/installedDirectory/libc.so.6 (0x00007f208f83c000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2090ce5000)
I made to link the correct libraries by adding a .conf file in the /etc/ld.so.conf.d directory and running /sbin/ldconfig. Now it links the correct directory. But it do require a sudo access for adding /etc/ld.so.conf.d directory. I'd love make this done without a sudo access. That's why I went for LD_LIBRARY_PATH.
And I am at a loss why am receiving a seg.fault at LD_LIBRARY_PATH.
- 07-28-2011 #4Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
Yeah, I meant shared, sorry.
I'm guessing that is why your 'ls' command broke, b/c in that /home/installedDirectory are core libraries (libc.so.6, libgcc_s.so), which are different (I'm assuming) from the ones installed in /lib. So ls was using the newer (wrong) libraries when executed, versus the ones it was built against (in /lib).
Is your hardware 64-bit?
What RPM are you trying to run? It might be easier to rebuild (from the Source RPM) if the platform is different, or if the binary is not built against libraries matching your system.
- 07-28-2011 #5Just Joined!
- Join Date
- Jul 2011
- Posts
- 4
Yes.
And I think your guess might very well be the reason.
I ran a binary rpm which I built through rpmbuild -bb. I believe this is what you meant.What RPM are you trying to run?
I am bit naive in RPM,TBH.
Can you please elaborate on that? I am not aware of it.It might be easier to rebuild (from the Source RPM) if the platform is different, or if the binary is not built against libraries matching your system.Last edited by liaK; 07-28-2011 at 02:23 PM. Reason: typo
- 07-28-2011 #6Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
I guess you rebuilt the RPM (rpmbuild -bb) on a machine OTHER than the RHEL box? If so, try rebuilding the RPM on the RHEL box itself. There are ways to build an RPM for other distros on one box (see mock) but that takes some setting up. It's easier to just rebuild it on the machine itself, if you can.
- 07-28-2011 #7Just Joined!
- Join Date
- Jul 2011
- Posts
- 4
Yes.
That might not be possible because it is on the Customers end who aren't well versed with Linux and I don't want them build the files by themselves.If so, try rebuilding the RPM on the RHEL box itself.
Probably what I want and I'll look into that.There are ways to build an RPM for other distros on one box (see mock) but that takes some setting up.
And thanks for your replies. It is really helpful. Thanks and Cheers.


Reply With Quote
