-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Odd meson behavior under CMake with f2py #13882
Comments
It would be interesting to see the log file for the second (successful) time... |
@eli-schwartz Hmm. Is there a way to see where meson puts it? I only knew about the crash one because meson nicely told me where to find it. |
Notice that it always logs the source and build directories. The log file is always in the same place in the build directory -- |
Well I feel dumb. Okay, did a complete clean. Here is the first log: and here is the second: I see some clang oddity, but I will note I have:
but the two clangs are different in size:
but not in behavior (maybe):
|
So the moral here is that the one inside a nested subdirectory of Xcode.app doesn't work even to compile a simple program: sanitycheckc.c int main(void) { int class=0; return class; } compiled via:
The size could indicate that the version in /usr/bin is a wrapper shell script that sets paths up? I wonder why rerunning cmake changes anything here. Does it e.g. export CC down to f2py and therefore meson? Is the version in Xcode.app in $PATH anyways? |
The only clang I see is the
I definitely don't add the SDKROOT one to my path! That said, I do see that CMake seems to super-resolve it:
And now that I know what to search for: https://discourse.cmake.org/t/help-with-cc-clang-environment-and-cmake/2221/1 Hey hey! Look who opened that. 😄 If I then follow the chain we get to CMP0132 and if I add: cmake_policy (SET CMP0132 NEW) it works! (Here is the log: CMP0132.meson-log.txt) I hate to do it, but, @bradking can you come over to GitHub land and lend your knowledge? Will this policy have any side-effects I don't know of? Not only for me, but perhaps for meson? I mean it seems to be a solution for me (and hopefully other meson-f2py-cmake users), but... Note: I'm still not sure exactly what it does as I still see:
in the CMake, but things working are fine by me. I won't close this yet until I can more fully test (the example I'm reporting on here is a bit...minimal), but good news it seems! |
This is a fascinating decision... |
If a CMake project invokes a third-party build system that also pays attention to CC/CXX env vars then its selection could change in the case that CC/CXX are not set in the first place, because CMake will no longer set them before launching that build system. If a project was relying on the old behavior to tell the third-party build system what compilers to use, it should start doing so another way.
That's why policy CMP0132 removes the behavior. The quoted text is from the policy documentation's description of the old behavior and the motivation for changing it. |
Ahhh. My brain was seeing it the other way. All I knew was it helped me :) I suppose for now I'll do the finer cmake_minimum_required(VERSION 3.24)
cmake_policy(VERSION 3.24) I think my code also sets 0053 and 0054 but those are so old at this point setting those is probably like saying "Set CMake as of 10 years ago." Actually, I guess just: cmake_minimum_required(VERSION 3.24) might solve...everything? Sets all the policies I care about... |
@mathomp4 |
So far, tests are positive on at least one machine. I mean, I still can't use meson with Intel ifort because of the usual meson-ifort warning bug, but I'm slowly going through my testing matrix. But I think with some very ugly CMake I can sort of shove meson past the ifort issue. Probably be over at the CMake Discourse soon asking "how can I make this more elegant"? 😄 |
I'm hoping someone here can help me out with this. I have a code under CMake that tries to run
f2py3
on a very exciting code:mainly to determine what the suffix
f2py3
will use will be. As I have Python 3.12, f2py3 means meson!Now, by hand running:
f2py3 is happy, meson does its thing, all is well.
Now, under CMake I do:
which should run the same command (I've checked and I'm using the same
f2py3
for both.But here's the thing, the first time I run CMake I see:
I've attached the file here:
meson-log.txt
So meson failed saying clang could not compile programs.
But if I then rerun CMake changing absolutely nothing:
I'm a bit baffled. Why would meson say clang can't compile programs the first time, but it can the second time?
Has anyone ever seen this behavior? I'm hoping maybe someone can see something in that meson-log.txt that I can't. I mean I see:
but if clang can't see
System
the first time...why would it the second time?The text was updated successfully, but these errors were encountered: