-
Notifications
You must be signed in to change notification settings - Fork 299
Export explicit template instantiations when building with MS VC #3144
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
Conversation
|
This patch is a part of changes to build libmesh with libtool (msys2) and MS VC on Windows. |
src/fe/fe_boundary.C
Outdated
|
|
||
| #define FACE_EDGE_SHAPE_ERROR(_dim, _func) \ | ||
| template <> \ | ||
| template <> \ |
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.
No, thanks, the whitespace looks better aligned...
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.
That was a left-over from my previous attempt where I also modified template specializations (which turned out to be not required). Corrected in the updated PR
|
I guess this isn't quite as maintenance-fragile as it looks, because if we forget to put that declspec on an instantiation, that only impacts the ability to call the instantiated function from code external to the DLL, not internally? So e.g. you don't have it in the I'm fine with this, but it still seems like it'll regress in no time flat unless we can figure out how to get it in CI. |
Agreed, unless there happens to be another I glanced briefly at your other PR:
This seems very painful. Is this an existing/known issue with the autotools on Windows, or is there something specific to our configure scripts that makes them so slow? |
And ironically, the better we do when writing new code, the worse the omission is, I think? If we slack off and don't add any test coverage, then DLL-libMesh doesn't have the new API exported, but at least existing builds and user codes will be fine, they just won't be able to update to use the new API right away. If we're conscientious and add a unit test or example invoking the new API, then the test or example won't link and we've broken I think we can probably support this on a "make sure it works before each new release" basis, though, even if it breaks from git hash to git hash. Looks like Visual Studio Community is free for individuals and for open source communities to use? |
Right
No. I tried to find all explicit template instantiations and mark them with LIBMESH_EXPORT. LIBMESH_DEFAULT_VECTORIZED_FE is not an explicit template instantiation - it is a full template specialization and MS VC 2019 + libtool do not have issue with that - MS VC puts these into the section marked as "(pick no duplicates)" and libtool automatic "export all" implementation picks the up for the export I created a simple test demonstrating this:
It is enough to have a good coverage in unit tests (current tests provide a good basis for this). |
This is related to how automake generates .Plo dep files: currently it executes a shell command for each .Plo file (just writing "# dummy" there) at "executing depfiles commands" stage of configure script (doing "make am--depfiles" for each Makefile). Process execution is very expensive in Windows so this stage (which takes several seconds on Linux) executes for hours I don't think we should do anything in libmesh repo about this. |
yes |
libtool "export all" linking does not pick them up due to their sections marked as "(pick any)" in dumpbin output
7ff07fc to
10dae09
Compare
Sure, but a test is only a test when it's run, and we don't have build boxes available to run regular tests on Windows, and I fear we may never. So I'll bet we see this regress regularly in the git master, only getting fixed when we run extra tests manually before making an official release.
That's dumbfounding. I knew process creation has long been much more expensive than thread creation in Windows, but so expensive that it dominates I/O even, and by orders of magnitude? |
|
@jwpeterson @roystgnr can we have a tag and a pre-release tarball for this? vcpkg team asked for a port that builds from pristine sources with all the patches applied |
libtool "export all" linking does not pick them up due to their sections marked as "(pick any)" in dumpbin output