2024-11-23 19:11 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000472mercuryBugpublic2018-11-17 22:40
Reporterpbone 
Assigned Tozs 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusresolvedResolutionfixed 
Platformx86_64OSLinuxOS Version4.something
Product Version 
Target VersionFixed in Version 
Summary0000472: Touching a .m file does not rebuild other modules that may depend on C foreign code that is opt-exported from that module
DescriptionWithin Plasma https://github.com/PlasmaLang/plasma I have a C header runtime/pz_format.h, I have some Makefile rules to touch src/pz.m and src/pz.bytecode.m if it is updated, so that any foreign code is rebuilt. However if I change an enum in runtime/pz_format.h causing these .m files to be touched and rebuilt the tests "make test" can fail.

I think what might be happening is that because the Mercury code didn't actually change, mmc does not update the pz.mh file and therefore other .c files generated from output are not rebuilt to object code.

I can work-around this by touching the .mh files as well, I still need to touch the .m file so that mmc checks the .mh file.
Additional InformationMercury 14.01.1
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0001016

pbone (administrator)

Here's the workaround in Plasma's Makefile:

https://github.com/PlasmaLang/plasma/commit/c5c1fb9a55a3ba773308e228cae93e74a837f1e6

~0001017

zs (developer)

This is working as designed. Mmc does not generate .mh files directly;
it generated .mh.tmp files, and then invokes mercury_update_interface
to copy that across to the .mh file IF AND ONLY IF the new contents
are different from the old contents. This saves a huge number of
unnecessary recompilations. We do NOT want to undo this optimization
just because your Makefile does not express all the dependencies.

I think you need to change your Makefile to express the dependency
of all the modules that need pz_format.h on pz_format.h directly,
not through pz.m.

~0001018

pbone (administrator)

I'll double check but I think I've only put this dependency all the .m files that that have a C FFI #include for pz_format.h. If I could also tell Mercury (easily?) that pz.write.o depends on pz_format.h because it reads pz.mh then that seems like the best option. I'll double check.
+Notes

-Issue History
Date Modified Username Field Change
2018-11-09 23:24 pbone New Issue
2018-11-09 23:38 pbone Note Added: 0001016
2018-11-09 23:41 zs Assigned To => zs
2018-11-09 23:41 zs Status new => resolved
2018-11-09 23:41 zs Resolution open => fixed
2018-11-09 23:41 zs Note Added: 0001017
2018-11-17 22:40 pbone Note Added: 0001018
+Issue History