Fix the build for 4.02-4.04 on macOS and for 4.02-4.10 with MSVC on Windows #8
+69
−42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I recently discovered that one can correctly trick Dune into creating empty libraries for some versions of OCaml, which allows the removal of the dynamic
dune
file. This PR then changes the build to be an empty library for OCaml 4.13 and earlier. This was originally considered in #5, but it breaks the build on MSVC prior to 4.11, so instead an empty library was only built for OCaml 4.07 to limit the damage to 4.02-4.07 on MSVC. It turns out the damage included in 4.02-4.04 on macOS.The solution proposed here is that for the offending versions of OCaml (that's 4.02-4.04 on macOS and 4.02-4.10 with MSVC on Windows), an empty module
CamlinternalCamlp_streams
is added to the library which works around the linker problems.A solution such as this was considered for the same problem in stdlib-shims, however it was rejected there because this issue affects the current versions of OCaml (the solution adopted in stdlib-shims was to fix OCaml itself). I think it's OK to use this trick here because we know that there was no
CamlinternalCamlp_streams
module in 4.02-4.10 and programs and libraries are not supposed to use names beginningCamlinternal
. Most importantly, the number of releases in which this trick is used is fixed, unlike in stdlib-shims.