obsidiansystems / obelisk

Functional reactive web and mobile applications, with batteries included.
https://reflex-frp.org
BSD 3-Clause "New" or "Revised" License
949 stars 104 forks source link

Problem with diagrams dependency and zlib #1094

Open romefeller opened 1 week ago

romefeller commented 1 week ago

This is related to https://github.com/obsidiansystems/obelisk/issues/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 commented 1 week ago

I don't fully understand. Is this dependency only needed in the backend? Or is it needed in both backend and frontend? If only the frontend, did you try using the if-statements I mentioned, so that the dependency won't build on the frontend, but only the backend? It's strange that you have the same issue when using ob run.

On Wed, Sep 4, 2024, 21:09 Alexandre Garcia de Oliveira < @.***> wrote:

This is related to #1068 https://github.com/obsidiansystems/obelisk/issues/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?

— Reply to this email directly, view it on GitHub https://github.com/obsidiansystems/obelisk/issues/1094, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIP4YRLA6QVIROYYMT4LT23ZU5LINAVCNFSM6AAAAABNU6S4ZOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGUYDMMBYHE2DGNY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

walseb commented 1 week ago

Oops, wrong account.

romefeller commented 1 week ago

@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 commented 1 week ago

@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.