-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cabal install Cabal fails with "cannot find -lgmp", even though libgmp-dev is installed #5280
Comments
Further note to add that this is preventing me installing anything through Cabal at all. Ubuntu 18.04 |
Can you compile a C program that uses |
I’m not sure how to know if that is needed for these but I compiled both ghc and cabal-install from source. I recently installed these things in the same process on a different OS without issue (this is Ubuntu 18.04 beta, that was AVLinux Debian). |
Where did you install GHC from? For Ubuntu 18.04 I'd recommend using the ghc packages from my PPA https://launchpad.net/~hvr/+archive/ubuntu/ghc which track dependencies such as |
Ah I see that this does have the versions I’m looking for. I just ‘automatically’ followed the same process which had previously worked for me on the Debian system, but I’ll try this ppa for Ubuntu - logically it seems like it should solve the problem. |
Update: Added that ppa and installed ghc, cabal-install & stack. Getting the same message with all. This is from a
I've also installed Very probable that I've caused this by building the source version first. This is a fresh OS install so I'm going to refresh it in an hour or so and see if the behavior changes. |
Completely fresh Ubuntu install, fully updated/upgraded install of haskell-stack installed using
|
@OscarSouth What happens if you try to compile and run this example with |
The part that confuses me is this occurence of that's not what you'd get on a "fresh ubuntu" install; you seem to be having a custom/different |
I'm having problems with a Edit: Although it's only happening when going through stack for me. |
Apologies for the delay - lot of balls in the air at the moment. @hvr I installed Miniconda before stack. I also noticed that message and assume that there's some conflict involved. I previously (in that case) got it working temporarily by installing a system level ghc externally and instructing stack to use that. I reformatted my system to an Arch Linux based install and installed in the reverse order - doesn't seems to have caused an issue so far but I'll report back if anything comes up. Maybe worth noting that installing Anaconda/Miniconda before stack can cause an issue. |
Looks like this was some system configuration fiasco, so not a bug in |
I've just come across a similar problem in an internal support ticket. I don't know a solution (perhaps disable Conda, perhaps install gmp into conda? I don't know.) I do want to leave this diagnostic tool for anyone who comes across errors to do with not being able to find libgmp. Please run the following:
|
I can now explain one reason why this might happen. An Anaconda environment with gcc and ld installed (
If ghc is installed via ghcup then
Then it creates a file
Now every time that This behaviour might even be OK if Anaconda could provide libgmp straightforwardly. It does not. I'm not sure what incantations one is supposed to utter to expose Anaconda's gmp to Anaconda's ld but it is not accessible by default. I have to specify both
I am not aware of any way of telling cabal or ghc to pass these flags to the toolchain subprocesses it calls, but one wouldn't want to have to do that anyway; it's far too messy. Given the directory that gmp and its headers are in this problem must apply to every package that's installed via Anaconda. I don't know how Anaconda users are supposed to access the libraries they have installed through it. Perhaps with Make CFLAGS, configure, or something else. SummaryIf you installed ghc through ghcup, stack or the source or binary distributions whilst an Anaconda environment containing |
Thanks |
Yes, I had to remove anaconda3 too from Ubuntu 18.04. Thank you. |
Pop-os 22.04 here (basically an ubuntu). Fresh installation through ghcup (I didn't install stack ) mkdir graham-hutton-haskell && cd graham-hutton-haskell
cabal init
cabal run
Resolving dependencies...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
- graham-hutton-haskell-0.1.0.0 (exe:graham-hutton-haskell) (first run)
Preprocessing executable 'graham-hutton-haskell' for graham-hutton-haskell-0.1.0.0..
Building executable 'graham-hutton-haskell' for graham-hutton-haskell-0.1.0.0..
Linking /home/frederic/devel/learning/graham-hutton-haskell/dist-newstyle/build/x86_64-linux/ghc-8.10.7/graham-hutton-haskell-0.1.0.0/x/graham-hutton-haskell/build/graham-hutton-haskell/graham-hutton-haskell ...
/usr/bin/ld.gold: error: cannot find -lgmp
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1) Any clue ? |
@FredericLatour it may be better to open a new issue, as yours look sufficiently different. Have you tried #5280 (comment)? |
Also, have you installed both of libgmp10 and libgmp-dev? https://www.reddit.com/r/haskellquestions/comments/sxvcas/comment/hykh0uv/ |
@FredericLatour Have you inspected the contents of |
@ulysses4ever @tomjaguarpaw After reading the reddit link, I just installed the mentioned libs sudo apt-get install libgmp10 libgmp-dev And it worked. It's entirely possible that I didn't pay attention to some message telling me those libs were missing. That being said, it would be a good idea to add, on the ghcup installation page, a warning/recommendation to pay attention to any message related to missing libs. Haskell language seems like a thing of beauty, however setting up a working env is really challenging.
I had therefore decided to start my Haskell journey without installing stack, however, for some reason, vscode extension says that I need to download stack-2.7.5. In any cases, thanks for pointing me into the right direction. |
Frankly, I'd start minimalist. A text editor, cabal or stack in a terminal. Make sure you are able to do all basic things and learn how it all works. It's not too complex. If you are modifying a project that has a well maintained stack configuration file, go with stack. If not, I'd use cabal. HLS adds a lot of value (that's the extension, right?) and vscode probably adds too much value, but they come with their own problems and postpone the moment you feel in control, if ever. |
@Mikolaj Thanks for the suggestion. However, vscode being my everyday editor, I'd rather stick with it.. |
Oh, apologies. In any case, stack uses cabal under the hood and they are not that different, until you need to port a large project to a newer GHC (at which point with cabal it's instant, but the project crashes, and with stack it's super slow and if you use a standard enough set of packages and versions, the project works), so don't worry. |
For what it's worth, my sense is generally that |
My linux install is somewhat messed up since I tried to install haskell missing libs. |
I hope there are many Haskell dev containers. E.g., here is one family focused on static linking: https://github.com/utdemir/ghc-musl/. We even use a container in our CI, I think, but that one is ancient. |
ghc-musl container is not necessary. In CI we just use alpine. That's enough. |
I was thinking of a “VS Code” development container. When I decided to learn Haskell, finding a VS Code dev container was my first bet (practical, easy to install, ...). Of course, it's open source and I can't assume anything for granted. That being said, having an official VS Code dev container available directly from the Haskell website would be, in my mind, a game changer for leveraging Haskell learning or adoption. |
Right. I'm afraid it may be hard to find any volunteer here. The same with GHC HQ and Haskell.org. I think people decided to focus on ghcup and not confuse newcomers with a dozen options in various stages of decay or just not updated to the latest toolset for a month or two, which is absolutely reasonable, but a horror to a neecomer that tries to follow the newest tutorial or fool around with a new feature from latest release notes. Perhaps on any of the Haskell-VS forums people can be persuaded or they already use something like that. Really no idea. Please stick around, though. :) |
That's too unspecific to make someone help you. |
@hasufell In the end, things seem to be working now but here is my experience :
Just to say that the overall experience in order to get a working Haskell config was really painful. I had the project of having my son learn the language as well, but he is running windows, and I'm not sure if I want to mess up with his config. A properly configured "VS Code" development container would make it for a way better experience. |
@FredericLatour, thank you for sharing. I really appreciate the time you spent beyond just getting things fixed for yourself. In a better world somebody would even be able to act on it, but oh well. :) |
Yes, you didn't pay attention.
In my experience people who don't pay attention to prompts (you have to press enter when it tells you to install the libs) also won't pay attention to details on the website. Duplicating existent clearly visible information is not the solution. You went on doing some configuration and further installation and a distro upgrade or whatnot, not remembering any of it. Which leads me to believe you didn't pay attention to what you did there either. For people who don't want to pay attention to toolchain management at all, ghcup might not be the right choice, but something like an online playground, like https://play-haskell.tomsmeding.com/ There are more elaborate services that support Haskell and just require you to type code, I think. |
@FredericLatour I'd like to echo @Mikolaj: thank you very much for the feedback. It's very helpful for us to know details about user experience so we can (hopefully) improve things. That said, I'm still confused by a couple of your points:
I don't understand what this means. Are you claiming that GHCup stopped you from being able to update your Linux system somehow? Could you please elaborate? |
@FredericLatour thank you for the overview of your experience so far. I’m really sorry you had so much trouble with setting things up and hope that you’ll get more luck in the future. This kind of environment issues (missing shared libs) is tricky to debug remotely, unfortunately… I have a question for you, though: you mention a developer container several times; could you reference a similar setup to what you have in mind about this container implemented and advertised for another language / ecosystem (Rust, NPM, whatever looks close enough to you)? |
Hmm, sorry, didn't mean to reopen. |
Yes it is, which is why it would be nice to have some sort of diagnostic tool. |
@hasufell Not sure why you are being so unpleasant - do you think I'm stupid, and you are smart ? :
Before running
No specific warning related to possible missing libs.
Being warned of paying attention to some kind of initial diagnostic message that, as far as I can see is not accessible afterward, is not "duplicating information" in my book.
You got this in a crystal ball ?
Sounds perfectly legit that one is not interested with the intricacies of an installation while learning or evaluating some language / platform.
What does that ever mean ? |
Not at all. But I'm convinced that in this case the problem is the user. The ghcup homepage lists help channels for that reason, where helpful people (like me) give real time assistance. I'm afraid your input so far doesn't allow me to improve ghcup user experience. |
No, Ghcup is not at fault here. This happened following the installation of a couple missing libraries. Installing those libs fixed my initial Hasell installation but, for some reason, made it impossible to update (apt upgrade) my system. |
Yeah, I think this is not the right place for distro support. And we're not having enough information for this to be useful to others. Please open a proper bug report if you have accurate information. |
@hasufell I was answering to someone else, as the quote should have told you. |
Bonsoir @FredericLatour, your feedback is greatly valued.
|
Personally I am very grateful that @FredericLatour is continuing to participate in the discussion because it's improving my understanding of how new users experience Haskell onboarding. This is the cabal issue tracker though, so we defer to them regarding whether they would like the discussion to move elsewhere. For what it's worth, I think that when I was a new user I could easily have missed the instructions to install the necessary libraries. That's why I think a technical solution like a diagnostic tool could be useful. |
A couple of suggestions though:
That being said, I understand perfectly that you or the Haskell community doesn't owe me anything. |
Bonsoir (did my accent betrayed me? :) ) @ffaf1
|
Tom, please continue. There's absolutely no reason to stifle this or, currently, any other discussion on this but tracker by referring to who owns which bug tracker (I do) and what is permitted and what is not. OTOH, everybody is free to voice opinions on what kind of feedback is useful or not and to offer suggestions. Internet is a difficult medium so we can count on frequent misunderstandings and we have to gracefully go through that. :) |
I've successfully used those and a couple of other dev containers as well: Here is the github repository that contains many VS Code dev containers: The VS code dev container experience is great:
If you look at the GitHub folder, you can see there is a Haskell dev. Container. For some reasons, it didn't work for me. Now that I have a bit more insight (not much though), I may give it another try. |
Just in case,there is am ongoing pr to the haskell dev container: microsoft/vscode-dev-containers#1478 Also hls itself has a gitpod configuration which lets you use that online devcontainer service: https://github.com/haskell/haskell-language-server/blob/master/.gitpod.yml |
This helped me aswell |
I haven't had much time to dedicate to Haskell those days (which is a shame as I've loved every bit of my journey with the language). That being said, for what is worth, the vscode dev container that is provided with works pretty well (in particular, IO as well). For those who would like to learn the language without the hassle of installing the complete environment on their system, this is a great resource. |
cabal install Cabal
(or any other method of installation) fails with the following message:However, libgmp-dev is installed
The text was updated successfully, but these errors were encountered: