Skip to content
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

cmake/common: Add language map entry for nasm #13864

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

res2k
Copy link
Contributor

@res2k res2k commented Nov 4, 2024

When determining the CMake compilers state, a CMakeLists.txt with these languages would be written:
project(CompInfo C NASM CXX)
Unfortunately, NASM isn't a CMake language. But ASM_NASM is - so map to that.

@res2k res2k requested a review from mensinda as a code owner November 4, 2024 11:29
@res2k
Copy link
Contributor Author

res2k commented Nov 7, 2024

@mensinda, you have been assigned as a reviewer, so I hope you don't mind a question 😅

So first, the symptom this change wants to address is the warning "CMake Toolchain: Failed to determine CMake compilers state" being emitted, in certain circumstances where a subproject uses nasm sources.

Now I'd like to add a test that triggers the circumstances of the warning.
But what I'm struggling with: how to check for a warning being not emitted?
My first instinct would be using --fatal-meson-warnings, so the warning results in a failure; however, this only seems to be set for "warning" tests... and those generally seem to check for presence of some warning, not the absence.

So... do you happen to have any advice on how to approach this?

@dcbaker
Copy link
Member

dcbaker commented Nov 7, 2024

@res2k I don't know if mensinda will answer, they haven't been around for a while.

What you likely want to do is use a test.json, which has a field for looking for specific output from the meson setup command.

@dcbaker dcbaker added the module:cmake Issues related to the cmake module, including cmake.subproject label Nov 7, 2024
@res2k
Copy link
Contributor Author

res2k commented Nov 7, 2024

@dcbaker, thanks for chipping in.

I noticed you could check for the presence of some specific line in the output -
But I actually the opposite, check for absence.

Ie, fail case - the specific warning is emitted; success case - the specific warning is not emitted.

So I wonder if there's a way to do that with the current system ...

@dcbaker
Copy link
Member

dcbaker commented Nov 7, 2024

There is a way to search for a regex, I bet there's a way in python re to invert the condition?

@res2k
Copy link
Contributor Author

res2k commented Nov 7, 2024

There is a way to search for a regex, I bet there's a way in python re to invert the condition?

Actually, I noticed that there's apparently a way to check some output line occurs zero times, which seems to be what I want :)
Will give it a try.

@res2k res2k force-pushed the nasm-is-not-a-language branch from 1324091 to 2833865 Compare November 9, 2024 11:59
@res2k res2k requested a review from jpakkane as a code owner November 9, 2024 11:59
@res2k
Copy link
Contributor Author

res2k commented Nov 9, 2024

@dcbaker, I managed to cobble together a test case that does what I want: produces "Failed to determine CMake compilers state" (and fails due to that) without the language map changes, but works warning-less with the latter change.
If you find some time to look at it, let me know what you think!

@res2k res2k force-pushed the nasm-is-not-a-language branch from fad4514 to 9aa0b11 Compare November 14, 2024 02:06
Copy link
Member

@dcbaker dcbaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for adding this and the test

@res2k res2k force-pushed the nasm-is-not-a-language branch from d78c994 to 92034c1 Compare November 21, 2024 18:56
@dcbaker
Copy link
Member

dcbaker commented Nov 21, 2024

The error on the Ubuntu Rolling job looks relevant

@res2k
Copy link
Contributor Author

res2k commented Nov 21, 2024

The error on the Ubuntu Rolling job looks relevant

It's odd though. Pretty much looks like just nasm segfaulting, without really saying anything.

@dcbaker
Copy link
Member

dcbaker commented Nov 21, 2024

Ohhhh, that's awesome. Let me give that job a kick and see what happens.

@dcbaker
Copy link
Member

dcbaker commented Nov 21, 2024

Idea: that failing job is cross compiling to ARM, is there a chance that the ASM in question doesn't work an armv7?

@res2k
Copy link
Contributor Author

res2k commented Nov 24, 2024

Idea: that failing job is cross compiling to ARM, is there a chance that the ASM in question doesn't work an armv7?

Maybe. But TBH I would expect nasm to tell me that instead of crashing.
Also, the other cross-to-arm test (Ubuntu Rolling (--cross ubuntu-armhf.json --cross linux-mingw-w64-64bit.json, --unity=on, gcc, g++)) does not seem to have this problem. It's quite weird.

But I guess I'll disable the test for ARM anyway. Which is fine, I guess, the principle ("we don't write a bogus CMake language") is just as well demonstrated on other platforms.

@res2k
Copy link
Contributor Author

res2k commented Nov 24, 2024

But I guess I'll disable the test for ARM anyway. Which is fine, I guess, the principle ("we don't write a bogus CMake language") is just as well demonstrated on other platforms.

...then again, nasm is only "an asssembler for the x86 CPU architecture", so maybe the weird thing is that this cross-to-ARM sometimes worked?

@res2k res2k force-pushed the nasm-is-not-a-language branch 2 times, most recently from 30d8999 to e71b010 Compare November 24, 2024 12:38
@res2k res2k force-pushed the nasm-is-not-a-language branch from e71b010 to d8a1d5e Compare December 15, 2024 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:cmake Issues related to the cmake module, including cmake.subproject
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants