mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.3k stars 1.52k forks source link

rfe: install_rpath and build_rpath should accept string list #13163

Open stsp opened 2 weeks ago

stsp commented 2 weeks ago

I have custom_target that passes a few -Wl,-rpath= as link_args. And I am getting this warning:

WARNING: Please do not define rpath with a linker argument, use install_rpath
or build_rpath properties instead.
This will become a hard error in a future Meson release.

The warning is duplicated as many times as there are -Wl,-rpath= args.

But if I try to follow that warning, then I get:

src/meson.build:69:10: ERROR: shared_library keyword argument 'install_rpath' was of type array[str]
but should have been str

So it seems absolutely impossible to pass multiple rpathes w/o getting multiple warnings. Please allow build_rpath and install_rpath to take the list of strings.

dcbaker commented 1 week ago

It makes sense to me to support a string array as well, but you can get around this by passing the rpath as a : delimited string, ie:

build_target(
    ...,
    install_rpath : 'first/path:second/path:third/path'
)
stsp commented 1 week ago

This produces a very strange effect. I did: install_rpath: '/usr/local/i386-pc-dj64/lib64:/usr/i386-pc-dj64/lib64' and got this: -Wl,-rpath,/usr/local/i386-pc-dj64/lib64:XXXXXXXXXXXXXXXXXXXXXXXX -Wl,-rpath-link,/usr/local/i386-pc-dj64/lib64 So -rpath-link ignored everything after : and -rpath replaced the second part with XXX. WTf?

dcbaker commented 1 week ago

Dang. Well, there goes my workaround idea.

that XXXXX thing is create padding so that at install time we can do a binary edit of the elf header instead of re-linking. It’s just breaking on the :

stsp commented 1 week ago

But not a problem, as I think hacking around elf header is a bad idea anyway. So lets try rpath_build: -Wl,-rpath,/usr/local/i386-pc-dj64/lib64:/usr/local/i386-pc-dj64/lib64:/usr/i386-pc-dj64/lib64 -Wl,-rpath-link,/usr/local/i386-pc-dj64/lib64

Not much better: -rpath has 1 part repeated twice, and -rpath-link still has just 1 part. No XXX now though. I think there is something to fix here. These transformations seems to make no sense.