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

[UX] ghc seems to parse flags in a way that the first one wins, not last one. #26

Open
angerman opened this issue Feb 26, 2025 · 1 comment

Comments

@angerman
Copy link

While trying to convince GHC to set -this-unit-id to I learned that passing -this-unit-id multiple times to GHC will result in GHC using the first occurrence in the passed arguments, rather than the last. Thus any ghc-options: set in the cabal file, or even in the cabal.project file, which will be passed later do not have any effect.

ghc -this-unit-id X -this-unit-id Y -this-unit-id Z

will result in GHC using X.

@angerman
Copy link
Author

$ ghc -shared -dynamic '-dynload deploy' -optl-Wl,-rpath,/home/andrea/.ghcup/ghc/9.8.4/lib/ghc-9.8.4/lib/x86_64-linux-ghc-9.8.4 -this-unit-id abc-iog -hide-all-packages -no-auto-link-packages -no-user-package-db -package-db dist/package.conf.inplace -package-id base-4.19.2.0-2a19 dist/build/MyLib.dyn_o -o dist/build/libHSabc-iog-ghc9.8.4.so -this-unit-id def-iog

yields

head dist/package.conf.inplace/abc-iog.conf
name:                 cabal-shit-1qy6j
version:              0.1.0.0
visibility:           public
id:                   abc-iog
key:                  abc-iog
maintainer:           [email protected]
author:               Andrea Bedini
abi:                  inplace
exposed:              True
exposed-modules:      MyLib

as @andreabedini verified.

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

1 participant