[Hackage] #844: Cabal reports "cabal: internal error: the package contains a library but there is no corresponding configuration data" when there exists no library in the cabal file

#844: Cabal reports "cabal: internal error: the package contains a library but there is no corresponding configuration data" when there exists no library in the cabal file ----------------------------+----------------------------------------------- Reporter: fushunpoon | Owner: Type: defect | Status: new Priority: normal | Milestone: Component: Cabal library | Version: 1.8.0.6 Severity: normal | Keywords: library configuration data Difficulty: normal | Ghcversion: Platform: Mac OS | ----------------------------+----------------------------------------------- When trying to build my test project to play with SDL, I encountered the following message: "cabal: internal error: the package contains a library but there is no corresponding configuration data" on the following cabal file: even though my project cabal file specifies no libraries. Surely either this is an erroneous message or there is something wrong with the logic in cabal. Note that 'configure' and 'sdlexprs.buildinfo.in' exist as files, and they are attached with this post. ------------------------------------------------------ Name: sdlexprs Version: 0.1 Synopsis: Just some hacks using SDL! License: LGPL License-file: LICENSE Author: <<my-name>> Category: Graphics Build-type: Configure Extra-source-files: configure,sdlexprs.buildinfo.in Cabal-version: >=1.2 Executable test -- Specify the source directory here Hs-source-dirs: src -- .hs or .lhs file containing the Main module. Main-is: SDLWrapper.hs -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/844 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#844: Cabal reports "cabal: internal error: the package contains a library but there is no corresponding configuration data" when there exists no library in the cabal file ----------------------------+----------------------------------------------- Reporter: fushunpoon | Owner: Type: defect | Status: new Priority: normal | Milestone: Component: Cabal library | Version: 1.8.0.6 Severity: normal | Keywords: Difficulty: normal | Ghcversion: Platform: Mac OS | ----------------------------+----------------------------------------------- Changes (by duncan): * keywords: library configuration data => Old description:
When trying to build my test project to play with SDL, I encountered the following message:
"cabal: internal error: the package contains a library but there is no corresponding configuration data" on the following cabal file:
even though my project cabal file specifies no libraries. Surely either this is an erroneous message or there is something wrong with the logic in cabal. Note that 'configure' and 'sdlexprs.buildinfo.in' exist as files, and they are attached with this post.
------------------------------------------------------ Name: sdlexprs Version: 0.1 Synopsis: Just some hacks using SDL! License: LGPL License-file: LICENSE Author: <<my-name>> Category: Graphics Build-type: Configure Extra-source-files: configure,sdlexprs.buildinfo.in
Cabal-version: >=1.2
Executable test -- Specify the source directory here Hs-source-dirs: src
-- .hs or .lhs file containing the Main module. Main-is: SDLWrapper.hs
New description: When trying to build my test project to play with SDL, I encountered the following message: "cabal: internal error: the package contains a library but there is no corresponding configuration data" on the following cabal file: even though my project cabal file specifies no libraries. Surely either this is an erroneous message or there is something wrong with the logic in cabal. Note that 'configure' and 'sdlexprs.buildinfo.in' exist as files, and they are attached with this post. {{{ Name: sdlexprs Version: 0.1 Synopsis: Just some hacks using SDL! License: LGPL License-file: LICENSE Author: <<my-name>> Category: Graphics Build-type: Configure Extra-source-files: configure,sdlexprs.buildinfo.in Cabal-version: >=1.2 Executable test -- Specify the source directory here Hs-source-dirs: src -- .hs or .lhs file containing the Main module. Main-is: SDLWrapper.hs }}} -- -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/844#comment:1 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#844: Cabal reports "cabal: internal error: the package contains a library but there is no corresponding configuration data" when there exists no library in the cabal file ------------------------------+--------------------------------------------- Reporter: fushunpoon | Owner: Type: defect | Status: new Priority: low | Milestone: Component: Cabal library | Version: 1.8.0.6 Severity: minor | Keywords: Difficulty: easy (<4 hours) | Ghcversion: Platform: Mac OS | ------------------------------+--------------------------------------------- Changes (by fushunpoon): * priority: normal => low * difficulty: normal => easy (<4 hours) * severity: normal => minor Comment: I have found out precisely the reason why this error is displayed: The `sdlexprs.buildinfo.in` file that I wrote did not declare the `cc- options` line under the specific executable `test`. This means that by default it was treated as build information for a library as opposed to an executable when the `sdlexprs.buildinfo` file is consulted when doing a `cabal build`. This problem deserves a better error message earlier on, perhaps as a warning, that even though no `Library` sections exist in the cabal file, the consulted `*.buildinfo` file does. This surely is an inconsistency on part of the user. To say that the project "contains a library" is misleading and is confusing, especially when the `.cabal` file is supposed to be the definitive package description file. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/844#comment:2 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#844: Cabal reports "cabal: internal error: the package contains a library but
there is no corresponding configuration data" when there exists no library
in the cabal file
----------------------------+-----------------------------------------------
Reporter: fushunpoon | Owner:
Type: defect | Status: closed
Priority: low | Milestone:
Component: Cabal library | Version: 1.8.0.6
Severity: minor | Resolution: fixed
Keywords: | Difficulty: easy (<4 hours)
Ghcversion: | Platform: Mac OS
----------------------------+-----------------------------------------------
Changes (by duncan):
* status: new => closed
* resolution: => fixed
Comment:
Yes, your analysis is correct (I just discovered the same thing).
So the bug in cabal is that it merges the buildinfo with the
packagedescription incorrectly and that it does not do any sanity check of
that buildinfo.
As you discovered, the solution for you is to generate buildinfo for the
executable rather than the library. The structure of the buildinfo file is
documented in the user guide:
http://haskell.org/cabal/users-guide/authors.html#system-dependent
Bug fixed with this patch:
{{{
Wed May 18 13:33:31 BST 2011 Duncan Coutts
participants (1)
-
Hackage