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

Enable Cabal's own RPATH handling on *BSD and Solaris #7382

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

depressed-pho
Copy link

@depressed-pho depressed-pho commented May 5, 2021

Cabal is confirmed to be capable of handling RPATH on these platforms.


Please include the following checklist in your PR:

Cabal is confirmed to be capable of handling RPATH on these platforms.
@depressed-pho depressed-pho changed the title Mark *BSD and Solaris to have RPATH support Enable Cabal's own RPATH handling on *BSD and Solaris May 5, 2021
@angerman
Copy link
Collaborator

angerman commented May 5, 2021

@depressed-pho but do we want cabal to handle rpath logic? Or do we want GHC to handle rpath logic? At least on Darwin there is a strong case to be made for GHC to handle rpath logic, as ghc can control the linking more precisely. If cabal passes -rpath to ghc, it will just pass that on verbatim. Whereas when GHC is responsible for -rpath injection, it can make adjustments that suite the target better than just having to verbatim pass on the linker arguments. I'm not saying this isn't a good change, I'm just weary if cabal should even be doing this in the first place. See also #7094

@depressed-pho
Copy link
Author

@depressed-pho but do we want cabal to handle rpath logic? Or do we want GHC to handle rpath logic? At least on Darwin there is a strong case to be made for GHC to handle rpath logic, as ghc can control the linking more precisely. If cabal passes -rpath to ghc, it will just pass that on verbatim. Whereas when GHC is responsible for -rpath injection, it can make adjustments that suite the target better than just having to verbatim pass on the linker arguments. I'm not saying this isn't a good change, I'm just weary if cabal should even be doing this in the first place. See also #7094

We do want Cabal to handle it. Suppose we have a Cabal package which defines a library, and also an executable that depending on the library. Without Cabal's rpath logic, GHC would link the executable with an rpath pointing at the build directory, not the final destination where the library is going to be installed. This is because GHC doesn't know that the library will be placed somewhere else, and only Cabal knows that (and correctly handles that for Linux atm).

@angerman
Copy link
Collaborator

@depressed-pho but do we want cabal to handle rpath logic? Or do we want GHC to handle rpath logic? At least on Darwin there is a strong case to be made for GHC to handle rpath logic, as ghc can control the linking more precisely. If cabal passes -rpath to ghc, it will just pass that on verbatim. Whereas when GHC is responsible for -rpath injection, it can make adjustments that suite the target better than just having to verbatim pass on the linker arguments. I'm not saying this isn't a good change, I'm just weary if cabal should even be doing this in the first place. See also #7094

We do want Cabal to handle it. Suppose we have a Cabal package which defines a library, and also an executable that depending on the library. Without Cabal's rpath logic, GHC would link the executable with an rpath pointing at the build directory, not the final destination where the library is going to be installed. This is because GHC doesn't know that the library will be placed somewhere else, and only Cabal knows that (and correctly handles that for Linux atm).

Fair, but in that case Cabal needs to replicate the stripping and post link fixup logic GHC currently has; which to me does not seem very elegant, especially as cabal than needs to keep up to date what is fixed in ghc.

This might be an ELF / MachO issue, but I would believe that install_name_tool should be able to correct library locations.

@mergify mergify bot added the merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days label Sep 1, 2022
@ulysses4ever ulysses4ever removed the merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days label Sep 3, 2022
@Kleidukos
Copy link
Member

Marking this PR as draft 🙂

@Kleidukos Kleidukos marked this pull request as draft May 17, 2023 06:23
@Mikolaj Mikolaj mentioned this pull request Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants