Skip to content

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

Open
@nrdvana

Description

@nrdvana

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐣EnhancementUseful potential future feature (not a bug)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions