-
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
unclear if using (via -fplugin
) a gcc plugin in the same meson.build that builds the plugin is possible
#5090
Comments
How do you normally tell gcc to load a plugin from a custom location? Is there a command-line argument to gcc for it? An env var? |
Normally, you'd pass the path to The key issue is that I need some way to represent the dependency between compilation within the |
The reason why adding it to What you want to do is use a myplugin = shared_module('myplugin',
'myplugin.cc',
include_directories: plugin_inc
)
dummy = custom_target(input : myplugin,
output : 'dummy.h',
command : ['echo'],
capture: true)
test_1 = executable('test-1', 'test-1.c', dummy,
c_args: [ '-fplugin=' + myplugin.full_path() ],
native: true,
) This will make meson think that the executable requires a header generated by that custom target, and the header depends on that plugin library being built. |
Yep, that pattern does allow me to get this working. For reference, here's the
|
I think we could add a kwarg |
Yes. |
Ideas and some code from mesonbuild/meson#5090 This is just an example plugin that cold be used as a starting point. Right now we find efl_super() with GIMPLE and add a efl_super2 call when it was defined and in code before to allow linking.
Ideas and some code from mesonbuild/meson#5090 This is just an example plugin that cold be used as a starting point. Right now we find efl_super() with GIMPLE and add a efl_super2 call when it was defined and in code before to allow linking.
Ideas and some code from mesonbuild/meson#5090 This is just an example plugin that cold be used as a starting point. Right now we find efl_super() with GIMPLE and add a efl_super2 call when it was defined and in code before to allow linking.
@anarazel you recently asked about this. |
The very specialized way to do this is by adding a Allowing arbitrary file dependencies is a lot more flexible... possibly "too" flexible as it would allow people to do stuff like "depends: my_generated_c" and then do OTOH it may not be so bad if it can be used for that. In order to properly handle stuff like gcc -fplugin, we would need to rebuild every source file if the depends target is updated. That also means if you do odd things like depending on a .c file which is included where it should be named as a header... you end up rebuilding every single source file pointlessly. So header sources still win out as the proper solution, yay. So I'm inclined to think this does indeed make sense anyway. |
That seems too specialized to me. Another case is e.g. profiles for profile-guided-optimization that need to be generated first? What if somebody wants to parse a spec file to the compiler? To me adding special-case options for these kinds of things to the buildsystem just requires accumulating too much special magic that more often than not will still not suffice.
It's imo an anti-goal to stop stuff like that. I'd avoid it for new projects, but for people migrating it's just completely unnecessary pain. |
The spec file example actually works as |
I'm trying to build a gcc compiler plugin with meson, and use that same gcc compiler plugin within the meson project. (Here's a git repo for reference, but I'll try to reproduce most relevent content here).
Right now, I've got the following
meson.build
:Unfortunately, using
myplugin.full_path()
and string formatting is not sufficient to create a dependency liketest_1.c.o: myplugin
.I've attempted a few methods of creating this dependency, without much luck:
dependencies: myplugin
=>meson.build:13:0: ERROR: Tried to use a build target as a dependency.
dependencies: files(myplugin.full_path())
=>meson.build:13:0: ERROR: File /home/x/meson-gcc-plugin/_b/libmyplugin.so does not exist.
link_with: myplugin
=> well, I don't actually want to link it. But this doesn't work because the dependency only shows up for the link step, not the compile step.Any input here on the intended mechanism for doing this (if there is one) would be appreciated.
The text was updated successfully, but these errors were encountered: