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

Unit tests rewrite libs "-L" to build dir, but not "-Wl,-rpath" #395

Open
nrdvana opened this issue Apr 20, 2023 · 1 comment
Open

Unit tests rewrite libs "-L" to build dir, but not "-Wl,-rpath" #395

nrdvana opened this issue Apr 20, 2023 · 1 comment
Labels
🐣Enhancement Useful potential future feature (not a bug)

Comments

@nrdvana
Copy link

nrdvana commented Apr 20, 2023

After the Gather stage of an Alien module, the Alien module contains strings in ->cflags and ->libs that point to the final install path. But, when Test::Alien is used, those paths are magically rewritten to the equivalent path inside the staging directory.

However, linker rpath instructions in the libs string do not get rewritten, and still point to the final install directory, resulting in a linker command like:

cc -shared -o $staging/tmp/FooTest.so -L$stage/lib -Wl,rpath,$prefix/lib $staging/tmp/fooTest.o -lfoo

The runtime linker then finds the library at $prefix/lib (or doesn't find it, on the first install of the module) and the test fails (or gives a false result).

I searched the code a while but couldn't determine where the rewrite from ${prefix} to ${stage} was occurring. It just needs to apply to -Wl,rpath in addition to -L

@plicease plicease added the 🐣Enhancement Useful potential future feature (not a bug) label May 9, 2023
@plicease
Copy link
Member

plicease commented May 9, 2023

Can you try using Alien::Role::Dino (if you haven't already)? That has platform specific code for handling dynamic libraries, including rpath on the platforms where it is known to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐣Enhancement Useful potential future feature (not a bug)
Development

No branches or pull requests

2 participants