Skip to content
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

Add cc.get_export_dynamic_link_args() #3460

Closed
wants to merge 1 commit into from

Conversation

xclaesse
Copy link
Member

This is needed by glib to expose in gmodule-export-2.0.pc.

@jpakkane
Copy link
Member

Instead of exposing the flags to everyone, could we instead add a kwarg like export_dynamic or something like that to actually do the magic behind the scenes?

@xclaesse
Copy link
Member Author

Could be added in pkg.generate() API but that seems awfully specific method just for glib. A method on the compiler seems more natural to me and could be useful to other use cases, even if I couldn't think about one now.

@jpakkane
Copy link
Member

jpakkane commented May 15, 2018

For comparison, would the following (roughly, in pseudocode) work for you in all cases:

if cc.has_link_argument('-rdynamic')
  ldflags_to_put_in_pc_file += '-rdynamic'
endif

@xclaesse
Copy link
Member Author

We can always do it manually of course. The point here is meson already know what flag to pass for each compiler/platform to implement executable(export_dynamic:true), so better use those same flags to not duplicate them. Autotools also expose it in its default variables.

@jpakkane
Copy link
Member

Well yes. But the thing that concerns me here is that we are getting into very specific an niche use cases. Adding a top level function that will only be used by a few projects in the entire world is heading deeply in the death-by-a-thousand-paper-cuts territory.

In theory we could add a more generic function, something like:

args = cc.get_linker_flags_for_feature('export-dynamic')

which could then be used more generally, but that requires more use cases than just this one.

This has also the very unfortunate downside that people will start doing something stupid like this:

executable(..., link_args : cc.get_linker_flags_for_feature('export-dynamic'))

rather than:

executable(..., export_dynamic : true)

You may laugh, but every feature we have that can be used in a similar way has been used in exactly that incorrect way, even if we specifically tell people not to. This makes Meson look bad because if they see the former being used they will think that is how Meson should be used and the syntax on that just looks awful.

@xclaesse
Copy link
Member Author

xclaesse commented May 15, 2018

Could add a warning in executable() if it finds export-dynamic in link_args. That would be good in any case since export_dynamic:true is pretty new and I'm sure many projects already passed that flag manually.

What scares me a bit doing it manually in glib is configure script has MANY cases with different value for export_dynamic_flag_spec. Arguably most are for decades old compilers, but still each compiler could have a different flag and only meson knows that. That's why gen_export_dynamic_link_args() is a method that could be overridden by each compiler subclass.

@xclaesse
Copy link
Member Author

jpakkane (IRC) In that format it won't be accepted. As part of a more general solution, maybe, but it needs more real world use cases.

I personally disagree with that decision, but let's abandon this PR then.

@xclaesse xclaesse closed this May 16, 2018
@xclaesse xclaesse deleted the export-dynamic branch May 16, 2018 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants