Skip to content

Mac OS X RPATH-related issue when using cabal new-repl #4263

Closed

Description

@bugthunk

cabal-install HEAD used, started from scratch after purging ~/.ghc and ~/.cabal. cabal new-build builds the binary as expected, but new-repl fails, saying:

$ cabal new-repl app-server
In order, the following will be built (use -v for more details):
 - app-0.0.1 (exe:app-server) (ephemeral targets)
Preprocessing executable 'app-server' for app-0.0.1...
GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help
<command line>: can't load .so/.DLL for: /Users/fcar/.cabal/store/ghc-8.0.2/servant-auth-server-0.2.1.0-efe758625dac2edc974329c8463fa768f38aba7638472ecdb2325ccd5b848f62/lib/libHSservant-auth-server-0.2.1.0-efe758625dac2edc974329c8463fa768f38aba7638472ecdb2325ccd5b848f62-ghc8.0.2.dylib (dlopen(/Users/fcar/.cabal/store/ghc-8.0.2/servant-auth-server-0.2.1.0-efe758625dac2edc974329c8463fa768f38aba7638472ecdb2325ccd5b848f62/lib/libHSservant-auth-server-0.2.1.0-efe758625dac2edc974329c8463fa768f38aba7638472ecdb2325ccd5b848f62-ghc8.0.2.dylib, 5): no suitable image found.  Did find:
	/Users/fcar/.cabal/store/ghc-8.0.2/servant-auth-server-0.2.1.0-efe758625dac2edc974329c8463fa768f38aba7638472ecdb2325ccd5b848f62/lib/libHSservant-auth-server-0.2.1.0-efe758625dac2edc974329c8463fa768f38aba7638472ecdb2325ccd5b848f62-ghc8.0.2.dylib: malformed mach-o: load commands size (35832) > 32768)
cabal: repl failed for exe:app-server from app-0.0.1.

Activity

  1. added this to the 2.0 milestone on Jan 25, 2017
  2. 23Skidoo commented on Jan 25, 2017

    @23Skidoo
    Member
  3. bugthunk commented on Jan 25, 2017

    @bugthunk
    Author
  4. added
    cabal-install: v2-build system
    on Jan 25, 2017
  5. christiaanb commented on Jan 25, 2017

    @christiaanb
    Collaborator

    No surprise there... sadly.... the whole range of cabal new-<command> will run into this bug. We solved this problem for "old-style" builds, by putting all .dylib files all into one directory, so that only one RPATH per package datebase is needed (so two in most cases: global and user).

    With "new-style" builds, all the .dylib files still each go into their own directory. I have no idea how the hashing works for new-style, but I guess it should be possible to put the dylibs can go into the shared build-store lib directory without conflicts. @dcoutts probably knows.

  6. 23Skidoo commented on Jan 25, 2017

    @23Skidoo
    Member

    @christiaanb Thanks! That's what I suspected.

    This shouldn't be very hard to fix, so I think we should try to get the fix into 2.0.

  7. christiaanb commented on Jan 25, 2017

    @christiaanb
    Collaborator

    So the line that needs "fixing" is:

    That dynlibdir shouldn't be equal to libdir, which in turn is equal to prefix/lib, where prefix is the $STORE/package-hash. It should be equal to $STORE or $STORE/dynlib. Whethe the dylibs already get the correctly hashed names I have no idea.

  8. ezyang commented on Jan 27, 2017

    @ezyang
    Contributor

    I think it should be OK to dump all of the dynamic libraries for .cabal/store in a single directory. @christiaanb do you want to submit a patch? dylibs are hashed correctly; they will look like libHSp-0.1.0.0-hash-ghcx.y.z.dylib

  9. modified the milestones: 2.0, 2.0.1 on Feb 17, 2017
  10. added a commit that references this issue on Mar 28, 2017
    fd62f51
  11. modified the milestones: 2.0.1, 2.0.2 on Sep 19, 2017
  12. modified the milestones: 2.0.2, 2.4 on Aug 29, 2018
  13. modified the milestones: 2.4, 2.4.1 on Sep 17, 2018
  14. modified the milestones: 2.4.1.0, 2.4.2.0 on Apr 26, 2019
  15. modified the milestones: 2.4.2.0, 3.4 on Nov 27, 2019
  16. ulysses4ever commented on Apr 18, 2023

    @ulysses4ever
    Collaborator

    Appears to have been fixed in

    Please, reopen if not.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    cabal-install: v2-build systemtype: bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions