haskell / haskell/cabal

Explicitly support building with -fno-code

Open
#1,176 28 comments 12 reactions 0 assignees View on GitHub
attention: pr-welcome Cabal: other re: -fno-code re: v1-vs-v2 type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Summary by @ezyang.** There is no way to ask Setup to just typecheck a package. It sort of works if you pass `-fno-code` via `--ghc-options` but that's purely accidental.

---

I use `cabal build --ghc-options="-Wall -fno-code"` to quickly get all errors/warnings from a project and show them in an editor.

However, when I have something like this

```
executable Shared.so
hs-source-dirs:
apps
main-is:
Shared.hs
build-depends:
base >= 4 && <= 5
ghc-options:
-optl-shared -optc-DMODULE=Shared -no-hs-main -fPIC -shared -dynamic
cc-options: -DMODULE=Shared -shared
ld-options: -shared /home/niklas/opt/haskell-7.4/lib/ghc-7.4.2/libHSrts-ghc7.4.2.so
```

in my cabal file that only builds a shared object, I get:

```
Warning: the following files would be used as linker inputs, but linking is not being done: dist/build/...
ghc: no input files
Usage: For basic information, try the `--help' option.
```

Should we get this warning although we explicitly said `-fno-code`?

If yes, can we add an option to disable this kind of warning so that it does not clutter the warnings I am actually interested in (to show in the editor)?

---

**Update:**

(The original title was _Add option to disable non-linking warnings with -fno-code_.)

I just realized that there is an actual bug in this:

After the warning, due to the ghc _error_ cabal will just **stop** and build no further. This should not happen as there is no code to build!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.