Skip to content
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

Problem with diagrams dependency and zlib #1094

Open
romefeller opened this issue Sep 4, 2024 · 4 comments
Open

Problem with diagrams dependency and zlib #1094

romefeller opened this issue Sep 4, 2024 · 4 comments

Comments

@romefeller
Copy link
Contributor

This is related to #1068

I encountered the same problem with zlib. Even after following the steps mentioned in the issue, I still run into problems when using ob run AND nix-build. When I try to use nix-build, the zlib issue reappears, because I need a frontend dependency in the backend executable. If I remove this dependency, I can't run the frontend app. I also tried serving the compiled frontend.jsexe statically, but without success.

Here's my default.nix:

{ system ? builtins.currentSystem
, obelisk ? import ./.obelisk/impl {
inherit system;
iosSdkVersion = "16.1";

# You must accept the Android Software Development Kit License Agreement at
# https://developer.android.com/studio/terms in order to build Android apps.
# Uncomment and set this to `true` to indicate your acceptance:
# config.android_sdk.accept_license = false;

# In order to use Let's Encrypt for HTTPS deployments you must accept
# their terms of service at https://letsencrypt.org/repository/.
# Uncomment and set this to `true` to indicate your acceptance:
# terms.security.acme.acceptTerms = false;

}
}:
with obelisk;
project ./. ({ pkgs, hackGet, ... }: {
android.applicationId = "systems.obsidian.obelisk.examples.minimal";
android.displayName = "Obelisk Minimal Example";
ios.bundleIdentifier = "systems.obsidian.obelisk.examples.minimal";
ios.bundleName = "Obelisk Minimal Example";
overrides = self: super: {
frontend = super.frontend.overrideScope (self: super: {
fsnotify = pkgs.haskell.lib.dontCheck (self.callHackage "fsnotify" "0.2.1.2" {});
zlib = pkgs.haskell.lib.dontHaddock (super.zlib.override { zlib = null; });
});
backend = super.backend.overrideScope (self: super: {
frontend = super.frontend;
zlib = pkgs.haskell.lib.dontHaddock (super.zlib.override {
zlib = pkgs.zlib;
});
});
};
})

Any suggestions or ideas on how to resolve this?

@walsebnews
Copy link

walsebnews commented Sep 4, 2024 via email

@walseb
Copy link

walseb commented Sep 4, 2024

Oops, wrong account.

@romefeller
Copy link
Contributor Author

romefeller commented Sep 4, 2024

@walseb I managed to get it working for the other packages, but I can't do the same with the frontend in the backend executable. The backend fails to build because it tries to rebuild the frontend (I tried to stop this by making a frontend drv, but this was a bad idea), and that triggers the same zlib issue again.

The conditional fix worked for packages in the frontend, but now the backend is causing problems.

The problem happens here (I cannot use frontend dep):

executable backend
main-is: main.hs
hs-source-dirs: src-bin
ghc-options: -Wall -O -fno-show-valid-hole-fits -threaded
-- unsafe code
-Wincomplete-record-updates -Wincomplete-uni-patterns -Wpartial-fields
-- unneeded code
-Widentities -Wredundant-constraints
if impl(ghc >= 8.8)
ghc-options:
-Wmissing-deriving-strategies
if impl(ghcjs)
buildable: False
build-depends: base
, backend
, common
, obelisk-backend

@maralorn
Copy link
Contributor

maralorn commented Sep 7, 2024

@romefeller There should never be a ghcjs build of backend happening, so the conditionals in the backend.cabal are probably indicative of another problem. Also frontend cannot have fs-notify or zlib in their dependency closure. If you need that you have to redesign your app. Maybe you can fix that by moving the dependencies from common to backend?

Generally building the exe builds the backend with ghc and the frontend as ghcjs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants