Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow cabal to build a cabal package that only has a main c file. #4890

Closed
angerman opened this issue Nov 14, 2017 · 6 comments
Closed

Allow cabal to build a cabal package that only has a main c file. #4890

angerman opened this issue Nov 14, 2017 · 6 comments

Comments

@angerman
Copy link
Collaborator

angerman commented Nov 14, 2017

Cabal currently expects there to be at least one Haskell module, which prevents the following cabal file to build:

cabal-version: >=2.1
Name: unlit
Version: 0.1
Copyright: XXX
License: BSD3
Author: XXX
Maintainer: XXX
Synopsis: Literate program filter
Description: XXX
Category: Development
build-type: Simple

Executable unlit
    Default-Language: Haskell2010
    Main-Is: unlit.c
    C-Sources: unlit.c
@hvr
Copy link
Member

hvr commented Nov 14, 2017

Here's btw an old related issue: #497

@23Skidoo
Copy link
Member

This should already work actually, see #1080 and PackageTests/CMain.

@angerman
Copy link
Collaborator Author

@23Skidoo no. That test, has a crucial ingredient: the Bar.hs module.

@23Skidoo
Copy link
Member

Ah, OK. Shouldn't be that hard to fix, I think.

@hvr
Copy link
Member

hvr commented Nov 14, 2017

@23Skidoo ...and which libraries shall the C-only component be linked with? which headers shall be in -I? I'm specifically thinking about the GHC RTS; shall it be available to a main-is: main.c w/o any haskell modules?

angerman added a commit to zw3rk/cabal that referenced this issue Nov 15, 2017
angerman added a commit to zw3rk/cabal that referenced this issue Nov 15, 2017
@angerman angerman self-assigned this Nov 15, 2017
@23Skidoo
Copy link
Member

@hvr

I'm specifically thinking about the GHC RTS; shall it be available to a main-is: main.c w/o any haskell modules?

I'd say that it shouldn't, unless you have requested it explicitly with something like build-depends: rts. Though I'm not sure that that's how ghc -c foo.c works right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants