Skip to content

openmpi-4.1.6: ldflags in pkg-config incompatible with CMake's pkg_check_modules(... IMPORTED_TARGET ...) #12194

Open
@SomeoneSerge

Description

@SomeoneSerge

Thank you for taking the time to submit an issue!

Background information

What version of Open MPI are you using? (e.g., v3.0.5, v4.0.2, git branch name and hash, etc.)

v4.1.6

❯ nix eval github:NixOS/nixpkgs/91a00709aebb3602f172a0bf47ba1ef013e34835#openmpi.version
"4.1.6"

Describe how Open MPI was installed (e.g., from a source/distribution tarball, from a git clone, from an operating system distribution package, etc.)

nix build github:NixOS/nixpkgs/91a00709aebb3602f172a0bf47ba1ef013e34835#openmpi

Details of the problem

I'm not sure if this has been addressed on master yet (I don't think it has), but in v4.1.6 the generated .pc files' Libs contain a number of occurrences of the pattern -Wl,-rpath -Wl,... where the argument to -rpath is passed on as a separate token. CMake only keeps the first -Wl,-rpath. This issue can be alleviated by passing the the paths as -Wl,-rpath,${libfabricPath}

❯ nix build github:NixOS/nixpkgs/91a00709aebb3602f172a0bf47ba1ef013e34835#openmpi
❯ cat result/lib/pkgconfig/ompi-c.pc
...
Libs: ...   -Wl,-rpath -Wl,${libdir}  -Wl,-rpath -Wl,/nix/store/iyzz6m4dr6grn10qi67a1g1lp3wrnk7j-libfabric-1.20.0-dev/lib ...

Cf. also https://discourse.cmake.org/t/issues-with-opmi-cxx-pc-s-ldflags-and-pkg-check-modules-imported-target/9651

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions