
#12479: build fail of commercialhaskell.com with stack build on mac os x sierra beta 4 -------------------------------------+------------------------------------- Reporter: stephenb | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: #12198 | Differential Rev(s): Phab:D2532 Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): The OS X linker has an option '''-dylib_file''' ''install_name:file_name'' Specifies that a dynamic shared library is in a different location than its standard location. Use this option when you link with a library that is dependent on a dynamic library, and the dynamic library is in a location other than its default location. ''install_name'' specifies the path where the library normally resides. ''file_name'' specifies the path of the library you want to use instead. For example, if you link to a library that depends upon the dynamic library libsys and you have libsys installed in a nondefault location, you would use this option: '''-dylib_file /lib/libsys_s.A.dylib:/me/lib/libsys_s.A.dylib'''. So GHC could do something like this. When it needs to link a temporary shared library against a Haskell package, rather than using `-Ll -Wl,-rpath -Wl,l` to add the package's library directory `l` to the rpath, since `l` typically has a form like `/home/rwbarton/.cabal/lib/x86_64 -linux-ghc-7.8.4/text-1.1.1.3`, instead add the parent directory of `l` to the rpath and use `-dylib_file` to link against the library with an install name of `@rpath/text-1.1.1.3/libHStext-1.1.1.3-ghc7.8.4.dylib`. Since the parent directories of the package libraries will generally be mostly the same (like `/home/rwbarton/.cabal/lib/x86_64-linux-ghc-7.8.4`), they can be deduplicated to save most of the size of the load commands. This is kind of a hack that relies on the directory structure that Cabal produces to be effective, but it has the advantage of being a local change. Cabal would also need some similar change in order for the final libraries that it links to be loadable. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12479#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler