Skip to content

Spike: compile the engine to WebAssembly #171

Open

Description

@HugoFara

Result: NetCDF is the only thing preventing a WebAssembly build.

em++ -std=c++11 -fsyntax-only over all 58 files in src/: 10 compile, and all 48 failures are 'netcdf' file not found. The include appears in one place, DataBroker.h:25, and reaches everything else through transitive includes.

The rest is already isolated: MPI is behind #ifdef MPI_COUPLING, the HTTP server is 3 references, popen is one block, and termios is only in app/.

Next step: put the NetCDF parts of DataBroker.h/.cpp and load/saveArrivalTimeNC in FireDomain.cpp behind an FF_NO_NETCDF guard, then run the check again. The same guard would also enable a slim wheel without NetCDF/HDF5.

Not tested yet: linking, running, binary size. Threads need SharedArrayBuffer and COOP/COEP headers, so the demo stays single-threaded.

Side finding: 7 variable-length arrays (e.g. ArrayDataLayer.h:275). They are not standard C++ and are a stack risk. Worth fixing on their own.


Drafted with Claude Opus 5, reviewed by a maintainer.

Activity

  1. added this to the Direction milestone on Aug 12, 2026
  2. filippi commented on Oct 21, 2026

    @filippi
    Contributor

    @HugoFara and @antonio-leblanc
    The main issue is Natcdf; i think dev should go get rid of netcdf and dependencies. Probably need to write a custom external binary to a custom compact "ff native" fileformat that will read from a global database. First the current netcdf. loadFromFile will use the binary to pre-process, otherwise without would require the native file format.
    a good opportunity to store states to, with fronts, atmap, and data.
    I have some ideas for that that requires some infusions, currently testing some, give a bit more time

  3. HugoFara commented on Oct 21, 2026

    @HugoFara
    CollaboratorAuthor

    Yes, NetCDF is understaffed unfortunately. I can try to send a few PRs to the maintainer, who seemed happy to help, but in the long term it seems more efficient to vendor NetCDF.

  4. HugoFara commented on Oct 23, 2026

    @HugoFara
    CollaboratorAuthor

    For record, this is the current state of things as of PR #213

    Image

    Very cool features we are cooking!

  5. filippi commented on Oct 24, 2026

    @filippi
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions