unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Using Haskell library packages - linker error
@ 2020-09-06 23:27 Jakub Kądziołka
  2020-09-07 13:50 ` Timothy Sample
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kądziołka @ 2020-09-06 23:27 UTC (permalink / raw)
  To: help-guix

[-- Attachment #1: Type: text/plain, Size: 498 bytes --]

Hello,

I am trying to set up Agda, and I have reduced it to a simpler problem:

$ cat test.hs
import Numeric.IEEE

main = return ()
$ genv --pure --ad-hoc ghc@8.6 ghc-ieee754 gcc-toolchain
% ghc test.hs
Linking test ...
ld: cannot find -lHSieee754-0.8.0-IfCS1Dp7pQVIOQRslM6kD
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)

How can I fix this error? Am I doing something wrong, or is this a
packaging bug?

Regards,
Jakub Kądziołka

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using Haskell library packages - linker error
  2020-09-06 23:27 Using Haskell library packages - linker error Jakub Kądziołka
@ 2020-09-07 13:50 ` Timothy Sample
  2020-09-07 15:29   ` Jakub Kądziołka
  0 siblings, 1 reply; 4+ messages in thread
From: Timothy Sample @ 2020-09-07 13:50 UTC (permalink / raw)
  To: Jakub Kądziołka; +Cc: help-guix

Hi Jakub,

Jakub Kądziołka <kuba@kadziolka.net> writes:

> I am trying to set up Agda, and I have reduced it to a simpler problem:
>
> $ cat test.hs
> import Numeric.IEEE
>
> main = return ()
> $ genv --pure --ad-hoc ghc@8.6 ghc-ieee754 gcc-toolchain
> % ghc test.hs
> Linking test ...
> ld: cannot find -lHSieee754-0.8.0-IfCS1Dp7pQVIOQRslM6kD
> collect2: error: ld returned 1 exit status
> `gcc' failed in phase `Linker'. (Exit code: 1)
>
> How can I fix this error? Am I doing something wrong, or is this a
> packaging bug?

GHC needs a special flag to link shared libraries.  We recently starting
building shared libraries for our Haskell packages.  The static ones are
still being built, but they go to a separate output.  I think you can
fix your problem in one of two ways:

    1. Pass the “-dynamic” flag to GHC (and maybe “-fPIC”);
    2. Use “ghc-ieee754:static”.

The first is preferred because the second could get really tricky if
there are nested dependencies.

The fact that the user experience is so wonky is a bit of packaging bug,
for sure.  I’m not sure how to make it nicer just yet.


-- Tim


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using Haskell library packages - linker error
  2020-09-07 13:50 ` Timothy Sample
@ 2020-09-07 15:29   ` Jakub Kądziołka
  2020-09-07 17:36     ` Timothy Sample
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kądziołka @ 2020-09-07 15:29 UTC (permalink / raw)
  To: Timothy Sample; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 1545 bytes --]

On Mon, Sep 07, 2020 at 09:50:51AM -0400, Timothy Sample wrote:
> Hi Jakub,
> 
> Jakub Kądziołka <kuba@kadziolka.net> writes:
> 
> > I am trying to set up Agda, and I have reduced it to a simpler problem:
> >
> > $ cat test.hs
> > import Numeric.IEEE
> >
> > main = return ()
> > $ genv --pure --ad-hoc ghc@8.6 ghc-ieee754 gcc-toolchain
> > % ghc test.hs
> > Linking test ...
> > ld: cannot find -lHSieee754-0.8.0-IfCS1Dp7pQVIOQRslM6kD
> > collect2: error: ld returned 1 exit status
> > `gcc' failed in phase `Linker'. (Exit code: 1)
> >
> > How can I fix this error? Am I doing something wrong, or is this a
> > packaging bug?
> 
> GHC needs a special flag to link shared libraries.  We recently starting
> building shared libraries for our Haskell packages.  The static ones are
> still being built, but they go to a separate output.  I think you can
> fix your problem in one of two ways:
> 
>     1. Pass the “-dynamic” flag to GHC (and maybe “-fPIC”);
>     2. Use “ghc-ieee754:static”.

ghc-ieee754:static doesn't seem to exist, but passing -dynamic does
indeed work. The workaround also translates to Agda, with

$ agda --ghc-flag=-dynamic --compile hello-world.agda

I'd really rather this wasn't necessary, though. I can already imagine
having to figure out how to pass this flag to agda through build systems
and editor plugins.

On a related note, shouldn't it be possible to use agda without
specifying ghc (and transitively, gcc) in your profile?

Regards,
Jakub Kądziołka

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using Haskell library packages - linker error
  2020-09-07 15:29   ` Jakub Kądziołka
@ 2020-09-07 17:36     ` Timothy Sample
  0 siblings, 0 replies; 4+ messages in thread
From: Timothy Sample @ 2020-09-07 17:36 UTC (permalink / raw)
  To: Jakub Kądziołka; +Cc: help-guix

Jakub Kądziołka <kuba@kadziolka.net> writes:

> On Mon, Sep 07, 2020 at 09:50:51AM -0400, Timothy Sample wrote:
>
>> GHC needs a special flag to link shared libraries.  We recently starting
>> building shared libraries for our Haskell packages.  The static ones are
>> still being built, but they go to a separate output.  I think you can
>> fix your problem in one of two ways:
>> 
>>     1. Pass the “-dynamic” flag to GHC (and maybe “-fPIC”);
>>     2. Use “ghc-ieee754:static”.
>
> ghc-ieee754:static doesn't seem to exist, [...]

Right.  It does exist, but it’s hidden from the Guix UI.  This is a
result of the finicky way the output is added.

> [...] but passing -dynamic does indeed work. The workaround also
> translates to Agda, with
>
> $ agda --ghc-flag=-dynamic --compile hello-world.agda

Cool.  That’s good to know.

> I'd really rather this wasn't necessary, though. I can already imagine
> having to figure out how to pass this flag to agda through build systems
> and editor plugins.

Absolutely.  I’ve done some of that work on our more complicated Haskell
packages, and it can get a little tricky.  To be honest, I’m not sure
how to move forward.  I know that Arch takes a similar approach to
packaging Haskell libraries, but I don’t know how they manage the
experience.

> On a related note, shouldn't it be possible to use agda without
> specifying ghc (and transitively, gcc) in your profile?

AIUI, this is following GCC.  GCC by itself doesn’t know how to find the
assembler, but the “gcc-toolchain” package manages this automatically.
Similarly, GHC doesn’t know how to find GCC, and Agda doesn’t know how
to find GHC.  We might need to make “ghc-toolchain” and “agda-toolchain”
packages (this has sorta been discussed before [1, 2]).

At the end of the day, our Haskell ecosystem is in need of some more
attention.  It’s really not far away from being nice, but it needs some
gentle nudges here and there.


-- Tim

[1] https://lists.gnu.org/archive/html/guix-devel/2018-08/msg00175.html
[2] https://lists.gnu.org/archive/html/guix-devel/2020-04/msg00318.html


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-07 17:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-06 23:27 Using Haskell library packages - linker error Jakub Kądziołka
2020-09-07 13:50 ` Timothy Sample
2020-09-07 15:29   ` Jakub Kądziołka
2020-09-07 17:36     ` Timothy Sample

unofficial mirror of help-guix@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-user/0 guix-user/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-user guix-user/ https://yhetil.org/guix-user \
		help-guix@gnu.org
	public-inbox-index guix-user

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.user
	nntp://news.gmane.io/gmane.comp.gnu.guix.user


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git