Skip to content

Add hidir setting#3955

Closed
christiaanb wants to merge 7 commits intohaskell:1.24from
christiaanb:hidir
Closed

Add hidir setting#3955
christiaanb wants to merge 7 commits intohaskell:1.24from
christiaanb:hidir

Conversation

@christiaanb
Copy link
Collaborator

@christiaanb christiaanb commented Oct 8, 2016

This pull request:

@mention-bot
Copy link

@christiaanb, thanks for your PR! By analyzing the history of the files in this pull request, we identified @dcoutts, @luite and @23Skidoo to be potential reviewers.

@23Skidoo
Copy link
Member

23Skidoo commented Oct 8, 2016

Is this supposed to be 1.24-only?

@23Skidoo 23Skidoo changed the title Add hidir setting [WIP] Add hidir setting Oct 8, 2016
@christiaanb
Copy link
Collaborator Author

@23Skidoo I think it should ultimately be master, but I just wanted to fix 8.0 on OS X Sierra first, so I picked the cabal version that is currently shipped with ghc8.

@ezyang
Copy link
Contributor

ezyang commented Oct 8, 2016

Thanks! I haven't dug into the sordid details, but if GHC HQ is behind this plan we'll take these patches.

@23Skidoo 23Skidoo added this to the 1.24.0.1 milestone Oct 9, 2016
@23Skidoo
Copy link
Member

23Skidoo commented Oct 9, 2016

Milestoned for 1.24.0.1 since Christiaan told me he wants this in 1.24.

@christiaanb christiaanb changed the title [WIP] Add hidir setting Add hidir setting Oct 9, 2016
@christiaanb
Copy link
Collaborator Author

Once travis-ci is finished, I feel that this PR is ready to be merged into 1.24

UHC -> "$pkgid"
_other -> "$abi" </> "$libname",
_other -> case buildOS of
OSX -> "$abi" -- OSX libs go into a single directory
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a link to that GHC trac ticket.

Copy link
Contributor

@bgamari bgamari Oct 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any particular reason to make this conditional on the operating system?

Placing dynamic libraries in per-package directories is actually a rather severe performance problem in general since the dynamic linker (on Linux at least) performs a linear scan through RPATH entries when looking for each library. For this reason just running ghc --help on Linux performs over 750 open system calls. This was first documented in GHC #11587 and the obvious solution is to move all dynamic libraries into a single directory, just as you've done here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was needed to fix OS X given time/manpower constraints. I, however, didn't know whether doing it for all operating systems was something all involved parties could agree on. If you, as GHC maintainer, are saying to do it for all operating systems, and Cabal maintainers agree, then it is an easy fix/patch.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it makes sense if it improves start-up performance.

@23Skidoo
Copy link
Member

23Skidoo commented Oct 9, 2016

So both PRs look good modulo some minor comments.

@christiaanb
Copy link
Collaborator Author

Correction, it should not be merged yet. Currently, $hidir is by default defined as $prefix/lib/$abi/$libname on UNIX; but perhaps a better default is $libdir/$abi/$libname.

@23Skidoo
Copy link
Member

23Skidoo commented Oct 9, 2016

You can also call it hisubdir and set it equal to libsubdir by default.

@23Skidoo
Copy link
Member

There are some test failures in #3968, so I'd like to see them resolved first before merging this.

@bgamari
Copy link
Contributor

bgamari commented Oct 10, 2016

On the whole this looks good to me. However, as noted inline, I would like to see this single-directory layout used across all operating systems. Placing each package's shared object in a separate directory is quite bad for dynamic linker performance.

@christiaanb
Copy link
Collaborator Author

christiaanb commented Oct 13, 2016

I'm closing this PR due to the problems mentioned in #3968. I will submit a new PR soon, which reinstates --dynlibdir, through which we can also solve https://ghc.haskell.org/trac/ghc/ticket/12479

@ozataman
Copy link

A bit late to the party, but just ran into this issue. Would using the latest Cabal to set a single dir for lib files also work on GHC 7.10.3? I gave it a try and either I missed a crucial point or it doesn't seem to work.

Any thoughts on a solution under GHC 7.10.3?

@ezyang
Copy link
Contributor

ezyang commented Nov 27, 2016

As the final fix involved modifications to GHC, I think it would take a bit more work to fix this for GHC 7.10.

@ozataman
Copy link

ozataman commented Nov 28, 2016 via email

@gbaz
Copy link
Collaborator

gbaz commented Nov 28, 2016

@ozataman I think you could use a cabal tree that incorporates the changes in #3968 -- that wasn't a complete solution, but if you don't have the corner-cases that ran it aground, it should work on 7.10.3... so if you have projects stalled by needing to be on the latest OS but use ghc 7.10, you could build a cabal fork based on that patchset, I suspect?

@ozataman
Copy link

@gbaz I may not be following you 100% - I've tried the latest cabal release (1.24.1.0) that incorporates the fix on top of GHC 7.10.3 and the issue is still there. It seems we'd need to patch GHC 7.10 to go with it as @ezyang has pointed out. Or perhaps I'm falsely assuming that using a cabal-install based on the latest Cabal to do the installs is enough to get around the issue...

My situation is a bit unfortunate: There are other, non-Haskell related reasons my OS had to be upgraded. However, none of my mid+ sized projects build anymore after the bump and it'll be months before they all get on GHC 8. The machine I'm on is basically disabled for dev work at the moment - thanks Apple!

@gbaz
Copy link
Collaborator

gbaz commented Nov 28, 2016

@ozataman as I understand it, the PR I linked is not in the latest cabal release. It was an attempt at a patch that didn't require GHC changes, but which was not adopted because of corner cases with certain Setup scripts. Instead, a more invasive but more complete change was made which did require GHC changes. So if you use that branch instead, then, potentially, I would imagine that unlike the released cabal, it might be compatible with older ghcs...

@ozataman
Copy link

@gbaz Thank you for pointing that out! I missed that change of direction completely in the few issue threads that were ultimately involved. I will give that a try and report back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants