
#15758: hsc2hs broken due to incorrect argument passing to the hsc2hs executable -------------------------------------+------------------------------------- Reporter: osa1 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by hvr): It's remarkable how many bugs this issue entails... :-) I've quickly addressed part of the issue via https://github.com/haskell/hsc2hs/commit/8807b4cd9b9efc719828b52cd9aecb9892d... (one problem to consider is that we have at least two lib:Cabal releases out there eligible to custom Setup.hs scripts as well as included in the cabal-install-2.4.0.0 release which have the `>= 0.68.4` logic hardwired; so the metadata revision is the most economical way to mitigate that issue) So the next thing that needs fixing is the hsc2hs wrapper script used for inplace; moreoever I noticed yet another bug that wasn't mentioned here: GHC also installs a wrapper script into its installed `bin/` folder, e.g. `/opt/ghc/8.6.1/bin/hsc2hs`: {{{#!bash #!/bin/sh exedir="/opt/ghc/8.6.1/lib/ghc-8.6.1/bin" exeprog="hsc2hs" executablename="$exedir/$exeprog" datadir="/opt/ghc/8.6.1/share" bindir="/opt/ghc/8.6.1/bin" topdir="/opt/ghc/8.6.1/lib/ghc-8.6.1" HSC2HS_EXTRA="--cflag=-fno-stack-protector --lflag=-fuse-ld=gold" #!/bin/sh tflag="--template=$topdir/template-hsc.h" Iflag="-I$topdir/include/" for arg do case "$arg" in # On OS X, we need to specify -m32 or -m64 in order to get gcc to # build binaries for the right target. We do that by putting it in # HSC2HS_EXTRA. When cabal runs hsc2hs, it passes a flag saying which # gcc to use, so if we set HSC2HS_EXTRA= then we don't get binaries # for the right platform. So for now we just don't set HSC2HS_EXTRA= # but we probably want to revisit how this works in the future. # -c*) HSC2HS_EXTRA=;; # --cc=*) HSC2HS_EXTRA=;; -t*) tflag=;; --template=*) tflag=;; --) break;; esac done exec "$executablename" ${tflag:+"$tflag"} $HSC2HS_EXTRA ${1+"$@"} "$Iflag" }}} while this script doesn't inject any `--`s before response-file args, it exhibits a different problem: it's logic is completely bypassed when you use response files, as the script then cannot rewrite the flags because it doesn't look into the response files! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15758#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler