GNU bug report logs - #55178
ghc cannot find libraries of ghc-comonad

Previous Next

Package: guix;

Reported by: christoph.schumacher <at> mathematik.tu-dortmund.de

Date: Fri, 29 Apr 2022 01:41:01 UTC

Severity: normal

Done: Simon Tournier <zimon.toutoune <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55178 in the body.
You can then email your comments to 55178 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#55178; Package guix. (Fri, 29 Apr 2022 01:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to christoph.schumacher <at> mathematik.tu-dortmund.de:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Fri, 29 Apr 2022 01:41:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christoph Schumacher <christoph.schumacher <at> mathematik.tu-dortmund.de>
To: bug-guix <at> gnu.org
Subject: ghc cannot find libraries of ghc-comonad
Date: Fri, 29 Apr 2022 03:39:03 +0200
I found several bugs with the ghc and ghc-comonad packages:

- ghc needs gcc-toolchain in order to work.  This has already been 
reported:
  https://issues.guix.gnu.org/32131 and 
https://issues.guix.gnu.org/34850
- In the store, ghc-libraries seem to have the version appended to their 
name.
  The linker does not know this and cannot find the libraries.
- I created soft links with the names ghc expects in the current working 
directory
  and extended LIBRARY_PATH to include the current working directory.
  Then linking succeeds.
- But the executable again fails to find the libraries.
  It knows about the appended version strings, but it cannot find the 
files anyway.
  So I created more soft links, and now the simple test program runs.
- But as soon as I try to use a Comonad, the executable crashes.

Here is a minimal example:

> ls
LinkMe.hs
Main.hs

> cat LinkMe.hs
import Control.Comonad
main = putStrLn "Congratulations!"

> guix shell --pure ghc ghc-comonad -- ghc LinkMe.hs
[1 of 1] Compiling Main             ( LinkMe.hs, LinkMe.o )

<no location info>: error:
    Warning: Couldn't figure out C compiler information!
             Make sure you're using GNU gcc, or clang
ghc: could not execute: gcc

> guix shell --pure ghc ghc-comonad gcc-toolchain -- ghc LinkMe.hs
[1 of 1] Compiling Main             ( LinkMe.hs, LinkMe.o )
Linking LinkMe ...
ld: cannot find -lHScomonad-5.0.8-KDPzf2kORSz9Qeif8nQH6d
ld: cannot find -lHStransformers-compat-0.6.6-9ADqfwGTALm8Nq2ZeUpa4p
ld: cannot find -lHSindexed-traversable-0.1.1-Dfr00dUbJtB3rFEVdhtcE9
ld: cannot find -lHSdistributive-0.6.2.1-L7rr3EplzD03NITUnJxmCO
ld: cannot find -lHStagged-0.8.6.1-EiQY3za6Q5HE9cdvqupke2
ld: cannot find -lHSbase-orphans-0.8.5-Iz1X6ZIULaHC76vf03czEu
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)

> ln -s 
> /gnu/store/7xfvafaxbpc88bjmvijg38pr8djjx465-ghc-base-orphans-0.8.5/lib/x86_64-linux-ghc-8.10.7/libHSbase-orphans-0.8.5-Iz1X6ZIULaHC76vf03czEu-ghc8.10.7.so 
> libHSbase-orphans-0.8.5-Iz1X6ZIULaHC76vf03czEu.so
> ln -s 
> /gnu/store/rjkyixykafdhbf67aa3zlhappxl1dgai-ghc-comonad-5.0.8/lib/x86_64-linux-ghc-8.10.7/libHScomonad-5.0.8-KDPzf2kORSz9Qeif8nQH6d-ghc8.10.7.so 
> libHScomonad-5.0.8-KDPzf2kORSz9Qeif8nQH6d.so
> ln -s 
> /gnu/store/4jfs13lg5g93ssbfdr4hqqadw2iadir7-profile/lib/x86_64-linux-ghc-8.10.7/libHSdistributive-0.6.2.1-L7rr3EplzD03NITUnJxmCO-ghc8.10.7.so 
> libHSdistributive-0.6.2.1-L7rr3EplzD03NITUnJxmCO.so
> ln -s 
> /gnu/store/4jfs13lg5g93ssbfdr4hqqadw2iadir7-profile/lib/x86_64-linux-ghc-8.10.7/libHSindexed-traversable-0.1.1-Dfr00dUbJtB3rFEVdhtcE9-ghc8.10.7.so 
> libHSindexed-traversable-0.1.1-Dfr00dUbJtB3rFEVdhtcE9.so
> ln -s 
> /gnu/store/4jfs13lg5g93ssbfdr4hqqadw2iadir7-profile/lib/x86_64-linux-ghc-8.10.7/libHStagged-0.8.6.1-EiQY3za6Q5HE9cdvqupke2-ghc8.10.7.so 
> libHStagged-0.8.6.1-EiQY3za6Q5HE9cdvqupke2.so
> ln -s 
> /gnu/store/4jfs13lg5g93ssbfdr4hqqadw2iadir7-profile/lib/x86_64-linux-ghc-8.10.7/libHStransformers-compat-0.6.6-9ADqfwGTALm8Nq2ZeUpa4p-ghc8.10.7.so 
> libHStransformers-compat-0.6.6-9ADqfwGTALm8Nq2ZeUpa4p.so

> guix shell --pure ghc ghc-comonad gcc-toolchain coreutils -- env 
> LIBRARY_PATH=$LIBRARY_PATH:. ghc LinkMe.hs
Linking LinkMe ...

> ./LinkMe
./LinkMe: error while loading shared libraries: 
libHScomonad-5.0.8-KDPzf2kORSz9Qeif8nQH6d-ghc8.10.7.so: cannot open 
shared object file: No such file or directory

> ln -s 
> /gnu/store/rjkyixykafdhbf67aa3zlhappxl1dgai-ghc-comonad-5.0.8/lib/x86_64-linux-ghc-8.10.7/libHScomonad-5.0.8-KDPzf2kORSz9Qeif8nQH6d-ghc8.10.7.so 
> ./

> ./LinkMe
./LinkMe: error while loading shared libraries: 
libHStransformers-compat-0.6.6-9ADqfwGTALm8Nq2ZeUpa4p-ghc8.10.7.so: 
cannot open shared object file: No such file or directory

> ln -s 
> /gnu/store/4jfs13lg5g93ssbfdr4hqqadw2iadir7-profile/lib/x86_64-linux-ghc-8.10.7/libHStransformers-compat-0.6.6-9ADqfwGTALm8Nq2ZeUpa4p-ghc8.10.7.so 
> ./

> ./LinkMe
./LinkMe: error while loading shared libraries: 
libHSindexed-traversable-0.1.1-Dfr00dUbJtB3rFEVdhtcE9-ghc8.10.7.so: 
cannot open shared object file: No such file or directory

> ln -s 
> /gnu/store/4jfs13lg5g93ssbfdr4hqqadw2iadir7-profile/lib/x86_64-linux-ghc-8.10.7/libHSindexed-traversable-0.1.1-Dfr00dUbJtB3rFEVdhtcE9-ghc8.10.7.so 
> ./

 ./LinkMe
./LinkMe: error while loading shared libraries: 
libHSdistributive-0.6.2.1-L7rr3EplzD03NITUnJxmCO-ghc8.10.7.so: cannot 
open shared object file: No such file or directory

> ln -s 
> /gnu/store/4jfs13lg5g93ssbfdr4hqqadw2iadir7-profile/lib/x86_64-linux-ghc-8.10.7/libHSdistributive-0.6.2.1-L7rr3EplzD03NITUnJxmCO-ghc8.10.7.so 
> ./

> ./LinkMe
./LinkMe: error while loading shared libraries: 
libHStagged-0.8.6.1-EiQY3za6Q5HE9cdvqupke2-ghc8.10.7.so: cannot open 
shared object file: No such file or directory

> ln -s 
> /gnu/store/4jfs13lg5g93ssbfdr4hqqadw2iadir7-profile/lib/x86_64-linux-ghc-8.10.7/libHStagged-0.8.6.1-EiQY3za6Q5HE9cdvqupke2-ghc8.10.7.so 
> ./

> ./LinkMe
./LinkMe: error while loading shared libraries: 
libHSbase-orphans-0.8.5-Iz1X6ZIULaHC76vf03czEu-ghc8.10.7.so: cannot open 
shared object file: No such file or directory

> ln -s 
> /gnu/store/7xfvafaxbpc88bjmvijg38pr8djjx465-ghc-base-orphans-0.8.5/lib/x86_64-linux-ghc-8.10.7/libHSbase-orphans-0.8.5-Iz1X6ZIULaHC76vf03czEu-ghc8.10.7.so 
> ./

> ./LinkMe
Congratulations!

> cat Main.hs
{-# LANGUAGE DeriveFunctor #-}

import Control.Comonad (Comonad(..), extend)

data C a = C a deriving (Show, Functor)

instance Comonad C where
  extract (C a) = a
  duplicate x = C x

main :: IO ()
main = print $ extend id (C 0)

> guix shell --pure ghc ghc-comonad gcc-toolchain coreutils -- env 
> LIBRARY_PATH=$LIBRARY_PATH:. ghc Main.hs
[1 of 1] Compiling Main             ( Main.hs, Main.o )
Linking Main ...

> guix shell --pure ghc ghc-comonad gcc-toolchain coreutils -- env 
> LIBRARY_PATH=$LIBRARY_PATH:. ./Main
Main: internal error: stg_ap_p_ret
    (GHC version 8.10.7 for x86_64_unknown_linux)
    Please report this as a GHC bug:  
https://www.haskell.org/ghc/reportabug





Information forwarded to bug-guix <at> gnu.org:
bug#55178; Package guix. (Sat, 21 Jan 2023 12:50:01 GMT) Full text and rfc822 format available.

Message #8 received at 55178 <at> debbugs.gnu.org (full text, mbox):

From: Lars-Dominik Braun <lars <at> 6xq.net>
To: christoph.schumacher <at> mathematik.tu-dortmund.de
Cc: 55178 <at> debbugs.gnu.org
Subject: Re: ghc cannot find libraries of ghc-comonad
Date: Sat, 21 Jan 2023 13:49:29 +0100
Hi,

> > guix shell --pure ghc ghc-comonad gcc-toolchain -- ghc LinkMe.hs
> [1 of 1] Compiling Main             ( LinkMe.hs, LinkMe.o )
> Linking LinkMe ...
> ld: cannot find -lHScomonad-5.0.8-KDPzf2kORSz9Qeif8nQH6d
> ld: cannot find -lHStransformers-compat-0.6.6-9ADqfwGTALm8Nq2ZeUpa4p
> ld: cannot find -lHSindexed-traversable-0.1.1-Dfr00dUbJtB3rFEVdhtcE9
> ld: cannot find -lHSdistributive-0.6.2.1-L7rr3EplzD03NITUnJxmCO
> ld: cannot find -lHStagged-0.8.6.1-EiQY3za6Q5HE9cdvqupke2
> ld: cannot find -lHSbase-orphans-0.8.5-Iz1X6ZIULaHC76vf03czEu
> collect2: error: ld returned 1 exit status
> `gcc' failed in phase `Linker'. (Exit code: 1)
the problem here is that in Guix we link Haskell executables dynamically
and sometimes move static libraries to a separate output without updating
the config file (because otherwise it would create a reference, which
we’re trying to avoid to save space).

It works fine for me using

	guix shell --pure ghc ghc-comonad gcc-toolchain <at> 10 -- ghc --make -dynamic -v LinkMe.hs

Cheers,
Lars





Information forwarded to bug-guix <at> gnu.org:
bug#55178; Package guix. (Fri, 22 Sep 2023 16:47:03 GMT) Full text and rfc822 format available.

Message #11 received at 55178 <at> debbugs.gnu.org (full text, mbox):

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: Lars-Dominik Braun <lars <at> 6xq.net>
Cc: 55178 <at> debbugs.gnu.org, christoph.schumacher <at> mathematik.tu-dortmund.de
Subject: Re: bug#55178: ghc cannot find libraries of ghc-comonad
Date: Fri, 22 Sep 2023 18:45:04 +0200
Hi Christoph,

On Sat, 21 Jan 2023 at 13:49, Lars-Dominik Braun <lars <at> 6xq.net> wrote:

>> guix shell --pure ghc ghc-comonad gcc-toolchain -- ghc LinkMe.hs
>> [1 of 1] Compiling Main             ( LinkMe.hs, LinkMe.o )
>> Linking LinkMe ...
>> ld: cannot find -lHScomonad-5.0.8-KDPzf2kORSz9Qeif8nQH6d
>> ld: cannot find -lHStransformers-compat-0.6.6-9ADqfwGTALm8Nq2ZeUpa4p
>> ld: cannot find -lHSindexed-traversable-0.1.1-Dfr00dUbJtB3rFEVdhtcE9
>> ld: cannot find -lHSdistributive-0.6.2.1-L7rr3EplzD03NITUnJxmCO
>> ld: cannot find -lHStagged-0.8.6.1-EiQY3za6Q5HE9cdvqupke2
>> ld: cannot find -lHSbase-orphans-0.8.5-Iz1X6ZIULaHC76vf03czEu
>> collect2: error: ld returned 1 exit status
>> `gcc' failed in phase `Linker'. (Exit code: 1)
>
> the problem here is that in Guix we link Haskell executables dynamically
> and sometimes move static libraries to a separate output without updating
> the config file (because otherwise it would create a reference, which
> we’re trying to avoid to save space).
>
> It works fine for me using
>
> 	guix shell --pure ghc ghc-comonad gcc-toolchain <at> 10 -- ghc --make -dynamic -v LinkMe.hs

Does it fix your issue report in #55178?

    https://issues.guix.gnu.org/issue/55178

Closing?

Cheers,
simon




Information forwarded to bug-guix <at> gnu.org:
bug#55178; Package guix. (Tue, 03 Oct 2023 21:30:02 GMT) Full text and rfc822 format available.

Message #14 received at 55178 <at> debbugs.gnu.org (full text, mbox):

From: cschumac <cschumac <at> mathematik.tu-dortmund.de>
To: Simon Tournier <zimon.toutoune <at> gmail.com>
Cc: 55178 <at> debbugs.gnu.org, christoph.schumacher <at> mathematik.tu-dortmund.de,
 Lars-Dominik Braun <lars <at> 6xq.net>
Subject: Re: bug#55178: ghc cannot find libraries of ghc-comonad
Date: Tue, 03 Oct 2023 23:29:02 +0200
Dear Lars, dear Simon,

yes, the solution works!
And even better: compilation now also works without the -dynamic flag!
I tried my minimal example again, and both

guix shell --pure ghc ghc-comonad gcc-toolchain <at> 10 -- ghc --make 
-dynamic -v LinkMe.hs

as well as

guix shell --pure ghc ghc-comonad gcc-toolchain -- ghc LinkMe.hs

produce working executables.
Thank you very much!




Reply sent to Simon Tournier <zimon.toutoune <at> gmail.com>:
You have taken responsibility. (Wed, 04 Oct 2023 18:17:02 GMT) Full text and rfc822 format available.

Notification sent to christoph.schumacher <at> mathematik.tu-dortmund.de:
bug acknowledged by developer. (Wed, 04 Oct 2023 18:17:02 GMT) Full text and rfc822 format available.

Message #19 received at 55178-done <at> debbugs.gnu.org (full text, mbox):

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: cschumac <cschumac <at> mathematik.tu-dortmund.de>
Cc: christoph.schumacher <at> mathematik.tu-dortmund.de, 55178-done <at> debbugs.gnu.org,
 Lars-Dominik Braun <lars <at> 6xq.net>
Subject: Re: bug#55178: ghc cannot find libraries of ghc-comonad
Date: Wed, 04 Oct 2023 19:59:36 +0200
Hi,

On Tue, 03 Oct 2023 at 23:29, cschumac <cschumac <at> mathematik.tu-dortmund.de> wrote:

> yes, the solution works!

Cool!  I mark as done.

Cheers,
simon




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 02 Nov 2023 11:24:13 GMT) Full text and rfc822 format available.

This bug report was last modified 176 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.