-
Notifications
You must be signed in to change notification settings - Fork 848
Can't use system GHC without static libraries at all #3409
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
Comments
Hmm, sounds like a deficiency in the arch distribution of ghc. I recommend using stack to install ghc via Is there anything stack can do here? Only thing I can think of is maybe detecting the condition and telling the user what to do about it. |
Implement an ability to build Setup with
|
Perhaps it makes sense to always build Setup.hs with Strange that arch would break this, I wonder what the justification is. |
Two reasons not to:
I'm not sure how
As shown above the problem is not specific to GHC without static libraries. Arch just exposed an obscure scenario of dynamic linking which is supported by other tools but not by stack. In general, if I want a static result - then a need to build dynamic versions of dependencies only extends build time. |
Note that if I do
|
If I understand correctly (I don't use Arch) Arch's GHC doesn't work with |
So the dynamic-only scenario seems supported fully neither by stack nor by cabal-install. I also tried to build a dynamically-linked executable (a GTK hello word using What do you think? Also, static-only compilation works fine (e.g. on Windows where there are no dynamic support since 7.8.x until 8.4.x). Is such asymmetry ok? I'm sort of trying to understand which combinations of linking are supported by design and which are not, and why it is so. Should I discuss this somewhere upstream? With GHC guys or with Cabal guys? |
I do not fully understand all the intricacies of this issue and why stuff breaks, but in principle I think that having dynamic-only compilation work out of the box with our standard tools is a desirable goal. If someone would investigate and fix the relevant issues in the Cabal library, Stack would most likely "just work" too. |
FYI, there is a ghc-static package in Arch that contains static libraries for GHC boot libraries. An alternative package db is also provided so you can avoid any other installed haskell-* packages causing confusion to Cabal. An example of how this would work:
GHC itself cannot be built in dynamic only yet (the "vanilla" way must be present), but it's really nice to have that and also tools like cabal-install and stack supporting this setup in the future. There is also an ArchHaskell repository that contains all static libraries, which should be more suited for Haskell developers using Arch. The dynamic-only haskell-* libraries in [community] are present to support generic tools like pandoc, git-annex, and so on. |
In other words, both
Stack-shipped ghc works, but Stack builds both static and dynamic versions (still lacks a feature). BTW, it's possible to build
The problem here is that For Stack I think the situation is even more complex. As Stack wants to share packages, it will have to track which packages have which linking, or even to have 2 separate caches for static and for dynamic versions. I wonder what is the situation with profiling libraries in this regard? I also found some work on making dynamic-only setup working upstream at GHC Trac: So it seems that dynamic-only is an officially a supported configuration, and we can elevate the issue to upstream. So far only |
Profiling libraries for the boot libraries are included in the ghc-static package. Also you may want to know that all the official Arch repositories will not support i686 soon: https://www.archlinux.org/news/phasing-out-i686-support/ |
Ok, there exists an upstream bug in Cabal since 2014: |
@nponeccop Thanks, this is helpful. If haskell/cabal#1720 is the only issue that needs to be fixed, it should be quite easy to implement. I can look into it once I'm back from ICFP. |
@23Skidoo any progress? |
I just ran into the same issue. It appears to be impossible to make Stack build a Hakyll site, even when sticking system-ghc: true
ghc-options:
"$everything": -dynamic
apply-ghc-options: everything
rebuild-ghc-options: true into library-vanilla: False
shared: True
executable-dynamic: True
ghc-options: -dynamic into
I.e. |
Same issue, exactly as described by @devurandom #3409 (comment) I'm surprised, configure/build ghc options specified in Because we moved to new systems with GHC installations set for dynamic linking, we were forced to drop |
General summary/comments
Recent ArchLinux ships system GHC without static libraries at all. Even without static versions of ghc builtin libraries.
Can I use this ghc with Stack?
The problem is that even
Setup.hs
needs-dynamic
.Steps to reproduce
stack new simple
-dynamic
to thesimple-exe
targetstack build
Expected
libHSCabal-1.24.2.0-ghc8.0.2.so
and so on.simple-exe
executable is dynamically linked tolibHSsimple-0.1.0.0-5DX8evVT2MQPefjCl7ERW-ghc8.0.2.so
Actual
stack build
fails at setup-exe-cache linker stage, unable to find dynamic libraries:Note that I can copy the long command line from
Creating process:
log line and create a dynamically linked Setup by appending-dynamic
option.And in case of the
simple
project I can then useSetup build
to build a dynamically linkedsimple-exe
.But in case of more complex projects it obviously doesn't work as
Setup build
doesn't install dependencies.Stack version
Method of installation
.local/bin
)The text was updated successfully, but these errors were encountered: