-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[CMake][Windows] Fix Debug config build when using MSBuild #111765
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
Commit 95d4506 caused a failure in a debug-build with MSBuild. That commit conditionally makes an assignment to a cmake variable, but suppresses the assignment when LLVM_TABLEGEN is precicely "llvm-tblgen". This commit updates that change, so that the assignment is suppressed when LLVM_TABLEGEN logically is "llvm-tblgen" (i.e., it also suppresses it for "llvm-tblgen.exe", or for a full pathname that ends with llvm-tblgen" or "llvm-tblgen.exe").
chapuni
left a comment
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.
I don't understand your real issue. Could you elaborate?
If you specifies LLVM_TABLEGEN with no reasons, I suggest you stopping it.
Do you use LLVM_OPTIMIZED_TABLEGEN?
| if("${target}" STREQUAL "llvm-min-tblgen" | ||
| AND NOT "${LLVM_TABLEGEN}" STREQUAL "" | ||
| AND NOT "${LLVM_TABLEGEN}" STREQUAL "llvm-tblgen") | ||
| set(${project}_TABLEGEN_DEFAULT "${LLVM_TABLEGEN}") |
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.
I suppose ${LLVM_TABLEGEN} is llvm-tblgen by default.
You can modify it if you want to use out-of-tree llvm-tblgen.
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.
We don't use an out-of-tree llvm-tblgen. For me, on input to this block, ${LLVM_TABLEGEN} is of the form:
C:\path\to\dir-within-build-dir\bin\llvm-tblgen.exe
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.
Again, ${LLVM_TABLEGEN} is llvm-tblgen by default.
llvm/cmake/modules/TableGen.cmake
Outdated
| set(${project}_TABLEGEN_DEFAULT "${LLVM_TABLEGEN}") | ||
| AND NOT "${LLVM_TABLEGEN}" STREQUAL "") | ||
| # Extract base filename from full path. | ||
| get_filename_component(RAW_LLVM_TABLEGEN ${LLVM_TABLEGEN} NAME_WE) |
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.
I wonder get_filename_component would be applicable here.
Would it match if ${LLVM_TABLEGEN} points the explicit out-of-tree /path/to/llvm-tblgen.exe?
${LLVM_HOST_EXECUTABLE_SUFFIX} may be available here, I guess.
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.
I'm not sure I understand the question. For me, when ${LLVM_TABLEGEN} is of the form:
C:\path\to\dir-within-build-dir\bin\llvm-tblgen.exe
the line:
get_filename_component(RAW_LLVM_TABLEGEN ${LLVM_TABLEGEN} NAME_WE)
sets RAW_LLVM_TABLEGEN to simply llvm-tblgen, which is what I want -- essentially, enabling the portion of the change that suppresses the setting of ${project}_TABLEGEN_DEFAULT that you made in the commit 95d4506.
|
Thanks for the comments @chapuni.
Sorry. I should have explained more. I also want to let you know that I don't have much experience with CMake, so I may be approaching this the wrong way (and so I can abandon this, if that is your opinion after I explain more). I'll elaborate here, and a bit more in responses to the questions where you left comments in the code. But the big picture is that in the block that was added in 95d4506: for my running on Windows, on input in my run, and So the is enabled, setting Your commit 95d4506 appeared to me to be intending to do: I don't understand the reason for updating
Yes, we do use |
|
One additional thought. After thinking about the explanation I wrote up yesterday, I feel like there's a cleaner way to implement the fix. Here is a diff, showing the change that I think is cleaner: I haven't updated the commit in this PR, but I'll do that tomorrow, for clarity. This updated approach, sets |
Done. |
|
Hi @chapuni, Does my explanation above, and updated approach make sense to you? From what I understand, my proposed change is generalizing the change that you made in 95d4506, so it seems sensible to me. But as I said earlier:
So if you see a better solution, or a way for me to avoid the problem, please let me know. |
|
I have to reconfirm it. Let me prepare the msbuild environment. It'll take time. |
I appreciate you looking into it @chapuni. No problem about the timing! |
chapuni
left a comment
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.
I've reconfirmed LLVM_TABLEGEN is llvm-tblgen by default.
- VS Buildtools
- CMake-3.30.5
- Regardless of
LLVM_OPTIMIZED_TABLEGEN
Don't override LLVM_TABLEGEN without the reason. Use LLVM_NATIVE_TOOLS_DIR for the purpose.
| if("${target}" STREQUAL "llvm-min-tblgen" | ||
| AND NOT "${LLVM_TABLEGEN}" STREQUAL "" | ||
| AND NOT "${LLVM_TABLEGEN}" STREQUAL "llvm-tblgen") | ||
| set(${project}_TABLEGEN_DEFAULT "${LLVM_TABLEGEN}") |
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.
Again, ${LLVM_TABLEGEN} is llvm-tblgen by default.
| # FIXME: Quick fix to reflect LLVM_TABLEGEN to llvm-min-tblgen | ||
| set(RAW_LLVM_TABLEGEN ${LLVM_TABLEGEN}) | ||
| if(NOT "${RAW_LLVM_TABLEGEN}" STREQUAL "") | ||
| get_filename_component(RAW_LLVM_TABLEGEN ${RAW_LLVM_TABLEGEN} NAME_WE) |
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.
Would it match if ${LLVM_TABLEGEN} points to X:/out-of-tree/path/to/llvm-tblgen.exe? I don't think it'd be desirable.
Thanks for that feedback, and the advice about |
|
Thanks for your help and your patience on this, @chapuni.
I've looked into this further, and I see a way to modify our build-infrastructure so that it doesn't override |
Commit 95d4506 caused a failure in a debug-build with MSBuild. That commit conditionally makes an assignment to a cmake variable, but suppresses the assignment when LLVM_TABLEGEN is precicely "llvm-tblgen". This commit updates that change, so that the assignment is suppressed when LLVM_TABLEGEN logically is "llvm-tblgen" (i.e., it also suppresses it for "llvm-tblgen.exe", or for a full pathname that ends with llvm-tblgen" or "llvm-tblgen.exe").