-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
No host machine compiler for subproject linking to dependency in other subproject #10579
Comments
Perhaps a pointer to resolving this: I had this same issue on a Windows machine, and was able to resolve it by changing the project languages of (here) subprojects/animationwindow/meson.build to ['c', 'cpp'], despite the issue occurring in the SDL dependency referenced by that file. |
After a bit of testing, I figured out that this happens when:
A successful configuration results in the objects of the sdl2 dependency ( mesonlib.File(is_built=False, subdir='subprojects/SDL2-2.0.20/src', fname='SDL.c') It's not clear to me why we use this internal representation as "another source file". It means that even though the parent project isn't actually responsible for compiling anything here, it still checks the compiler. A build.BuildTarget should NOT need to check for a suitable compiler for an extracted object. |
I think this is a regression since https://mesonbuild.com/Release-notes-for-0-63-0.html#persubproject-languages because we used to share the compilers list across all subprojects. @xclaesse what an interesting fallout. :( |
In order to reliably link to static libraries or individual object files, we need to take their languages into account as well. For static libraries this is easy: we just add the static library's list of compilers to the build target. For extracted objects, we need to only add the ones for the objects we use. But we did this really inefficiently -- in fact, downright terribly. We iterated over all source files from the extracted objects, then tried to look up a new compiler for them. Even though the extracted objects already had a list of compilers! This broke once compilers were made per-subproject, because while the extracted objects have a reference to all the compilers it needs (just like static archives do, actually) we might not actually be able to look up that compiler from scratch inside the current subproject. Fix this by asking the extracted objects to categorize all its own sources and return the compilers we want. Fixes mesonbuild#10579
In order to reliably link to static libraries or individual object files, we need to take their languages into account as well. For static libraries this is easy: we just add the static library's list of compilers to the build target. For extracted objects, we need to only add the ones for the objects we use. But we did this really inefficiently -- in fact, downright terribly. We iterated over all source files from the extracted objects, then tried to look up a new compiler for them. Even though the extracted objects already had a list of compilers! This broke once compilers were made per-subproject, because while the extracted objects have a reference to all the compilers it needs (just like static archives do, actually) we might not actually be able to look up that compiler from scratch inside the current subproject. Fix this by asking the extracted objects to categorize all its own sources and return the compilers we want. Fixes mesonbuild#10579
In order to reliably link to static libraries or individual object files, we need to take their languages into account as well. For static libraries this is easy: we just add the static library's list of compilers to the build target. For extracted objects, we need to only add the ones for the objects we use. But we did this really inefficiently -- in fact, downright terribly. We iterated over all source files from the extracted objects, then tried to look up a new compiler for them. Even though the extracted objects already had a list of compilers! This broke once compilers were made per-subproject, because while the extracted objects have a reference to all the compilers it needs (just like static archives do, actually) we might not actually be able to look up that compiler from scratch inside the current subproject. Fix this by asking the extracted objects to categorize all its own sources and return the compilers we want. Fixes #10579
In order to reliably link to static libraries or individual object files, we need to take their languages into account as well. For static libraries this is easy: we just add the static library's list of compilers to the build target. For extracted objects, we need to only add the ones for the objects we use. But we did this really inefficiently -- in fact, downright terribly. We iterated over all source files from the extracted objects, then tried to look up a new compiler for them. Even though the extracted objects already had a list of compilers! This broke once compilers were made per-subproject, because while the extracted objects have a reference to all the compilers it needs (just like static archives do, actually) we might not actually be able to look up that compiler from scratch inside the current subproject. Fix this by asking the extracted objects to categorize all its own sources and return the compilers we want. Fixes mesonbuild#10579
Describe the bug
When using c-subproject in the dependencies of cpp-subproject, I get an error about no host machine compiler for the c language. The base project is also cpp.
This doesn't happen if:
c
as one of the languages in the cpp-subprojectIt does not however matter whether or not i define
c
as one of the languages in base project, neither if animationwindow is present or notTo Reproduce
structure:
├── subprojects
│ ├── cpp-subproject (animationwindow
│ └── c-subproject (sdl)
├── main.cpp
└── meson.build
E.g. SDL and animationwindow are parallell, not nested.
meson.build
subprojects/animationwindow.cpp
subprojects/sdl2.wrap
Expected behavior
Expected to
meson setup debug
without any issues.system parameters
The text was updated successfully, but these errors were encountered: