waku-org / nwaku

Waku node and protocol.
Other
182 stars 46 forks source link

[Milestone] Bindings (android and ios) #2620

Open richard-ramos opened 1 week ago

richard-ramos commented 1 week ago

Background

Epic: https://github.com/waku-org/nwaku/issues/2420

Details

Pack nwaku into a package that can be used in Android and Iphone devices

richard-ramos commented 1 week ago

Work for Android is being done in this branch. https://github.com/waku-org/nwaku/tree/android Current progress is: I was able to pack the package into a set of shared libraries (for all architectures). While attempting to run an example app built with https://github.com/richard-ramos/gonimffi (just to get nwaku to start), I ran into this error:

04-18 08:35:15.836 30619 30697 E libc++abi: terminating with uncaught exception of type std::runtime_error: Unable to retrieve jni environment. Is the thread attached?

This is generated in https://github.com/waku-org/nwaku/blob/master/library/waku_thread/waku_thread.nim#L124

  waitFor ctx.respSignal.wait()

I'm trying to debug the reason behind this error, although it seems to be due to an invalid usage of waitFor

richard-ramos commented 1 week ago

More progress in https://github.com/waku-org/nwaku/tree/android:

I'm now able to initialize a node, and presumably start it as well? I set the config to listen to port 42342, and according to android shell, the app is listening to it once I call waku_start.

emu64x:/ # netstat -puta                                                                                                                      
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program Name
tcp        0      0 0.0.0.0:42342           0.0.0.0:*               LISTEN      27028/com.awesomeproject

I'm trying to figure out how to set nim-chronicles to log to android system messages instead of logging to stdout, to see waku logs

richard-ramos commented 1 week ago

It's alive! :zombie_man:
image