Bug 863499 - error while loading shared libraries: libHSleksah- cannot open shared object file: No such file or directory
error while loading shared libraries: libHSleksah- canno...
Product: Fedora
Classification: Fedora
Component: leksah (Show other bugs)
All Linux
high Severity high
: ---
: ---
Assigned To: Narasimhan
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2012-10-05 11:33 EDT by Matteo Settenvini
Modified: 2012-12-03 22:10 EST (History)
2 users (show)

See Also:
Fixed In Version: leksah-
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-12-03 22:10:31 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Matteo Settenvini 2012-10-05 11:33:39 EDT
Description of problem:

In f18 current (alpha), leksah fails to start with the following error on the command line:

leksah: error while loading shared libraries: libHSleksah- cannot open shared object file: No such file or directory

Indeed, ldd /usr/bin/leksah reports:

	linux-vdso.so.1 =>  (0x00007fffdd7ff000)
	libHSleksah- => not found
	libHSutf8-string-0.3.7-ghc7.4.1.so => /usr/lib64/ghc-7.4.1/utf8-string-0.3.7/libHSutf8-string-0.3.7-ghc7.4.1.so (0x00007f69b6102000)
	libHSregex-tdfa-1.1.8-ghc7.4.1.so => /usr/lib64/ghc-7.4.1/regex-tdfa-1.1.8/libHSregex-tdfa-1.1.8-ghc7.4.1.so (0x00007f69b57d5000)
	libHSregex-base-0.93.2-ghc7.4.1.so => /usr/lib64/ghc-7.4.1/regex-base-0.93.2/libHSregex-base-0.93.2-ghc7.4.1.so (0x00007f69b55b1000)
	libHSleksah-server- => /usr/lib64/ghc-7.4.1/leksah-server- (0x00007f69b51e3000)
        [ ...SNIP... ]

It seems the other SOs are found correctly. libHSleksah- is installed in /usr/lib64/ghc-7.4.1/leksah-

Version-Release number of selected component (if applicable):

Comment 1 Narasimhan 2012-10-08 07:09:39 EDT
I will take a look. Setting LD_LIBRARY_PATH to the leksah directory inside /usr/lib64/ghc-7.4.1 works. I will check why the path information is not getting written while building the rpm.
Comment 2 Narasimhan 2012-10-11 11:02:44 EDT
The rpath information in leksah starts with /builddir/build/BUILD/leksah- and hence the "library not found" error. 

leksah exports modules in a library package and this package is in turn listed as a dependency for the executable. If we use --shared option, this exported package becomes a shared library dependency for leksah binary. Before 7.4.1, I patched leksah to remove the library as a dependency. This was done  to solve an issue  that occurred while running haddock after build ( http://hackage.haskell.org/trac/hackage/ticket/656 ). The issue got fixed in 7.4.1 and I removed the patch.

This "library not found" issue could have been there before but never surfaced because of the patch. I checked that putting the patch back again removes libHSleksah- as a dependency of leksah binary and the issue is fixed.
Comment 3 Narasimhan 2012-10-11 22:39:14 EDT
Built for rawhide. 

F18 scratch build

Build for f18 will be done once ghc-7.4.1 update gets pushed to stable.
Comment 4 Narasimhan 2012-10-11 22:46:54 EDT
Incorrect update

Built for rawhide. 

F18 scratch build
Comment 5 Jens Petersen 2012-10-14 21:29:47 EDT
I see - sorry my fault for just dropping that patch earlier.

The self-dependency is "interesting" though - maybe worth
asking upstream about the story behind it?  As such it has
the potential to save a lot of build time.

How about trying to use chrpath to edit the RPATH in the
leksak binary instead?
Comment 6 Jens Petersen 2012-10-15 02:46:40 EDT
So actually I had the same problem when moving "back" to monolithic

Anyway I think you can fix it like this:

BuildRequires: chrpath




RPATH=$(chrpath $PROG| sed -e "s!^$PROG: RPATH=!!")
case $RPATH in
    NEWRPATH=$(echo $RPATH | sed -e "s!$PWD!%{ghclibdir}!g" -e "s!/dist/build!!g")
    chrpath -r $NEWRPATH $PROG

(taken from haskell-platform.spec though untested here).

Then you could drop the patch and benefit from the shared lib.

In the long term I would like to see all dynamically linked binlib haskell packages doing this.
Comment 7 Narasimhan 2012-10-15 22:45:39 EDT
I think you were right in dropping the patch earlier because the haddock issue was fixed in ghc-7.4.1.
Thanks for the new patch. I did modify rpath of leksah binary using chrpath and was able to get it working. I will incorporate this into the spec file for f18 and rawhide.
Comment 8 Narasimhan 2012-10-23 23:56:53 EDT
I have built leksah for F18 with the deps patch. I will try out the patch that you have mentioned in comment 6 in rawhide and then port it back to F18. Will keep this bug open.
Comment 9 Fedora Update System 2012-10-24 00:16:42 EDT
leksah- has been submitted as an update for Fedora 18.
Comment 10 Fedora Update System 2012-11-08 01:38:04 EST
leksah- has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 11 Jens Petersen 2012-12-03 22:10:31 EST
works for me

closing for bodhi

Note You need to log in before you can comment on or make changes to this bug.