-
Notifications
You must be signed in to change notification settings - Fork 217
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
Allow to build with cabal #2027
Allow to build with cabal #2027
Conversation
Thanks for the PR, but last time someone did this the cabal build broke pretty much the next day. But even if the It is not hard to install stack to build the project. It is also not that hard to install nix. And by building with cabal inside a nix-shell you get the correct versions of Haskell dependencies prebuilt from cache, as well as all required system libraries (e.g. systemd, libsodium), and all the build tools, including cabal itself. |
I'm using cabal as my primary tool, so I'd like to maintain these files. But I agree that CI should run cabal as well. Once I'm more familiar with those pieces, I'll be happy to provide a PR for that part as well.
That is unfortunate, but I believe that is true for nix as well (which also disables systemd for example). Synchronizing build systems always has a maintenance cost. I believe it not to be high though.
The cabal.freeze file is generated from the LTS snapshot, so the solver will choose the same, unless cabal.freeze file is modified afterwards.
I think choice is good and it is consistent with what cardano-node does, especially since this isn't just about developers, but also users trying to build the project. |
78c1610
to
b0a32b4
Compare
481e4ea
to
40c746d
Compare
ping |
bd4bf4e
to
aea38af
Compare
aea38af
to
d86ec6d
Compare
Instructions on how to update the cabal files is in the commit:
|
d86ec6d
to
7588cf8
Compare
Another good argument for this is that it unbreaks cabal on windows. |
Have you actually tried building this branch with cabal on windows? |
@Anviking did I think? |
292381e
to
371daf5
Compare
I just did and it's a major step forward for windows support. I described how to build cardano-wallet with cabal on windows here: https://gist.github.com/hasufell/0deaeb316eb8a3ad8ad9bf1266b332f8 This also has the advantage over stack that you have a properly up2date msys2 installation and it allows easy adding of native dependencies via |
Anything blocking this? There's been no further objections and the process to update the cabal files is documented. |
@hasufell may you modify the wiki as we talked about? i.e. illustrate the steps with examples and give more details about vague words like "adjust" or "disable". Consider this from the point of view of someone who is not familiar with cabal. |
I'm not sure what is missing. All the steps necessary are explained. If you would give it a shot and let me know what specifically didn't work or wasn't clear, that would be helpful. I'd suggest to use ghcup to install |
The process to create these files is as follows: 1. Run stack2cabal 2. Disable tests and benchmarks of local packages (those specified via source-repository-package... this won't be needed with cabal-3.4 anymore, because it won't treat them as local anymore) 3. Hackage packages in `packages` in `cardano-1.19.x.yaml` or `extra-deps` in `stack.yaml`, which are specified as git repositories might have different versions than the stack resolver. `stack2cabal` cannot pick these up, so these must be adjusted manually (or deleted) in `cabal.project.freeze` (at the time of writing: http-client and persistent). Rationale: 1. good to support all available tools as options for interested users 2. cabal allows easier managing of package bounds (and testing against latest package versions and different GHCs, because it is not constrained to stackage) 3. doesn't require nix, which is an additional step to set up and maintain and requires significant amount of disk space
This is mainly due to a cabal bug and should be removed in the future: haskell/cabal#5444 There are various distros, where installing development files of libsystemd won't be an option: - Alpine (doesn't have systemd at all) - Gentoo (not installable when eudev is installed) - Exherbo (not installable when eudev is installed) Users are expected to run the script and then execute cabal like so: cabal build --project-file=cabal.nosystemd.project all
371daf5
to
88df4b6
Compare
Rebased and wiki updated. |
bors try |
tryBuild failed: |
ac5e65b
to
1f5a072
Compare
The Haskell.nix shellFor function provides Haskell package dependencies and all their dependencies. This new nix/cabal-shell.nix file only provides a compiler, build tools and system libraries, and lets Cabal build the Haskell package dependencies.
Using nix-shell and "cabal build --project-file=cabal-nix.project", all Haskell dependencies will be downloaded from the IOHK cache, rather than built locally.
df2a41c
to
17c3de1
Compare
bors r+ |
Build succeeded: |
The process to create these files is roughly:
stack2cabal
unrelated packages (cabal considers all packages defined via
source-repository-package as local and will try to build its tests)
constraints were overwritten in stack.yaml files (usually raising
a version number)
Rationale:
latest package versions)
This should be the go-to fallback in case cabal project files
get out of sync for too long.