[Hackage] #853: Building mixed-language programs with Apple's Objective-C garbage-collection feature is difficult

#853: Building mixed-language programs with Apple's Objective-C garbage- collection feature is difficult ----------------------------+----------------------------------------------- Reporter: dankna | Owner: Type: enhancement | Status: new Priority: normal | Milestone: Component: Cabal library | Version: HEAD Severity: normal | Keywords: Difficulty: unknown | Ghcversion: Platform: | ----------------------------+----------------------------------------------- Ideally, there would be a single flag to set the ObjC garbage collection mode. The three possibilities are, semantically, disabled, optional, and mandatory; I was experimenting with the mandatory mode, but there will be related issues with the others. One might expect the following to work: ld-options: -fobjc-gc-only In fact this will compile successfully but the linked object will have very subtle heap corruption due to the lack of a write barrier (which is implemented by gcc by hooking all field accessors, transparently to the developer). Why yes, this /did/ take me a while to track down! It is necessary to also add: cc-options: -fobjc-gc-only But once this is added, it is impossible to link any Haskell objects in, because they do not contain the magic flag which tells the linker they are GC-aware. We therefore need: ghc-options: -optc-fobjc-gc-only (I think this might force compilation via C when it wouldn't otherwise be used, which is of course undesirable, but I haven't looked into it.) This is somewhat of an ugly situation, but fortuitously, it is simple to remedy - Cabal merely needs to understand what needs to be done and do it! I propose to put the new field in BuildInfo, as it applies to both libraries and executables; to call it "objc-gc:", and to give it the values "Disabled", "Optional", and "Mandatory". I expect to have a patch for this ready sometime tomorrow. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/853 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#853: Building mixed-language programs with Apple's Objective-C garbage- collection feature is difficult ----------------------------+----------------------------------------------- Reporter: dankna | Owner: dankna Type: enhancement | Status: assigned Priority: normal | Milestone: Component: Cabal library | Version: HEAD Severity: normal | Keywords: Difficulty: unknown | Ghcversion: Platform: | ----------------------------+----------------------------------------------- Changes (by dankna): * owner: => dankna * status: new => assigned -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/853#comment:1 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects
participants (1)
-
Hackage