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

Duplicate passing of gcc-options #10788

Open
jasagredo opened this issue Feb 9, 2025 · 1 comment
Open

Duplicate passing of gcc-options #10788

jasagredo opened this issue Feb 9, 2025 · 1 comment

Comments

@jasagredo
Copy link
Collaborator

Describe the bug

I like having these in my cabal config to suppress some warnings:

  gcc-options: -Wl,--allow-multiple-definition -Wno-pragma-pack -Wno-macro-redefined -Wno-missing-declarations

Building with verbose output shows that cabal duplicates these options when calling the C compiler:

$ cabal build -v3 | grep allow
...
["act-as-setup","--build-type=Simple",...,"--gcc-option=-Wl,--allow-multiple-definition","--gcc-option=-Wno-pragma-pack","--gcc-option=-Wno-macro-redefined","--gcc-option=-Wno-missing-declarations","--gcc-option=-Wl,--allow-multiple-definition","--gcc-option=-Wno-pragma-pack","--gcc-option=-Wno-macro-redefined","--gcc-option=-Wno-missing-declarations","--ghc-option=-hide-all-packages",...]
--gcc-option=-Wl,--allow-multiple-definition --gcc-option=-Wno-pragma-pack
--gcc-option=-Wl,--allow-multiple-definition --gcc-option=-Wno-pragma-pack
...
Running: "C:\ghcup\ghc\9.6.6\lib\../mingw/bin\clang.exe" ... "-Wl,--allow-multiple-definition" "-Wno-pragma-pack" "-Wno-macro-redefined" "-Wno-missing-declarations" "-Wl,--allow-multiple-definition" "-Wno-pragma-pack" "-Wno-macro-redefined" "-Wno-missing-declarations"

Cabal used: 3.14

@jasagredo
Copy link
Collaborator Author

I investigated this a bit more and found out that for the list of program-default-options we duplicate the previous existing list of args, so for example:

program-default-options
  alex-options: -foo -bar

will result in --alex-option=-foo --alex-option=-bar but

program-default-options
  alex-options: -foo -bar
  ar-options: -baz

will result in --alex-option=-foo --alex-option=-bar --alex-option=-foo --alex-option=-bar --ar-option=-baz

And so on. No matter if we don't use the program in question (I checked with greencard-options which I'm sure I don't use)

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

1 participant