Comments (6)
Works here, cabal HEAD. Works with your .cabal
too.
f@x270:/tmp/prova$ cat prova.cabal
cabal-version: 3.0
name: prova
version: 0.1.0.0
license: NONE
author: Francesco Ariis
maintainer: [email protected]
build-type: Simple
extra-doc-files: CHANGELOG.md
flag wat
common warnings
ghc-options: -Wall
executable prova
import: warnings
if flag(wat)
main-is: bar-foo.hs
else
main-is: foo-bar.hs
build-depends: base ^>=4.18.1.0
hs-source-dirs: app
default-language: Haskell2010
f@x270:/tmp/prova$ tree app/
app/
├── bar-foo.hs
└── foo-bar.hs
1 directory, 2 files
f@x270:/tmp/prova$ cabal check
Warning: this is a debug build of cabal-install with assertions enabled.
These warnings will likely cause trouble when distributing the package:
Warning: [no-category] No 'category' field.
The following errors will cause portability problems on other environments:
Error: [no-syn-desc] No 'synopsis' or 'description' field.
Error: [license-none] The 'license' field is missing or is NONE.
Error: Hackage would reject this package.
f@x270:/tmp/prova$ cabal build
Warning: this is a debug build of cabal-install with assertions enabled.
Warning: The package list for 'hackage.haskell.org' is 33 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
Build profile: -w ghc-9.6.3 -O1
In order, the following will be built (use -v for more details):
- prova-0.1.0.0 (exe:prova) (first run)
Warning: this is a debug build of cabal-install with assertions enabled.
Configuring executable 'prova' for prova-0.1.0.0...
Warning: this is a debug build of cabal-install with assertions enabled.
Preprocessing executable 'prova' for prova-0.1.0.0...
Building executable 'prova' for prova-0.1.0.0...
[1 of 1] Compiling Main ( app/bar-foo.hs, /tmp/prova/dist-newstyle/build/x86_64-linux/ghc-9.6.3/prova-0.1.0.0/x/prova/build/prova/prova-tmp/Main.o )
[2 of 2] Linking /tmp/prova/dist-newstyle/build/x86_64-linux/ghc-9.6.3/prova-0.1.0.0/x/prova/build/prova/prova
f@x270:/tmp/prova$ cabal --version
cabal-install version 3.11.0.0
compiled using version 3.11.0.0 of the Cabal library
from cabal.
my reproducer for 3.10.2.0 : https://git.imn.htwk-leipzig.de/waldmann/cabal-9659/-/jobs/39798
from cabal.
Note, this does not appear to be a check error anymore:
Error: cabal: bar-foo.hsfoo-bar.hs doesn't exist
It looks like both sides of the conditional get evaluated and merged in the install command, not the check command. Maybe we're not evaluating conditionals right in that stanza?
from cabal.
Thanks for providing the reproducer.
Indeed I mistakenly thought the error was triggered by build
/check
, but it is not. It is cabal sdist
(and cabal install
) that fails:
/tmp/cabal-9659 (main)$ cabal --version
cabal-install version 3.11.0.0
compiled using version 3.11.0.0 of the Cabal library
/tmp/cabal-9659 (main)$ cabal sdist
Warning: this is a debug build of cabal-install with assertions enabled.
Ambiguous values for modulePath field: '"bar-foo.hs"' and '"foo-bar.hs"'
CallStack (from HasCallStack):
error, called at src/Distribution/Types/UnqualComponentName.hs:128:7 in Cabal-syntax-3.11.0.0-inplace:Distribution.Types.UnqualComponentName
/tmp/cabal-9659 (main)$ ~/download/cabal --version
cabal-install version 3.10.2.0
compiled using version 3.10.2.1 of the Cabal library
/tmp/cabal-9659 (main)$ ~/download/cabal sdist
Error: cabal: bar-foo.hsfoo-bar.hs doesn't exist
Offending code is a broken Semigroup instance:
cabal/Cabal-syntax/src/Distribution/Types/Executable.hs
Lines 40 to 49 in b99a830
which I suspect it is getting called via flattenPackageDescription
.
from cabal.
That sounds right. I was going to suggest we use finalizePD
instead of flattenPackageDescription
but in fact for sdist
at least we really do need both sides of the conditional, since we need to add both to the tarball. We just need to ensure that we accumulate as lists of module names, not strings.
from cabal.
#9724 provides a possible workaround using extra-source-file
.
from cabal.
Related Issues (20)
- Package fails to build with cabal-install 3.11 and GHC 8.0.2 where cabal-install 3.10.x worked HOT 7
- Cabal multi-repl doesn't consider ghc-options in cabal.project HOT 2
- Install project-local dev tools from Hackage HOT 2
- Community survey: Long-Term Support policy for cabal-install releases HOT 3
- Imported constraint edit not seen by cabal build HOT 1
- cabal init should create a .gitignore with dist-newstyle in it.
- Cabal (the library) advises use of `extensions:` when that field is deprecated HOT 2
- [3.12.0.0] Failed to find the installed unit HOT 1
- How to use static alpine job for testing HOT 6
- Ways logic only works by accident for cross compilers
- pkgsUseSharedLibrary logic is incorrect HOT 1
- cabal haddock-project suggests --haddock-all but then rejects it HOT 1
- Cabal-3.12.0.0 passes include dirs to GHC in a new order HOT 6
- build-tool-depends in Cabal regresses ghc ability to build from source distribution HOT 5
- Cabal external command requires typing Return to exit HOT 1
- Support monitoring directory recursive globs
- cabal init fails if git is not installed HOT 5
- Failure to find a program produces an incomprehensible error
- Encountered possible bug during building rpki-prover HOT 14
- Using Setup.hs build --with-ghc looses configure --ghc-option HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cabal.