-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added latest CompCert version (3.7) and platform Flocq variant #1246
Conversation
@palmskog : can you please help me with the error message:
I don't see what should be wrong with this. Locally this does work without a warning (and also does apply the patch) and I double checked the SHA256. What could be wrong with this? |
Is the uppercase |
Thanks - well spotted. This is indeed the issue (OSX FS is by default also case insensitive). |
204a434
to
b2f0add
Compare
Note: I added one more little patch which installs compcert.ini also under lib/coq/user-contrib/compcert, where coq based tools (like VST) can find it more reliably. |
b2f0add
to
28f27d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work.
Concerning compcert.ini
: I understand your desire, but I find it strange that this is something specific to the platform-coq variant. Could you add it to the default variant?
- echo "prepro_options=$(CPREPRO_OPTIONS)";\ | ||
- echo "asm_options=$(CASM_OPTIONS)";\ | ||
- echo "linker_options=$(CLINKER_OPTIONS)";\ | ||
+ echo "prepro_options=$(CPREPRO_OPTIONS)";\ | ||
+ echo "asm_options=$(CASM_OPTIONS)";\ | ||
+ echo "linker_options=$(CLINKER_OPTIONS)";\ | ||
echo "arch=$(ARCH)"; \ | ||
echo "model=$(MODEL)"; \ | ||
echo "abi=$(ABI)"; \ | ||
echo "endianness=$(ENDIANNESS)"; \ | ||
+ echo "bitsize=$(BITSIZE)"; \ | ||
echo "system=$(SYSTEM)"; \ | ||
echo "has_runtime_lib=$(HAS_RUNTIME_LIB)"; \ | ||
echo "has_standard_headers=$(HAS_STANDARD_HEADERS)"; \ | ||
echo "asm_supports_cfi=$(ASM_SUPPORTS_CFI)"; \ | ||
- echo "response_file_style=$(RESPONSEFILE)";) \ | ||
+ echo "response_file_style=$(RESPONSEFILE)";) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems completely unrelated to installing compcert.ini at the right place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ehm yes, I also added a bitsize field to the file afterwards, since it was missing and VST needs it - and fixed the spacing on the way (it was a mix of tabs and spaces from one line to another).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same remark as bellow : if the patch (or PR AbsInt/CompCert#348) is not only about installing the .ini file, then document it accordingly.
I would prefer to have the 3.7 release a plain unmodified 3.7 release. I did so much patch hacking in all the Coq Windows releases I did in the past that I started to get nitpicky about such things. VST anyway won't work well with the non platform version and it requires the platform version as dependency (opam package is on the way), so I don't see a good reason to publish a patched release for compcert 3.7 on opam. I also created a PR for upstream CompCert (https://github.com/AbsInt/CompCert/pull/348/files) to have this in the future. But this is more a 70% don't vs 30% do opinion, so if you have strong feelings about doing this for both, I am happy to do it. |
This is a matter of documentation. If the description of this variant is "using the platform supplied version of Flocq", then this is what the only difference with the main variant should be. So I think we should either change the description (and name) of the "flocq" variant into something like "variant patched for VST" or integrate this patch to the main variant. Given that 1- the patch may be integrated to CompCert (thanks to AbsInt/CompCert#348) and 2- installing one more file and adding this line to a .ini file is unlikely to cause any incompatibility, I preferred patching the main variant. |
I would prefer this too.
"CompCert patched for the needs of VST" would be a fine description of the alternative package.
I have reservations about adding stuff to a .ini file that is not configurable. I mean, the bit width is not a configuration parameter, it's a function of other parameters. Plus, it's already described in the Archi.v file of the target platform. |
Of cause we can do this, but this is not the intention behind the changes. The intention is to have a "platform friendly" variant of CompCert. For me this means:
And I fully agree that putting Flocq in the name and the description is misleading - it is the main thing but not the only one. The name is historic - I started with Flocq and later found I need more changes. I will change the name and description.
Archi.v is not installed (at least not in a place I would look for it). I get the following:
VST needs the bitsize during make, not just during coqc runs. VST developments frequently depend on the bitsize but less frequently on other architectural parameters. So while the view of CompCert on what is important and what not is obviously more low level, the abstraction CompCert delivers up to VST is mainly parameterised by the bitsize. Afaik non of the VST developments provided as examples depends on something else then the bitsize - in the sense of .v source code, of course compiled .vo files depend on the detailed architecture. Not putting this parameter in the upwards interface of CompCert destroys this abstraction. I am completely open to extracting the bitsize in another reliable way. Originally VST was extracting it from CompCert's Makefile.config, but I thought that this is not the best way of doing it, since it requires access to the folder in which CompCert has been compiled. |
Then you should update the name and use the provided package for MenhirLib, since it is also available in another opam package.
An obvious solution would be to run a simple .v file which imports Archi.vo, and does a |
Indeed - I tend to overlook the menhir coq library. I will change this (it might require some additional require statement patching though).
I thought about that, but since VST needs other information as well which is available in the compcert.ini file it looked a bit contrived. On the other hand it is for sure the safest and most portable method to extract that information. I will see if I can get all information VST needs that way. Should I copy the compcert.ini file to the coq library folder anyway (even though VST doesn't need it then). I think it might be good documentation on what compcert has been installed. |
I don't have a strong opinion. But if VST does not need it, then we should be able to wait for AbsInt/CompCert#348. |
Regarding retrieving architecture flags for VST: I need bitsize and arch. I can get this from running:
but neither output is somehow direct. I get I can do this - no problem - but please let me know if this is really what you want. I would say it doesn't hurt to supply a file which contains the most important architecture information to the user in a way which looks like it is designed to be used like this. I can't say that of this method. In the compcert.ini file it looks like this:
|
Given what happened in AbsInt/CompCert#348, could you either use a similar solution by patching CompCert to suit your needs or use Locate/Print in VST as discussed? |
Yes, this is the plan - I am working on it (it is a bit of a chain from compcert over opam to VST). |
I did the following updates
|
What about coq-MenrhiLib? There is now one additional variant (the open source one). Could you clarify its point? This cannot be about the license, since it also install builtins1.vo. |
The Flocq patch is prepared with comments in the CompCert sources. The Menhir patch not, which might make it less stable. The platform patches might be quite long term (until it is decided to remove the duplications from CompCert). Also for Flocq the duplication leads to massive problems, e.g. one can't use CoqInterval or Gappa to prove C code correct cause of the duplication of definitions. Maybe there are also issues with duplicating Menhirlib, but I am not aware of such issues. The plan is to first prepare the patch in the sources and then do it. So 3.8.
The main point is that VST CI runs into hard time limits when building the complete CompCert. There are also other non urgent reasons, see (AbsInt/CompCert#351) for a discussion. But even if @xavierleroy makes this file dual licensed soon, I can't remove the note in 3.7 because I don't think it is agreeable to patch license files and opam does not support direct cherry picking. So for 3.7 I think this is the best option. I don't want to use a non release commit as source for clarity. |
@jhjourdan : are there remaining issues or can we merge this now? |
The patch for using an opam supplied coq-menhirlib is rather simple:
But I agree that this is probably not essential since it is unlikely that any external developments will refer to Compcert's parser. |
@jhjourdan : can you please hold this back for a day? @xavierleroy modified the license to include the one missing file, so I want to clean up the open source package. It might also make sense to split this PR into the two main packages (plain release and coq-platform) and do the open source variant later. Would you prefer this? |
Ah ok, I didn't see this variant - I thought about patching the sources. Indeed this is a reasonable option. I will implement it since I anyway also have to adjust the open-source package to the license changes. |
Another thing which worries me is that we are introducing two new variants of the CompCert package for the sole purpose of one third-party software, VST... This seems overkill. But all in all, I don't think there is a strong argument against this PR. Hence, I am not opposed to merging this (even without the patch for coq-menhirlib). So, as long as @xavierleroy is not opposed, feel free to merge. |
This is not how it is intended. The main goal of this PR is to prepare the Coq platform release for Coq 8.12. I don't know if you are aware of the discussion but the basic idea is to split the Coq releases into 2 phases - a Coq core release and a short while later a Coq platform release which includes an extended set of packages useful for teaching and exploring Coq related technology in an easy to setup way. See (https://github.com/MSoegtropIMC/coq-platform/blob/master/charter.md). I would say that there is a broad consensus for this among the Coq maintainers. The main goal of this PR is to provide opam packages for CompCert which play nicely in the context of a Coq platform which means using packages provided by the platform and providing required configuration information for other packages in the platform. Sure, VST is currently the only user of CompCert in the platform, but still this is not done purely for the benefit of VST but for the benefit of the Coq platform in general. The open source package is also there because there are discussions if the platform should contain non open source software at all. The open source package offers a choice suitable for teaching and exploration in case it is decided that full compcert is not included. |
Use opam supplied MenhirLib in the Coq platform packages
@jhjourdan : I changed it to use the opam version of menhirlib and also added the license changes as patches from (AbsInt/CompCert#351). @xavierleroy agreed to include the license file changes as patches (which I wouldn't do otherwise). I locally tested VST with both coq-platform variants and it works fine. So from my point of view, this is good to go. |
Just stumbling upon this from #940. With this merged, it will be possible to |
The VST opam file PR as such is not there yet and this depends on some changes in VST, which in turn depend on this PR (I am currently working with a local patch opam repo in the VST source tree to parallelise things a bit). The VST PR is hanging on issues with CI (timeouts, strange effects with the local opam patch repo, ...). See (PrincetonUniversity/VST#406). So the chain of events is:
|
From my side, this is ready to merge. I would still prefer to have @xavierleroy's approval for this specific PR, though, since there are license changes. |
@jhjourdan : FYI: @xavierleroy explicitly answered in (AbsInt/CompCert#351 (comment)) that it is ok to take his latest commits changing the license file as patch in opam. But if you prefer, I can wait. |
Alright, then let's merge! |
Done! |
Apologies for leaving you hanging. I confirm that everything is fine license-wise. |
@jhjourdan, @xavierleroy : do you have objections against adding the same three opam package for 64 bit compcert? I would name it |
Indeed, we could have a variety of packages for various architectures. If you are willing to do the work, this should be merged. Not sure there would be many users (aka. testers for the packages), though. If we do that, we should consider making |
It supports conditional stuff in the build process at least. It might also work in the dependencies. Cf. https://github.com/ocaml/opam-repository/blob/acbec000d209ea977d778e9b014297c7ebef5eb7/packages/coqide/coqide.8.11.1/opam#L30 and https://opam.ocaml.org/doc/Manual.html#Global-variables. |
My suggestion was to keep the OS resolution in the package (that is the coq-compcert-64 package would build linux on linux, windows on windows and OSX on OSX), but I can also create separate packages for each major platform variant (I guess this would be 8, 32 and 64 bit x86 on Linux, Windows and OSX + arm 32 and 64 on Linux) and make coq-compcert a virtual package choosing the most sensible of these. Both variants would be easy to do. I guess in the end your suggestion is better since people might want to verify Linux code on non Linux OS. So if this is agreed, I will prepare a PR. |
If conditional dependencies are possible, then I would indeed prefer my solution (not only for the hardware architecture, but also for the OS). In the end, the user will see the same result as far as the BTW, you should not forget to add conflicts between these pacakges. |
The plan is to install each variant in a different folder under |
This looks like a plan, indeed. |
This adds a opam file for the latest version of CompCert (3.7) including a variant which is patched to use a platform supplied Flocq rather than the integrated Flocq.
The change to a platform supplied Flocq is done with a patch file for maintainability and cross platform reasons (sed is quite different on OSX).
The patched variant uses a tilde version name, so that users get the standard variant unless they explicitly request the patched variant.
FYI: @xavierleroy, @jhjourdan