Skip to content

Reexport NML headers - #4852

Open
BsAtHome wants to merge 2 commits into
LinuxCNC:masterfrom
BsAtHome:fix_reexport-nml-headers
Open

BsAtHome wants to merge 2 commits into
LinuxCNC:masterfrom
BsAtHome:fix_reexport-nml-headers

Conversation

@BsAtHome

Copy link
Copy Markdown
Contributor

This PR reexports the NML headers. It does so by putting them in the include/libnml/... and include/nml_intf/ hierarchies. If someone needs it to be flattened, then they can simply add the appropriate -I options to their private compile job (we got rid of most of them for good reason).

The reexport also fixes collision prone double inclusion protection by using a proper prefix. All the #include directives have been updated to use the proper <> style for the moved includes, unless an include file target is local to the directory of the file being compiled (and that also goes for includes including includes).

This PR should fix some of the problems of #4774. There are many more changes and fixes to the NML stuff between 2.9 and master. Any use needs very, very careful attention if you try to interface using the binary interface and try to port 2.9 code to master and future 2.10.

@grandixximo

Copy link
Copy Markdown
Contributor

HEADERS in src/Makefile is $(wildcard ../include/*.h ../include/*.hh), so make install and linuxcnc-uspace-dev only ship the top level of include/. Is it intended that include/libnml/ and include/nml_intf/ stay out of the installed tree for now?

tests/build/ui/nml-position-logger.cc and tests/interp/compile/use-rs274.cc still include "emc.hh", "emc_nml.hh" and "canon.hh". Did you mean to leave them, or should they follow the new <nml_intf/...> paths?

@BsAtHome

Copy link
Copy Markdown
Contributor Author

Yes, I had a feeling I missed something. The install needs to be fixed for the dev package and the tests should also be using the include directory properly.

@BsAtHome
BsAtHome force-pushed the fix_reexport-nml-headers branch from 3e67b3d to a42466e Compare November 16, 2026 13:42
@BsAtHome

Copy link
Copy Markdown
Contributor Author

Right, now the headers are installed by tree copy.
The headers used in the tests were all in disabled tests. It turns out that the build/ui test can now run again and is also re-enabled.

The interp/compile test still cannot run because the interpreter headers are not yet exported. This I could do in a separate PR, but I'm not sure we should bother at all. The interpreter depends on liblinuxcnchal.so and that is a problem for standalone interpreters. The expansion of #<_hal[pinname]> needs to be disabled or the HAL library must be demand-loaded, but demand loading creates a cleanup problem. Maybe we should drop the interpreter's access to HAL completely.

@rene-dev

rene-dev commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

I think dropping the interpreters access to hal is a bad idea, it is really useful when programming toolchangers. going thru motion IO pins is cumbersome, especially if you have a lot of IO. it is also self documenting if you have the name in the code, instead of a number. A better way of doing it would be to do the ini and hal access thru a canon command(e.g. READ_SPECIAL_VARIABLE(name)), this would remove the linkage. Important difference here: the hal access is read at readahead time, while motion IO is synced to what is actually executed.
a workaround for this is to read a dummy input. #588

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants