Attention is currently required from: Timur Davydov, laforge, neels.
pespin has posted comments on this change by Timur Davydov. ( https://gerrit.osmocom.org/c/libosmocore/+/41813?usp=email )
Change subject: Add Emscripten build support and JS callback logging backend ......................................................................
Patch Set 7:
(8 comments)
Commit Message:
https://gerrit.osmocom.org/c/libosmocore/+/41813/comment/30386498_18ab323e?u... : PS5, Line 7: Add Emscripten build support and JS callback logging backend
Thanks for pointing this out. […]
I'm still lacking a rationale here on why do you want to run libosmocore on a web environment. Can you explain what's your exact final aim? what are you trying to exactly accomplish with this? You want to run eg. osmo-sgsn on a web browser? What's the benefit of running osmo-sgsn in a browser instead of directly on linux?
Please understand I need to understand the big picture before being able to figure out whether this patch is the correct step towards that approach.
File src/core/Makefile.am:
https://gerrit.osmocom.org/c/libosmocore/+/41813/comment/ed7d6e4c_38b04362?u... : PS7, Line 49: logging_emscripten.c \ You need to add it conditionally based on the autoconf variable.
File src/core/logging_emscripten.c:
https://gerrit.osmocom.org/c/libosmocore/+/41813/comment/f33f3ed8_9f6c2d44?u... : PS7, Line 24: /*! \addtogroup logging This file should actually not even compiled in whenever not building for EMSCRIPTEN. You need to add it conditionally in src/core/Makefile.am based on the autoconf variable. Then you can remove the "if defined(__EMSCRIPTEN__) from this file".
File src/core/netdev.c:
https://gerrit.osmocom.org/c/libosmocore/+/41813/comment/0e031e8f_60eeccc2?u... : PS5, Line 67: #if (!EMBEDDED) && !defined(__EMSCRIPTEN__)
Fully agree, that's cleaner and more in line with the rest of the library. […]
Do you mind sharing why can't you compile netdev.c in emscripten? due to some API not available? Then I'd prefer testing for that culprit in configure.ac and disable build of netdev based on that here maybe.
Let's first figure out what's blocking you from adding it.
File src/core/socket.c:
https://gerrit.osmocom.org/c/libosmocore/+/41813/comment/1573951b_947db1c1?u... : PS5, Line 2050: #ifdef HAVE_LIBSCTP
Explained in the comment for the function `osmo_sock_multiaddr_get_ip_and_port`
Submit a new separate patch with proper description of the problem and the fix.
https://gerrit.osmocom.org/c/libosmocore/+/41813/comment/ad16e25a_28cc9b5d?u... : PS5, Line 1928: #ifdef HAVE_LIBSCTP
However, libosmo-netif uses some of them without the same HAVE_LIBSCTP guards
Do you mind sharing where does that happen? this should be fixed. IIRC we do test the "no libsctp" configuration in jenkins builds.
In any case, please submit separate patches for each of those problems, so we can discuss them independently.
File src/core/socket.c:
https://gerrit.osmocom.org/c/libosmocore/+/41813/comment/1b558d89_a4bbf348?u... : PS7, Line 1698: #if defined(__linux__) || defined(__EMSCRIPTEN__) this is becoming more complex, we should ideally have a configure.ac test trying to compile a sample program using struct in6_addr s6_addr32 field and then set a HAVE_IN6_ADDR_s6_addr32 define.
File src/vty/Makefile.am:
https://gerrit.osmocom.org/c/libosmocore/+/41813/comment/04bf4db6_ab6abbd9?u... : PS5, Line 36: libosmovty_la_SOURCES += telnet_interface_dummy.c
In Emscripten there are no sockets so telnet_interface.c fails to compile.
How it comes you are building socket.c just fine then? To me it sounds that the culprit is more specific. Let's properly identify it before understanding what needs to be done, then probably submit a separate patch.