[GHC] #8266: Dynamic linking on Mac
GHC
ghc-devs at haskell.org
Wed Jan 8 10:57:50 UTC 2014
#8266: Dynamic linking on Mac
--------------------------------------------+------------------------------
Reporter: kazu-yamamoto | Owner:
Type: bug | thoughtpolice
Priority: highest | Status: closed
Component: Build System | Milestone: 7.8.1
Resolution: fixed | Version: 7.7
Operating System: MacOS X | Keywords:
Type of failure: GHC doesn't work at all | Architecture:
Test Case: | Unknown/Multiple
Blocking: | Difficulty: Unknown
| Blocked By:
| Related Tickets:
--------------------------------------------+------------------------------
Comment (by darchon):
The latest patch makes Mach-O (currently just Darwin, not iOS) behave the
same as ELF in terms of dynamic linking. That is, all dynamic library
locations are now relative to `@rpath`, and GHC adds `LC_RPATH` commands
for every directory containing the dependent libraries. This enables the
use-case of using `cabal -w inplace/bin/ghc-stage2`.
Cabal will however need an update as well, as libraries installed by Cabal
will still use absolute paths:
{{{
-- Installed by GHC install
@rpath/package1.dylib
@rpath/package2.dylib
@rpath/package3.dylib
-- Installed by Cabal
/absolute_path_to_library/package4.dylib
/absolute_path_to_library/package5.dylib
}}}
By applying the following patch to Cabal:
{{{
diff --git a/Cabal/Distribution/Simple/GHC.hs
b/Cabal/Distribution/Simple/GHC.hs
index c7ea633..78cdcbb 100644
--- a/Cabal/Distribution/Simple/GHC.hs
+++ b/Cabal/Distribution/Simple/GHC.hs
@@ -867,11 +867,6 @@ buildOrReplLib forRepl verbosity pkg_descr lbi lib
clbi = do
ghcOptDynLinkMode = toFlag GhcDynamicOnly,
ghcOptInputFiles = dynamicObjectFiles,
ghcOptOutputFile = toFlag sharedLibFilePath,
- -- For dynamic libs, Mac OS/X needs to know the install
location
- -- at build time.
- ghcOptDylibName = if buildOS == OSX
- then toFlag
sharedLibInstallPath
- else mempty,
ghcOptPackageName = toFlag pkgid,
ghcOptNoAutoLinkPackages = toFlag True,
ghcOptPackageDBs = withPackageDB lbi,
}}}
The situation will change to:
{{{
-- Installed by GHC install
@rpath/package1.dylib
@rpath/package2.dylib
@rpath/package3.dylib
-- Installed by Cabal
@rpath/package4.dylib
@rpath/package5.dylib
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8266#comment:31>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list