* Haskell program build and run using Cabal
@ 2021-04-11 3:23 Bone Baboon
2021-04-11 13:12 ` Gary Johnson
0 siblings, 1 reply; 4+ messages in thread
From: Bone Baboon @ 2021-04-11 3:23 UTC (permalink / raw)
To: help-guix
I am trying to build a Haskell program from source and run it. I am
using Cabal a Haskell build tool to do this. I am able to build and run
this program without the following error messages on other Linux
operating systems.
`cabal --version` outputs:
```
cabal-install version 2.4.0.0
compiled using version 2.4.0.1 of the Cabal library
```
I have installed GHC a Haskell compiler. When I run `ghc --version` it
outputs:
```
The Glorious Glasgow Haskell Compilation System, version 8.6.5
```
When I run `cabal new-build` it outputs:
```
cabal: Use of GHC's environment variable GHC_PACKAGE_PATH is incompatible with Cabal. Use the flag --package-db to specify a package database (it can be used multiple times).
```
After running `unset GHC_PACKAGE_PATH` I can build the program with
`cabal new-build`. `unset GHC_PACKAGE_PATH` does not persist across
different terminal emulator instances.
Then when I try to run the program using `cabal new-run` I get this
error message:
```
error while loading shared libraries: libgmp.so.10: cannot open shared object file: No such file or directory
```
I added `gmp` to my system configuration and reconfigured the system.
However the error persists.
The command `locate libgmp.so.10` shows that libgmp.so.10 is in the
store.
Doing an internet search for this error message shows people dealing
with it by setting environment variables.
With Cabal's `new-build` and `new-run` commands I am running into issues
with environment variables. Are environment variables managed in Guix
system configurations? I searched the Guix manual for the search term
"environment variable" and did not see a prominent section on
environment variables. That leads me to guess that in Guix environment
variables are left to configuration files in the users home directory.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Haskell program build and run using Cabal
2021-04-11 3:23 Haskell program build and run using Cabal Bone Baboon
@ 2021-04-11 13:12 ` Gary Johnson
2021-04-11 16:11 ` John Soo
2021-04-11 17:31 ` Bone Baboon
0 siblings, 2 replies; 4+ messages in thread
From: Gary Johnson @ 2021-04-11 13:12 UTC (permalink / raw)
To: Bone Baboon; +Cc: help-guix
Bone Baboon <bone.baboon@disroot.org> writes:
> I am trying to build a Haskell program from source and run it. I am
> using Cabal a Haskell build tool to do this. I am able to build and run
> this program without the following error messages on other Linux
> operating systems.
>
> [snip]
>
> Doing an internet search for this error message shows people dealing
> with it by setting environment variables.
>
> With Cabal's `new-build` and `new-run` commands I am running into issues
> with environment variables. Are environment variables managed in Guix
> system configurations? I searched the Guix manual for the search term
> "environment variable" and did not see a prominent section on
> environment variables. That leads me to guess that in Guix environment
> variables are left to configuration files in the users home directory.
Guix System (unsurprisingly) has a built-in preference for building
packages with Guix. For building Haskell programs, check out the
`haskell-build-system`, which uses cabal and ghc under the hood.
Also, if the package you want to install exists on Hackage
(https://hackage.haskell.org) but doesn't have a corresponding Guix
package, you should check out the Guix hackage importer:
$ guix import hackage -r PACKAGE-NAME@VERSION
This can auto-generate a Guix package definition for the corresponding
Hackage package that you can then use to install it through Guix.
Finally, to answer your question about environment variables, you should
stick them in your home directory under your shell configuration script
(e.g., ~/.bashrc, ~/.bash_profile).
Happy hacking,
Gary
--
GPG Key ID: 7BC158ED
Use `gpg --search-keys lambdatronic' to find me
Protect yourself from surveillance: https://emailselfdefense.fsf.org
=======================================================================
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
Why is HTML email a security nightmare? See https://useplaintext.email/
Please avoid sending me MS-Office attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Haskell program build and run using Cabal
2021-04-11 13:12 ` Gary Johnson
@ 2021-04-11 16:11 ` John Soo
2021-04-11 17:31 ` Bone Baboon
1 sibling, 0 replies; 4+ messages in thread
From: John Soo @ 2021-04-11 16:11 UTC (permalink / raw)
To: Gary Johnson, Bone Baboon; +Cc: help-guix
[-- Attachment #1: Type: text/plain, Size: 495 bytes --]
Hello,
There are a few problems with the ghc ecosystem in guix right now (unless they have been fixed in the last month or so). The following is relevant to you.
Our version of cabal-install is incompatible with the default ghc version: http://issues.guix.gnu.org/45055
The fix for this is to use ghc@8.6.
From there you can use cabal as normal, but without the $GHC_PACKAGE_PATH variable set, i.e.:
$ env -u GHC_PACKAGE_PATH cabal new-build
I hope that helps.
Kindly,
John
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 860 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Haskell program build and run using Cabal
2021-04-11 13:12 ` Gary Johnson
2021-04-11 16:11 ` John Soo
@ 2021-04-11 17:31 ` Bone Baboon
1 sibling, 0 replies; 4+ messages in thread
From: Bone Baboon @ 2021-04-11 17:31 UTC (permalink / raw)
To: Gary Johnson; +Cc: help-guix
Gary Johnson writes:
> Guix System (unsurprisingly) has a built-in preference for building
> packages with Guix. For building Haskell programs, check out the
> `haskell-build-system`, which uses cabal and ghc under the hood.
>
> Also, if the package you want to install exists on Hackage
> (https://hackage.haskell.org) but doesn't have a corresponding Guix
> package, you should check out the Guix hackage importer:
>
> $ guix import hackage -r PACKAGE-NAME@VERSION
>
> This can auto-generate a Guix package definition for the corresponding
> Hackage package that you can then use to install it through Guix.
>
> Finally, to answer your question about environment variables, you should
> stick them in your home directory under your shell configuration script
> (e.g., ~/.bashrc, ~/.bash_profile).
Thank you for your helpful reply.
These are the two lines I added to my `.bashrc` that resolve the error
I was getting:
```
unset GHC_PACKAGE_PATH
export LD_LIBRARY_PATH=/run/current-system/profile/lib/
```
Note: The LD_LIBRARY_PATH variables was empty. If it was not I would
have appended to the existing LD_LIBRARY_PATH variable.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-11 17:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-11 3:23 Haskell program build and run using Cabal Bone Baboon
2021-04-11 13:12 ` Gary Johnson
2021-04-11 16:11 ` John Soo
2021-04-11 17:31 ` Bone Baboon
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.