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

Ran into a few (5) little problems when trying this with the 'ob init' demo project. #1

Open
hacklschorsch opened this issue Jun 6, 2024 · 1 comment

Comments

@hacklschorsch
Copy link

hacklschorsch commented Jun 6, 2024

Thanks for this @ali-abrar, I have been stuck trying to get our Obelisk mobile app deploy and run on iOS for a while now.

However, I have a hard time getting this to run also.

(I still am a Haskell newbie, sorry if this is all obvious)

I tried to set this up with the Obelisk demo project ob init gives you.

First I fixed the Nix snippet (to have haskellLib and hackGet):

default.nix

project ./. ({ pkgs, hackGet, ... }: {
[...]
  overrides = self: super: {
    obelisk-ios-libfrontend = pkgs.haskell.lib.dontStrip (self.callCabal2nix "obelisk-ios-libfrontend" (hackGet ./dep/obelisk-ios-libfrontend + "/exe") {});
    obelisk-ios-libfrontendconfig = self.callCabal2nix "obelisk-ios-libfrontendconfig" (hackGet ./dep/obelisk-ios-libfrontend + "/lib") {};
  };

, and when trying to compile I got:

src/Frontend.hs:15:8: error:
    parse error on input ‘Obelisk.Frontend.iOS’
   |
15 | import Obelisk.Frontend.iOS
   |        ^^^^^^^^^^^^^^^^^^^^

First was a bit stuped by this error message.

After a while I found this is because "Module names are alphanumeric and must begin with an uppercase letter." (says Google).
And indeed the module is called IOS with a capital I.
(Sorry if I sound ungrateful, but have you actually tried following your own docs?)
So I changed this to a capital 'I':

frontend/src/Frontend.hs

import Obelisk.Frontend.IOS

That gives me:

src/Frontend.hs:15:1: error:
    Could not find module ‘Obelisk.Frontend.IOS’
    Perhaps you meant Obelisk.Frontend (from obelisk-frontend-0.1)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
15 | import Obelisk.Frontend.IOS
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

... so I (tried around quite a bit until I found out...) added obelisk-ios-libfrontendconfig to library's build-depends in frontend/frontend.cabal.

That gives me:

src/Frontend.hs:64:37: error:
    Variable not in scope: myHtmlHead :: StaticWidget x0 a0
   |
64 |   html <- fmap snd $ renderStatic $ myHtmlHead
   | 

... so I just define that above the pasted code, copying the header from the default 'ob init' project:

frontend/src/Frontend.hs

myHtmlHead = do
      el "title" $ text "Obelisk Minimal Example"
      elAttr "script" ("type" =: "application/javascript" <> "src" =: $(static "lib.js")) blank
      elAttr "link" ("href" =: $(static "main.css") <> "type" =: "text/css" <> "rel" =: "stylesheet") blank

... that throws a few warnings during compilation ("Top-level binding with no type signature", it really rather would have me defined a type for this, eh?) but it does build.

The last few lines of the build log include a

find: ‘install_name_tool’: No such file or directory
find: ‘install_name_tool’: No such file or directory

which is a bit strange, since I have that thing:

[nix-shell:~/Repositories/apple-obsidian-tests]$ which install_name_tool 
/nix/store/m465asx3ymh99z06zxgphh9f82f96kkc-cctools-binutils-darwin-16.0.6-973.0.1/bin/install_name_tool

but maybe this is configured to be pure and install_name_tool needs to be in some dependency list?

@hacklschorsch hacklschorsch changed the title Ran into a few little problems, here's a list of things I tried. Ran into a few (7) little problems when trying this with the 'ob init' demo project. Jun 6, 2024
@hacklschorsch hacklschorsch changed the title Ran into a few (7) little problems when trying this with the 'ob init' demo project. Ran into a few (5) little problems when trying this with the 'ob init' demo project. Jun 6, 2024
@hacklschorsch
Copy link
Author

bleh, sorry for the edits, long day staring at stuff I don't understand yet.

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

1 participant