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

Adjust rpath in cabal-cache artifacts #107

Open
AlexeyRaga opened this issue Mar 1, 2020 · 4 comments
Open

Adjust rpath in cabal-cache artifacts #107

AlexeyRaga opened this issue Mar 1, 2020 · 4 comments

Comments

@AlexeyRaga
Copy link
Contributor

Problem:

[ 9 of 29] Compiling App.Options.Lens ( src/App/Options/Lens.hs, /Users/david/src/arbor/mayhem/banner-commander/dist-newstyle/build/x86_64-osx/ghc-8.6.5/banner-commander-0.0.1/build/App/Options/Lens.o ) [Control.Lens changed]
<command line>: can't load .so/.DLL for: /Users/david/.cabal/store/ghc-8.6.5/lib/libHSrndm-shffl-0.0.4-63f5dfd2-ghc8.6.5.dylib (dlopen(/Users/david/.cabal/store/ghc-8.6.5/lib/libHSrndm-shffl-0.0.4-63f5dfd2-ghc8.6.5.dylib, 5): Library not loaded: /usr/local/opt/ghc/lib/ghc-8.6.5/base-4.12.0.0/libHSbase-4.12.0.0-ghc8.6.5.dylib
  Referenced from: /Users/david/.cabal/store/ghc-8.6.5/lib/libHSrndm-shffl-0.0.4-63f5dfd2-ghc8.6.5.dylib
  Reason: image not found)

sometimes an .so is pushed that has a full path to a base library.

otool -L lib/libHSrndm-shffl-0.0.4-63f5dfd2-ghc8.6.5.dylib 
lib/libHSrndm-shffl-0.0.4-63f5dfd2-ghc8.6.5.dylib:
        @rpath/libHSrndm-shffl-0.0.4-63f5dfd2-ghc8.6.5.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libHSrndm-1.1-46d8c4d3-ghc8.6.5.dylib (compatibility version 0.0.0, current version 0.0.0)
        /usr/local/opt/ghc/lib/ghc-8.6.5/base-4.12.0.0/libHSbase-4.12.0.0-ghc8.6.5.dylib (compatibility version 0.0.0, current version 0.0.0)
        /usr/local/opt/ghc/lib/ghc-8.6.5/integer-gmp-1.0.2.0/libHSinteger-gmp-1.0.2.0-ghc8.6.5.dylib (compatibility version 0.0.0, current version 0.0.0)
        /usr/local/opt/ghc/lib/ghc-8.6.5/ghc-prim-0.5.3/libHSghc-prim-0.5.3-ghc8.6.5.dylib (compatibility version 0.0.0, current version 0.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)

They should all be relative to @rpath:

ghc-8.6.5/lib/libHSBln-0.2.4-a71178c6-ghc8.6.5.dylib:
        @rpath/libHSBln-0.2.4-a71178c6-ghc8.6.5.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libHSbase-4.12.0.0-ghc8.6.5.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libHSinteger-gmp-1.0.2.0-ghc8.6.5.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libHSghc-prim-0.5.3-ghc8.6.5.dylib (compatibility version 0.0.0, current version 0.0.0)
@newhoggy
Copy link
Collaborator

newhoggy commented Mar 2, 2020

Is this a cabal-cache problem or a cabal/ghc problem?

@AlexeyRaga
Copy link
Contributor Author

AFAIK it is just how GHC works: it writes absolute paths in binary artifacts making them much harder to re-distribute.
cabal-cache may help here by re-writing these paths so that they work fine in a target location.

@newhoggy
Copy link
Collaborator

newhoggy commented Mar 2, 2020

Might be worth creating an issue on ghc or cabal too.

@AlexeyRaga
Copy link
Contributor Author

I don't think they see it as an issue. It is a very well known thing, maybe there is a ticket somewhere.
And a very well known solution too. For example nix does exactly that for cached binaries.

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

No branches or pull requests

2 participants