-
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
Detecting ninja as ninja_args for support python wrapper of ninja on … #7637
Conversation
…Windows such as 'python3', '-B', 'E:/abspath/qemu.org-x64/ninjatool' This is used for fixing the building of qemu in msys2/mingw64/mingw32 on Windows. QEMU need somethings like this ``` if [ "$MSYSTEM" = "MINGW64" -o "$MSYSTEM" = "MINGW32" ]; then PWD_WIN=`pwd -W` NINJA_TOOL=$PWD_WIN/ninjatool else NINJA_TOOL=$PWD/ninjatool fi NINJA="$python $NINJA_TOOL" $meson setup \ --prefix "${pre_prefix}$prefix" \ --libdir "${pre_prefix}$libdir" \ --libexecdir "${pre_prefix}$libexecdir" \ --bindir "${pre_prefix}$bindir" \ --includedir "${pre_prefix}$includedir" \ --datadir "${pre_prefix}$datadir" \ --mandir "${pre_prefix}$mandir" \ --sysconfdir "${pre_prefix}$sysconfdir" \ --localstatedir "${pre_prefix}$local_statedir" \ -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \ -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \ -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \ -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \ -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \ -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \ -Dsdl=$sdl -Dsdl_image=$sdl_image \ -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ -Dgettext=$gettext \ $cross_arg \ "$PWD" "$source_path" ```
Why don't you just use ninja itself? If you really feel the need for some wrapper tool, an executable python script should be able to be associated with the python interpreter and run properly on its own without needing to first specify "python" in the environment variable. |
@eli-schwartz It's all about Windows, on Windows you can not associate python script with python executable. |
I agree that in order to build the compdb on Windows QEMU could just be using ninja directly. (In fact I hope to get rid of ninjatool before the next version of QEMU is released. The version that was committed still has some makefile-based binaries so it needs ninjatool, but they can be converted pretty easily). |
This can be closed as far as QEMU is concerned. However there is another bug that was found in the NINJA variable on Windows: if a full path is included it must include the .exe suffix:
@lygstate you might want to look into fixing that instead? |
This is a temp fixes in qemu, may this patch provide a proper handling of ninja wrapper? |
If I understand correctly, this patch doesn't fix the issue with no .exe extension in the NINJA variable? That one is definitely a bug, while this patch on the other hand may cause issues if the path to ninja includes a space, which is something that Meson would certainly prefer to handle. |
@
I am using shlex.split(n) that will handle path with space if its quoted. Are you talking about path like this |
Right (which would be bad if ninja was under Program Files). But adding. exe would not have the possibility of causing regressions. |
I still don't see how this is a meson problem. But if meson should "handle" this, it should do so using a mechanism that is consistent between $NINJA and other environment variables, and/or teach meson to recognize shebang lines in the ninja executable like it does in other places. This pull request is wrong, simply because it shows the intent is to paper over the problem instead of properly handling it. |
Sounds a good idea, maybe getting the Popen to recognize the shebang lines? |
You could probably take a look at how |
The mere existence of ninjatool in QEMU is a temporary hack and I don't think Meson should be complicated in order to support it. Does find_program have the same issue where the lack of |
its not only about qemu, but also about broader usage of meson |
Unless there is a widespread Python implementation of ninja, it's not. Again, there are two issues that were uncovered due to QEMU's "unconventional" use of Meson:
|
I haven't really read this issue / PR in-depth, however, I want to add that #7518 also needs to run ninja (packaged in the AppImage) with a wrapper. |
I don't think it's comparable since |
Well, this PR looks fairly similar to 5c344f1. I just wanted to add that there is a use case for an arbitrary wrapper around ninja. I am not entirely sure how this will relate to "$NINJA" though, and the |
Yes I agree that the code looks pretty much the same, but it's mostly a coincidence. In this patch there is no wrapper, only an interpreter. The issue of not having shebang interpretation is obviously not a problem for AppImage. |
Seems your patch are very like mine, would the find_program solve your problem? |
@eli-schwartz How about add a extra parameter, NINJA_ARGS, and preseve NINJA unchange with shebang fixes? |
No, since there is no shebang since the AppImage is an ELF binary. Ninja is called via |
You didn't got the idea, find_program also recognize ELF binary, but may also shebang , find_program can find elf program or exe, but not sure if it works for shebang, I think it's works, because I found something like
nm is elf binary, scripts/undefsym.py is shebang python script. |
The two patches have a common part (multi-arg invocation of ninja) but that's where the similarities end. Can we please stop chasing this red herring and fix a real bug? |
I don't really like using both |
But their intention is a wrapper for ninja, at least ninja related, if you using something else, would be more confusing... |
|
There is a real feature are asking for that, |
This discussion is exhausting. @bonzini Can you open a tracking bug for the missing
@lygstate you are literally responding to someone discussing that PR and saying it's not the same as this, by telling that person the other PR exists. This is a useless waste of time, by definition @bonzini knows it exists. The only intellectually stimulating reply you can provide, would be to describe why you believe they are, in fact, the same. |
I opened #7659 for the .exe case. |
Since we're now using ExternalProgram just like find_program does, this should now be automatically handled. Just use |
right |
…Windows such as 'python3', '-B', 'E:/abspath/qemu.org-x64/ninjatool' This is used for fixing the building of qemu in msys2/mingw64/mingw32 on Windows.
QEMU need somethings like this