iffy / wiish

Why Is It So Hard (to make a cross-platform app)?
MIT License
116 stars 7 forks source link

pixieNoSimd required to make Android work #110

Open ajusa opened 1 year ago

ajusa commented 1 year ago

The error message I am getting is this

  jni/src/x86_64/@mmain_desktop.nim.c:254: error: undefined reference to 'atmdotdotatsdotdotatsdotnimbleatspkgsatspixieminus5dot0dot4atspixieatssimddotnim_Init000'
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)

Source code is this:

import wiish/mobileutil
import wiish/plugins/webview

var app = newWebviewApp()
app.start("https://www.wikipedia.org", title = "Wiish Webview Demo")

I'm basically just trying to get the basic webview example building and running on Android. I believe I've got Android studio set up and running correctly, but it seems like it is failing to link against the SIMD module in Pixie? Is there any additional configuration I'm expected to do?

iffy commented 1 year ago

I've had to add this to my config.nims file:

switch("d", "zippyNoSimd")
switch("d", "crunchyNoSimd")
switch("d", "pixieNoSimd")

Pixie is used in an unrelated part of the build process, so I consider that you need to add this a bug.

ajusa commented 1 year ago

Ah, thanks that did solve the problem!

Unrelated question - do you know if it is possible to start up a web server locally and have wiish connect to that? I'm trying to do the following:


import wiish/mobileutil
import wiish/plugins/webview
import mummy, mummy/routers

proc indexHandler(request: Request) =
  var headers: HttpHeaders
  headers["Content-Type"] = "text/plain"
  request.respond(200, headers, "Hello, World!")

var router: Router
router.get("/", indexHandler)

let server = newServer(router)
echo "Serving on http://localhost:8080"

proc appProc() {.gcsafe.} = 
  {.cast(gcsafe).}:
    server.serve(Port(8080))

var appThread: Thread[void]

createThread(appThread, appProc)

server.waitUntilReady(5)
var app = newWebviewApp()
app.start("https://localhost:8080", title = "Wiish Webview Demo")

However, I get webpage not found error. My guess is that there is some special permission required to start up a webserver on Android? Or it isn't supported in this fashion. I haven't done much Android development so if you have any idea for what might be going wrong, I'd love to hear it :)

iffy commented 1 year ago

I'm really not an expert on Android, but I would guess maybe the s in https is causing a problem? There may also be a permission problem.

ajusa commented 1 year ago

That was it, I forgot to update that part of the URL when I swapped it out for Wikipedia. Amazing that this works as well as it does honestly, you've done a great job.

iffy commented 1 year ago

I'm amazed every time I use it :) Glad it's working for you. I'm going to leave this issue open and change the title so that I fix that pixieNoSimd thing.