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

Using install_rpath for AIX #13981

Open
KamathForAIX opened this issue Dec 5, 2024 · 3 comments · May be fixed by #14079
Open

Using install_rpath for AIX #13981

KamathForAIX opened this issue Dec 5, 2024 · 3 comments · May be fixed by #14079

Comments

@KamathForAIX
Copy link
Contributor

Hi community members,

Currently in AIX, there is no way [as far as I have searched] to pass install_path during the build while using Meson unless and until a project has given provision for the same using an option.

What we are looking for is something like CMAKE_INSTALL_RPATH.

Is there any way we can do the same in Meson?

If we cannot, then in AIX, we do pass in an environment variable called LD_FLAGS.

For example,
export LDFLAGS="-Wl,-blibpath:/opt/freeware/lib/pthread:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib"

When we pass like this gcc understands that this is a linker flag and we are asking the compiler to set the LIBPATH within the XCOFF object to the blibpath mentioned in LDFLAGS.

By doing so when we dump a shared object we get,
image

If you see the path is what I have given from LDFLAGS when I created this library manually. [See Import File strings Index 0]

When we compile a package through pip in particular there is no way to tell meson that Hey we are looking to add the LDFLAGS blibpath that should override the build_rpath.

Hence I would like to add this feature in Meson for AIX by making some changes here.

Kindly let me know if we can proceed to add this via LDFLAGS environment variable or if the community has some other way to achieve the same.

@eli-schwartz
Copy link
Member

On Linux, the meson.build can set an rpath to be used and the GNU option -Wl,-rpath=... can be passed both via LDFLAGS and via e.g. pkg-config dependencies.

Meson will also pass a few of its own during the build in case of libraries and executables that depend on each other, so that running the software directly in ./builddir/... will work. At install time, it will rewrite the binary file if it can, using mesonbuild/scripts/depfixer.py, to remove build-time-only paths and add meson.build install_rpath entries.

Are the correct rpaths present when you inspect the build directory? Do they just disappear during install? If they only disappear during install then it's possible the depfixer.py routines are broken on AIX. We have some logic in there to figure out which RPATH entries come from LDFLAGS and preserve them, but it's possible this only got wired up for GNU.

...

It is absolutely expected behavior that if you add this via LDFLAGS it should be respected.

@KamathForAIX
Copy link
Contributor Author

@eli-schwartz

Meson will also pass a few of its own during the build in case of libraries and executables that depend on each other, so that running the software directly in ./builddir/... will work.

I get this. That is why we are able to run the meson test.

Are the correct rpaths present when you inspect the build directory?
Yes.

Do they just disappear during install?
No. But the issue is that the paths passed via -Wl,blibpath in the LDFLAGS environment variable are not considered by meson as of now in AIX.

We have some logic in there to figure out which RPATH entries come from LDFLAGS and preserve them, but it's possible this only got wired up for GNU.

Yes, I see that the logic is for opening an ELF format binary in depfixer.py and changing the libpath. But this will not work for the XCOFF object file in AIX. But I think we should do the same for AIX.

Can we develop something similar for AIX in depfixer.py with a different class, may be XCOFF? The requirement is that if we have blibpath from LDFLAGS environment variables, then we simply add that along with the required rpaths at install time.

@eli-schwartz
Copy link
Member

Yes please :) do whatever it takes to make sure that meson's AIX handling supports the same features that the Linux handling does.

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 a pull request may close this issue.

2 participants