Skip to content

Cabal should probably add extra-lib-dirs to RPATH #7339

@bgamari

Description

@bgamari

Describe the bug
In GHC #19350 it was noted that dynamic libraries findable via extra-lib-dirs are not found in GHCi on POSIX platforms. While in principle GHC has the information that it needs to find these libraries from the package database registration, due to limitations of the the POSIX dynamic linking interface, it is not possible for GHC to do better here.

I believe the solution here is to (on POSIX platforms) add Cabal's extra-lib-dirs paths to RPATH during the final link of libraries. This isn't a perfect solution (since it may result in spurious RPATH entries) but this seems to be the best we can do.

To Reproduce
See this testcase.

Expected behavior
GHCi is able to load libraries with foreign dependencies findable only via extra-lib-dirs.

System information

  • Operating system
  • cabal, ghc versions

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

re: dynamic-linkingConcerning dynamic linking (e.g. flags "shared", "*-dynamic")type: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions