5.2 KiB
LinuxCNC rs274 source map
This is the working map for moving from native librs274 linking to source-level compilation and then to wasm.
Compile assumptions
Native user-space syntax checks require:
-DULAPI- LinuxCNC include roots:
linuxcnc/srclinuxcnc/src/emclinuxcnc/src/emc/nml_intflinuxcnc/src/emc/rs274ngclinuxcnc/src/emc/motionlinuxcnc/src/emc/pythonpluginlinuxcnc/include
- Python development headers for current upstream sources, because the interpreter still embeds Python/Boost.Python paths.
Source groups
Interpreter core
These are the first group to keep compiling while we peel away native-only dependencies:
interp_arc.ccinterp_array.ccinterp_base.ccinterp_check.ccinterp_convert.ccinterp_cycles.ccinterp_execute.ccinterp_find.ccinterp_g7x.ccinterp_inspection.ccinterp_internal.ccinterp_inverse.ccinterp_namedparams.ccinterp_o_word.ccinterp_python.ccinterp_queue.ccinterp_read.ccinterp_remap.ccinterp_setup.ccinterp_write.ccmodal_state.ccnurbs_additional_functions.ccrs274ngc_pre.cc
Python binding modules
These are not needed for the browser simulator ABI and should not be part of the wasm core:
canonmodule.ccgcodemodule.ccinterpmodule.ccpyarrays.ccpyblock.ccpyemctypes.ccpyinterp1.ccpyparamclass.cc
Browser-hostile dependencies to replace
- Python/Boost.Python remap and named parameter hooks.
dlopen/dlsyminterpreter loading ininterp_base.cc.- native mmap/filesystem storage in
tooldata_mmap.cc. - persistent parameter file writes.
- dynamic INI/HAL queries.
The wasm-safe runtime now constructs its detached EMC_STAT through LinuxCNC
src/emc/nml_intf/emcops.cc. The singleton follows LinuxCNC
src/emc/sai/dummyemcstat.cc, and the required NMLmsg/RCS_STAT_MSG
constructors are trimmed from src/libnml/nml/nmlmsg.cc and
src/libnml/nml/stat_msg.cc in core/wasm_shims/nml_status_shim.cc, so
interpreter paths such as Interp::tag_arc() in interp_convert.cc read
initialized LinuxCNC status defaults without linking the task controller or
native NML channels.
Current syntax probe
Run:
./test-linuxcnc-source-syntax.sh
The probe checks a representative subset of source files with -DULAPI. It is not a full source build yet; it is a guardrail before the full source backend is introduced.
Current object probe
Run:
./test-linuxcnc-source-objects.sh
This compiles every core: entry in linuxcnc-rs274-source-files.txt into object files. As of this step, the core interpreter sources compile to .o in the native environment with -DULAPI.
The next boundary is linking. Expected link risks:
PythonPluginand Boost.Python symbols from remap/named parameter paths.- Python module initialization symbols if the source backend reuses the existing builtin module setup.
tooldata_mmap.ccnative mmap/filesystem storage.tooldata_common.ccnow remains in the wasm-safe core and links against browser-safe tooldata backend shims.- dynamic loader code in
interp_base.cc. - parameter file persistence in
rs274ngc_pre.cc.
Current source-link probe
Run:
./test-linuxcnc-source-link.sh
This compiles every core: interpreter source into local objects and links the
native runner without librs274. It still uses built LinuxCNC support objects
and libraries for the dependencies that have not been replaced yet:
- Boost.Python binding module initializers required by the current interpreter constructor.
libpypluginfor Python remap and named-parameter hooks.liblinuxcnciniandliblinuxcnchalfor INI/HAL named parameter paths.liblinuxcnc-uspace-posixforrtapi_*user-space helpers.libtooldatafor the native source-link runner. The wasm-safe source probes instead compile LinuxCNCtooldata_common.ccwithtooldata_mmap_backend.ccandtooldata_runtime_stubs.cc.
This is not wasm-ready yet, but it proves the simulator can own and compile the RS274 interpreter core sources directly. The next source-port boundary is to replace each support dependency with browser-safe shims instead of pulling in the LinuxCNC task, motion, HAL, and Python runtime layers.
The wasm-safe source manifest is linuxcnc-rs274-wasm-source-files.txt. The
rs274ngc_pre wasm link and undefined-symbol probes read their LinuxCNC source
list from that manifest so inifile.cc, tooldata_common.cc, and the
interpreter sources stay on one source of truth.
When CNC_SIM_ENABLE_LINUXCNC_WASM_SAFE_PROBE=ON, CMake also exposes
linuxcnc_rs274_wasm_safe_probe_objects and the EXCLUDE_FROM_ALL
linuxcnc_rs274_wasm_safe_probe executable. The executable mirrors the
rs274ngc_pre shell link probe and is built only when explicitly requested, so
the normal browser wasm artifact does not accidentally link the probe runtime.
The native runner used by this probe now recognizes simulator-owned control
lines before handing code to LinuxCNC: M428, M429, M430, G43.4,
G43.5, and G49. This keeps the direct runner aligned with the public
linuxcnc-rs274 API backend for RTCP and kinematics switch tests.