-
Notifications
You must be signed in to change notification settings - Fork 981
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
[question] Why use ninja in meson to replace meson's built-in compilation #9922
Comments
hello! I think it's just a historic thing, AFAIK meson is usually used in conjunction with ninja and pkg-config, that's at least the main use-case I am aware of. backend agnostic compile command is a pretty new thing, introduced in the very recent release of meson 0.54, while Conan implementation of build helper pre-dates that. right now, I don't know, what are the use-cases and the benefits of other backends (e.g. vs) over ninja. I would love to hear more about your use case, so feel free to share any additional details.
sorry, but I don't get it, what exactly does it mean, can you elaborate? |
Hello,
This means that when I modify the content of meson.build, ninja does not modify it, and it will be modified at the same time when I use meson compile to generate it. No special test is performed, and the build directory needs to be deleted every time the meson.build file changes during use. There is not much difference between ninja and VS, but VS is easy to make a little change, such as modifying the toolset, etc. In addition, I can directly open the project with the IDE. Meson supports vs as backend, I think conan-meson should also support vs as backend. The strange thing is that the files generated by conan using cmake as the backend are also vs, not ninja. An example that can benefit from vs as a backend is as follows.
After the modification, the toolset of conan can be passed to meson to generate. In theory, ninja should also be able to modify and support toolset, but I haven’t thought of a good way yet. In addition, if I use meson as the compilation, after modifying the meson.build file, the corresponding generated files will also change, such as ninja or vs as the backend. |
I tested it. When msbuild and meson use VS as the backend, there is a difference between the exe generated by the two. So it’s best to use meson’s built-in generation instead of ninja generation. |
yes, I agree it could be useful to support VS as the backend in |
I tried the new build helper tool, there are many problems.
The first problem arises because the environment is switched, which causes the build os to change. In fact, there is no need to judge what cross, and the corresponding arch will be automatically generated if there are environment variables. The third problem should be that the current path has changed, and manual execution is possible. |
@SSE4 Could you check the |
yes, I am checking, will report with my findings |
I am using very simple
with
and
regarind point 1. the issue happens in single profile mode, e.g. running the following command:
NOTE, there is a warning above:
with two profiles there is a different error:
as noted in #9710, Meson, unlike CMake, is not so smart, and cannot automatically deduce the compiler executable in case of cross-compiling.
it builds successfully via two profiles. so there are two sub-points: |
about point 2, it's relatively easy change, so I've drafted a PR: #9990 |
about point 3, I think you actually have found a serious bug!
as these two functions behave differently, there are situations when they return a different value |
Yes, I also found that there are two identical functions. After a simple debugging, I found that the function logic is the same in the problem I debugged. If the cross_meson_native.ini file exists, the generation will still fail. I think there is a problem with the current path, I will check it carefully later. |
Exactly, the new Toolchains are supposed to work only with 2 profiles.
We should add a note in the documentation, if you want to cross-build with meson you have to specify your compiler in the profile. I think this is easy and good enough. EDIT: Is there a way to specify the compiler via Meson (at the ini files?) we might consider in that case to add a new property to specify the cross compiler. |
okay, I've opened conan-io/docs#2296 for that
yes, you can specify it in cross-file INI like:
I need to think about it. I suppose it has to be done in the uniform way (e.g. with cmake), something like P.S. not directly related to this particular issue, but maybe you can also help me to move forward with another 2 meson issues: #9713 #9710, they are kinda important as well, especially for conan-center |
Mhh, so maybe we can adjust them automatically based on the build compiler, right? |
#9990 implemented support to change Meson backend, will be available in 1.43. |
Use meson to compile, only support backend to ninja, if I modify it to not support anything else, such as vs, I also need to use msbuild to compile.
The following is the code
If I change the compilation of ninja to meson, it can also be successful, as follows
I omitted the generation target here, meson is supported.
Using ninja also has the problem that the meson file cannot be changed when the meson file is changed.
If I use vs as backend, there will be errors, as follows
The text was updated successfully, but these errors were encountered: