Repository navigation
Closed
Milestone
Description
hPutStrLn testchnd "int foo() { return 0; }"
hClose testchnd; hClose testohnd
runProgram verbosity ghcProg
[ "-hide-all-packages"
, "-c", testcfile
, "-o", testofile
]
cabal calls ghc just like that, without respecting the C compiler and linker that the user has set in --ghc-options and --with-gcc/with-ld.
To reproduce, simply sudo mv /usr/bin/gcc /usr/bin/gcc.backup and try to run cabal configure --with-gcc=clang --with-ld=clang -v3. You will get:
("/home/niklas/bin/ghc",["-c","/tmp/1804289383846930886.c","-o","/tmp/16816927771714636915.o"])
ghc: could not execute: /usr/bin/gcc
In this instance, cabal ignored --with-gcc.
--
Next, make gcc available again (sudo mv /usr/bin/gcc.backup /usr/bin/gcc), complete the configure, then move gcc away again and try to compile a
library
hs-source-dirs: src
exposed-modules: Lib
build-depends: base
ghc-options: "-pgmP clang" "-pgmc clang" "-pgma clang" "-pgml clang"
You will get when Linking... the library:
("/home/niklas/bin/ghc",["-shared","-dynamic","-dynload deploy","-optl-Wl,-rpath,/raid/stack/programs/x86_64-linux/ghc-7.10.3/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM","-optl-Wl,-rpath,/raid/stack/programs/x86_64-linux/ghc-7.10.3/lib/ghc-7.10.3/rts","-optl-Wl,-rpath,/raid/stack/programs/x86_64-linux/ghc-7.10.3/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3","-optl-Wl,-rpath,/raid/stack/programs/x86_64-linux/ghc-7.10.3/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS","-this-package-key","linkw_0jOmkDd3hz89pUUv8NIHkg","-no-auto-link-packages","-package-db","dist/package.conf.inplace","-package-id","base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d","dist/build/Lib.dyn_o","-o","dist/build/libHSlink-with-lld-example-1-0jOmkDd3hz89pUUv8NIHkg-ghc7.10.3.so"])
ghc: could not execute: /usr/bin/gcc
Reacted by David Feuer, david cao, Gleb Peregud, Chris Done, Vladislav Zavialov, Gavin Whelan, Taylor Fausak, Brandon Simmons, Josh Vera, Jakub Zarybnicky and 3 more
Activity
jberryman commentedon Apr 12, 2017
Linking back to the context/motivation: https://github.com/nh2/link-with-lld-example
ezyang commentedon May 7, 2017
@nh2 If you want to attempt solving this ticket, I'd be happy to advise. I hope that this is as simple as going through the ProgramDb interface rather than doing it directly, but there may be other complications.
Respect ghc-options and with-gcc when compiling C sources
Respect ghc-options and with-gcc when compiling C sources
7 remaining items
Mikolaj commentedon Jan 12, 2022
@jberryman: thank you for #7900, which is now merged, which ends the saga! Please, everybody, test and reopen if anything doesn't work as expected.
andreasabel commentedon Mar 22, 2022
Investigate regression:
ghc-options-pgmP-optP#8058gbaz commentedon Jun 8, 2023
reclosing. anything future with the upstream issue were are blocked in can be handled in the other ticket.