[GHC] #8420: Spurious dynamic library dependencies

#8420: Spurious dynamic library dependencies ------------------------------------+--------------------------------- Reporter: AndreasVoellmy | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | Operating System: MacOS X Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+--------------------------------- It should be possible to have an executable A that depends on dynamic library B which in turn depends on dynamic library C, without A directly depending on C. {{{ A --> B --> C }}} Unfortunately, GHC 7.6.3 does not seem to allow this. Instead it copies the dependencies of B to dependencies of A, so that we get {{{ A -> B,C and B --> C }}} This is unfortunately, because running A will cause the loader to locate C based on the rpaths (assuming we are using rpaths to locate dynamic libraries), whereas only B should know how to get to C from B. The problem seems to be that ghc copies all the library dependencies of B (presumably from the package specification of B) as library dependencies of the A. I verified the problem in GHC 7.6.3, but haven't tried in HEAD yet. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8420 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8420: Spurious dynamic library dependencies
-----------------------------------+------------------------------------
Reporter: AndreasVoellmy | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Resolution: | Keywords:
Operating System: MacOS X | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-----------------------------------+------------------------------------
Comment (by darchon):
It doesn't just apply to OS X, also to linux:
{{{
[10:19am] <christiaanb>
Does https://ghc.haskell.org/trac/ghc/ticket/8420 also apply to linux?
[10:30am]

#8420: Spurious dynamic library dependencies -----------------------------------+------------------------------------ Reporter: AndreasVoellmy | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -----------------------------------+------------------------------------ Comment (by nomeata): I also noticed the problem; we’d like to generate our Debian package dependencies based on what files are linked, but currently that is an over-approximation. I.e. lots of stuff links to libgmp. I believe Ubuntu and OpenSUSE patch their build to use `-Wl,--as-needed`, but I refrained from it, to prevent unnecessary divergence. But I would very much welcome if GHC would build with `-as-needed`, preferably already in GHc-7.8 (as now we build `libHS*.so` files by default for all packages). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8420#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8420: Spurious dynamic library dependencies -----------------------------------+------------------------------------ Reporter: AndreasVoellmy | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -----------------------------------+------------------------------------ Comment (by darchon): It would be my guess this has something to do that the original pipeline was build with static linking in mind. In which case you would need the transitive closure of the libraries you depend on? Looking at `linkBinary'` in `compiler/main/DriverPipeline.hs`, I see that it just gets a list of `PackageId`'s that must be linked, for which, as far as I can see, there is no differentiation between dynamic linking and static linking. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8420#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8420: Spurious dynamic library dependencies -------------------------------------+------------------------------------- Reporter: | Owner: AndreasVoellmy | Status: new Type: bug | Milestone: Priority: normal | Version: 7.6.3 Component: Driver | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thomie): * os: MacOS X => Unknown/Multiple * component: Compiler => Driver -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8420#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC