Ticket #389 (closed defect: fixed)
ld-options not properly escaped when passing them to ghc
|Reported by:||duncan||Owned by:|
|Cc:||Difficulty:||very easy (<1 hour)|
In constructing the ghc command line, the ldOptions are passed directly to ghc without any escaping. Obviously they should be escaped with the -optl prefix.
This bug has been in Cabal since support for ld options was introduced in version 0.4, which was released in January 2005. We got away with it for nearly four years because ghc understands most common ld options like -lfoo or -Lbar.
It cropped up because recent versions of libcurl (at least in Ubuntu Intrepid) supply a pkg-config file which instructs clients to use -Wl,-Bsymbolic-functions when linking to libcurl. Obviously this is not a flag that ghc understands. The bug manifests itself as:
ghc-6.8.3: unrecognised flags: -Wl,-Bsymbolic-functions
The fix is of course trivial:
- ++ ldOptions bi + ++ ["-optl" ++ opt | opt <- ldOptions bi]
Thanks to kowey for discovering it and helping diagnose the source of the problem. It'll be fixed in Cabal-22.214.171.124.
I thought I'd document it here partly because it's interesting to find such a bug that went undiscovered for so long.