Skip to content

Unable to use c2hs in project #6852

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

Closed
poscat0x04 opened this issue May 26, 2020 · 2 comments
Closed

Unable to use c2hs in project #6852

poscat0x04 opened this issue May 26, 2020 · 2 comments

Comments

@poscat0x04
Copy link
Contributor

poscat0x04 commented May 26, 2020

Describe the bug
Whenever I try to build project with c2hs in build-tools the build process got cutoff for some reason

Resolving dependencies...
Build profile: -w ghc-8.8.3 -O2
In order, the following will be built (use -v for more details):
 - c2hs-0.28.6 (exe:c2hs) (requires build)
 - tdlib-0.1.0 (lib:tdlib, test:tdlib-test) (configuration changed)
Starting     c2hs-0.28.6 (exe:c2hs)
Building     c2hs-0.28.6 (exe:c2hs)
Haddock      c2hs-0.28.6 (exe:c2hs)
Warning: Failed to build documentation for exe:c2hs from c2hs-0.28.6 (which is
required by tdlib-0.1.0).
<End>

cabal exited without failures but the project never gets built. Also cabal seems to be compiling c2hs over and over again instead of using the cached c2hs.

To Reproduce

  • add c2hs to build-tools
  • cabal-build
$ cabal v2-build ...

Please use version-prefixed commands (e.g. v2-build or v1-build) to avoid ambiguity.

Expected behavior
The project

System information

  • Operating system: nixos
  • cabal, ghc versions
    cabal 3.2.0.0
    ghc 8.8.3

Additional context

the cabal file

cabal-version: 1.24

-- This file has been generated from package.yaml by hpack version 0.33.0.
--
-- see: https://github.com/sol/hpack
--
-- hash: 26c54ea1e72cfdc61a6daaf86b5a1c793157e1f003db426405ef86c0b0c4a196

name:           tdlib
version:        0.1.0
description:    Please see the README on GitHub at <https://github.com/poscat0x04/tdlib#readme>
homepage:       https://github.com/poscat0x04/tdlib#readme
bug-reports:    https://github.com/poscat0x04/tdlib/issues
author:         Poscat
maintainer:     [email protected]
copyright:      (c) 2020 Poscat
license:        BSD3
license-file:   LICENSE
build-type:     Custom
extra-source-files:
    README.md
    CHANGELOG.md

source-repository head
  type: git
  location: https://github.com/poscat0x04/tdlib

custom-setup
  setup-depends:
      Cabal
    , base
    , chs-cabal

library
  exposed-modules:
      Tdlib.A
      Tdlib.Tdjson
  other-modules:
      Paths_tdlib
  hs-source-dirs:
      src
  default-extensions: OverloadedStrings FlexibleInstances FlexibleContexts FunctionalDependencies InstanceSigs ConstraintKinds DeriveGeneric DeriveFunctor DeriveFoldable DeriveTraversable TypeOperators TypeApplications TypeFamilies KindSignatures PartialTypeSignatures DataKinds StarIsType ScopedTypeVariables ExplicitForAll ViewPatterns BangPatterns LambdaCase TupleSections EmptyCase MultiWayIf UnicodeSyntax PatternSynonyms RecordWildCards
  extra-libraries:
      tdjson
  build-tools:
      c2hs
  build-depends:
      base >=4.10 && <5
  default-language: Haskell2010

test-suite tdlib-test
  type: exitcode-stdio-1.0
  main-is: Spec.hs
  other-modules:
      Paths_tdlib
  hs-source-dirs:
      test
  default-extensions: OverloadedStrings FlexibleInstances FlexibleContexts FunctionalDependencies InstanceSigs ConstraintKinds DeriveGeneric DeriveFunctor DeriveFoldable DeriveTraversable TypeOperators TypeApplications TypeFamilies KindSignatures PartialTypeSignatures DataKinds StarIsType ScopedTypeVariables ExplicitForAll ViewPatterns BangPatterns LambdaCase TupleSections EmptyCase MultiWayIf UnicodeSyntax PatternSynonyms RecordWildCards
  ghc-options: -threaded -rtsopts -with-rtsopts=-N
  extra-libraries:
      tdjson
  build-tools:
      c2hs
  build-depends:
      base >=4.10 && <5
    , tdlib
  default-language: Haskell2010

@georgefst
Copy link

georgefst commented Jun 8, 2020

I think the problem may be that build-tools is deprecated in favour of the more flexible build-tool-depends. I've got a working example here.

Edit: I would have thought that build-depends might still work given that your cabal-version is set so low... But anyway, if you set it to something more recent (e.g. 3.0), then cabal will warn you not to use build-depends.

Also, FWIW, you probably don't need to mention c2hs in your test suite, unless there are additional C bindings used exclusively by the test suite and not the library.

@georgefst
Copy link

Actually, this isn't really a cabal issue it all. c2hs isn't currently parseable with haddock. See haskell/c2hs#256.

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

No branches or pull requests

2 participants