[flang] Flang fails to build when building on different amount of cores than LLVM Buildbot
After merging #161179 I'm observing this:
23:03:50 /workspace/src/flang/include/flang/Optimizer/Dialect/MIF/MIFDialect.h:26:10: fatal error: 'flang/Optimizer/Dialect/MIF/MIFDialect.h.inc' file not found
23:03:50 26 | #include "flang/Optimizer/Dialect/MIF/MIFDialect.h.inc"
23:03:50 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23:03:50 1 error generated.
Apparently, CMake doesn't generate MIFDialect.h.inc out of MIFDialect.td on time when it's needed.
This is a typical build parallelism issue that haunts flang from time to time. Likely some cmake is missing a dependency.
@JDPailleux please could you have a look at this.
Yes of course, I take a look !
@pawosm-arm This PR #164309 doesn't resolve the error ?
@JDPailleux possibly. Unfortunately, our CI (where the problem manifested itself) is all red today due to some other (unrelated) issue which hits the building process much earlier, so I won't be able to confirm it until I investigate the new problem.
@JDPailleux bad news, the last build which failed from the issue signaled here, it already had #164309 merged. Apparently, it didn't help (seems it only helps standalone builds), but the new build time issue will only make harder to investigate it.
@pawosm-arm Thanks for your feedback. I'll continue investigating.
@JDPailleux I suspect what is missing here is a dependency from some other library on the MIFDialect library. #164309 worked the other way: adding missing dependencies from MIFDialect on other libraries.
@pawosm-arm Do you have any further details about your CI or more trace or other ? Unfortunately, I am unable to reproduce any link errors on my CI. I also tried looking at each file individually to see what might be missing, but nothing obvious stands out.
@JDPailleux it seems the key CMake setting that exposes the issue is:
-DBUILD_SHARED_LIBS=True
Hum, I've this CMake key too. I'll keep looking, so I'll find it one day ;)
@pawosm-arm I think I've found it, I'll confirm it and open the PR.
This PR looks weird (removing things rather than adding to the CMakefile), but somehow it made our CI green. Note that I had to test for the other issue alongside, so it wasn't the recommended 'change one thing at a time' approach.