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

Don't use installedPkgs for internal library library dirs. #4033

Merged
merged 1 commit into from
Oct 27, 2016

Conversation

ezyang
Copy link
Contributor

@ezyang ezyang commented Oct 25, 2016

In 1.24, installedPkgs contained only references to the external package
database, not any internal libraries. In particular, when we built a
dynamically linked executable, installedPkgs did NOT have a reference to
the internal library; instead, depLibraryPaths has a special case
(hasInternalDeps) to add the final libdir to the RPATH.

In HEAD, after 0d15ede, we started adding internal libraries (with the
INPLACE registrations) to installedPkgs to fix #2971. But depLibraryPaths
was not updated, which means that the inplace registrations got picked
up and added to the RPATH, resulting in bad temporary directories
showing up in RPATHs.

In this commit, we just filter out internal entries from installedPkgs
and compute the library dirs for them from scratch (this code already
existed, so no loss!)

Fixes #4025.

Signed-off-by: Edward Z. Yang ezyang@cs.stanford.edu

@mention-bot
Copy link

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

In 1.24, installedPkgs contained only references to the external package
database, not any internal libraries. In particular, when we built a
dynamically linked executable, installedPkgs did NOT have a reference to
the internal library; instead, depLibraryPaths has a special case
(hasInternalDeps) to add the final libdir to the RPATH.

In HEAD, after 0d15ede, we started adding internal libraries (with the
INPLACE registrations) to installedPkgs to fix haskell#2971.  But depLibraryPaths
was not updated, which means that the inplace registrations got picked
up and added to the RPATH, resulting in bad temporary directories
showing up in RPATHs.

In this commit, we just filter out internal entries from installedPkgs
and compute the library dirs for them from scratch (this code already
existed, so no loss!)

Fixes haskell#4025.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
@ezyang
Copy link
Contributor Author

ezyang commented Oct 25, 2016

CC @trofi

@ezyang ezyang self-assigned this Oct 25, 2016
@ezyang ezyang added this to the 2.0 milestone Oct 25, 2016
@ezyang
Copy link
Contributor Author

ezyang commented Oct 27, 2016

Last call for CRs otherwise I'm merging this sucker.

@23Skidoo
Copy link
Member

Looks reasonable to me.

@trofi
Copy link
Contributor

trofi commented Oct 27, 2016

Tried to apply it on top of ghc-HEAD and it's Cabal submodule and it worked!

Thank you! I have another question though (see below) :)

$ readelf -a ./.cabal-sandbox/bin/read-idiii | grep RUNP

 0x000000000000001d (RUNPATH)            Library runpath: [/tmp/foo/.cabal-sandbox/lib/x86_64-linux-ghc-8.1.20161026:/usr/lib64/hunit-1.3.1.2/ghc-8.1.20161026:/usr/lib64/missingh-1.4.0.1/ghc-8.1.20161026:/usr/lib64/ghc-8.1.20161026/array-0.5.1.1:/usr/lib64/ghc-8.1.20161026/base-4.9.0.0:/usr/lib64/ghc-8.1.20161026/binary-0.8.3.0:/usr/lib64/ghc-8.1.20161026/bytestring-0.10.8.1:/usr/lib64/ghc-8.1.20161026/containers-0.5.7.1:/usr/lib64/data-accessor-0.2.2.7/ghc-8.1.20161026:/usr/lib64/ghc-8.1.20161026/deepseq-1.4.2.0:/usr/lib64/ghc-8.1.20161026/directory-1.2.6.2:/usr/lib64/ghc-8.1.20161026/filepath-1.4.1.0:/usr/lib64/ghc-8.1.20161026/ghc-prim-0.5.0.0:/usr/lib64/hslogger-1.2.10/ghc-8.1.20161026:/usr/lib64/ghc-8.1.20161026/integer-gmp-1.0.0.1:/usr/lib64/mtl-2.2.1/ghc-8.1.20161026:/usr/lib64/network-2.6.3.1/ghc-8.1.20161026:/usr/lib64/old-locale-1.0.0.7/ghc-8.1.20161026:/usr/lib64/old-time-1.1.0.3/ghc-8.1.20161026:/usr/lib64/parsec-3.1.11/ghc-8.1.20161026:/usr/lib64/polyparse-1.12/ghc-8.1.20161026:/usr/lib64/ghc-8.1.20161026/process-1.4.2.0:/usr/lib64/random-1.1/ghc-8.1.20161026:/usr/lib64/regex-base-0.93.2/ghc-8.1.20161026:/usr/lib64/regex-compat-0.95.1/ghc-8.1.20161026:/usr/lib64/regex-posix-0.95.2/ghc-8.1.20161026:/usr/lib64/ghc-8.1.20161026/rts:/usr/lib64/text-1.2.2.1/ghc-8.1.20161026:/usr/lib64/ghc-8.1.20161026/time-1.6.0.1:/usr/lib64/ghc-8.1.20161026/transformers-0.5.2.0:/usr/lib64/ghc-8.1.20161026/unix-2.7.2.0:/usr/lib64/utf8-string-1.0.1.1/ghc-8.1.20161026:/usr/lib64/x86_64-linux-ghc-8.1.20161026]

Cabal is supposed to install dyn libs to the same shared location.
Why does Cabal keep injecting path to static libs to RUNPATH?

$ ls /usr/lib64/x86_64-linux-ghc-8.1.20161026 | wc -l
270
$ ls /usr/lib64/missingh-1.4.0.1/ghc-8.1.20161026
Control  Data  Network  System  Text  libHSMissingH-1.4.0.1-KZEaH0SMnibJN6ydQLBYpT.a

Worth a separate bug report?

@ezyang
Copy link
Contributor Author

ezyang commented Oct 27, 2016

Yeah, that also sounds like a bug.

@ezyang ezyang merged commit 37b112f into haskell:master Oct 27, 2016
@trofi
Copy link
Contributor

trofi commented Oct 27, 2016

Filed #4046

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants