-
Notifications
You must be signed in to change notification settings - Fork 710
local options do not work with install on local packages (was: Run okay with profiling enabled, but installed exe has NO profiling enabled) #7297
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
Comments
Looks like a duplicate of #5982 |
In addition to the cmdl options being ignored (as with #5982), I also instrumented in the
|
BTW, Albert Y.C. Lai suggests in a Cafe list mail that such a workaround should work, but seemingly not for my case. https://mail.haskell.org/pipermail/haskell-cafe/2021-February/133453.html |
Do you have profiling disabled globally in |
@amigalemming I'm not sure, here is the content:
Did I? |
On Thu, 4 Mar 2021, Compl Yue wrote:
@amigalemming I'm not sure, here is the content:
$ cat .cabal/config | grep -e '^\s*--' -v
I would grep for 'profil', but it looks like you have not touched the
profiling settings.
|
I actually tripped over this too when working on purebred-mua/purebred#299. Also not explicitly profiling disabled. What I thought was interesting was that setting Even the build progress does not show that
I get:
Using the workaround linked from the mailing list, I get:
Perhaps it has something to do with multiple packages that even the command line arguments are not applied? My config that enabled profiling:
The one which does not enable does not have the |
That's a long shot, but it may be related to #7236, where static compilation works with |
I have an hypothesis for why this happens:
If that's true, a possible workaround could be to set the desired options per-package in cabal.project. I did not test this yet. |
I did a few tests and it looks like my hypothesis is correct. Workaroundfor every local package
The same applies for other flags. edit: oops, I just noticed that a similar workaround was posted above (though that will apply to all dependencies too) I'll edit the title to reflect this. |
I am starting to think that actual implementation of cabal install is giving us more problems than a raw build + copy bins would do. Another symptom: the popularization of the pattern Afaik the actual mechanism was implemented to make the code reuse the |
I'm not sure what the original intention was, but I think See #7471 (comment) and other comments. |
More or less. I originally wrote |
Kudos to @fgaz for the excellent sleuthing here. I think this is really a bad interaction of how install treats cli flags -- it should probably translate them to package local flags for the package being installed, rather than top level project flags. |
I think users expect flags to do the same for Actually, perhaps users even expect |
Note that
cannot be completely true, unit-ids (of local libraries) are different, The goal is good, but there are subtle differences, which won't go away (especially the unit-id). Maybe that false expectation should rather be explained in the manual. |
By the way this is also super counterintuive wrt explicitly named remote targets. For example |
to let it clear, the welcomed pr would follow @gbaz proposal?:
Either for installing within a local project or from hackage/tarball? |
hmm not sure what is the meaning of consulted here, it is not being applied (or it would be a workaround for the issue) but it is available in the config for the build prior to the install (like the So we could use it like we want to do with the cli flags (which also are available and are not applied); the question is if doing it would be sensible. It would make a little bit simpler the fix cause it will not have to discern between installing local packages from remote ones. |
If users dont want to apply them they always could do a EDIT: Add the previous comment as a quote to make clear it refers to a feature (install --ignore-project` to be added and dont work inthe current version of cabal-install |
I'm honestly not sure of the right behavior here and could be swayed either way. Would your proposal amount to effectively treating the sdist'd tarball being installed as a local package? |
Slightly related: we really should split |
Well, to be fair i personally would expect cabal.project top level build config be applicable only installing local packages executables and no remote ones, even if they are included in dependencies. It is clear to me than top project config only is applicable to local packages and i think it is described in docs. But i am not totally convinced so asked to know other's opinion. So to resuming in a table:
All would be a little bit clearer (and less convenient) if top level project config did not exist and you had to do |
yeah so adding the package(s) as a local package(s) in the project config could do the fix for all target types I foresee that would be simpler than distinguish cli flags (they are not marked as such in the actual project config afaics) from project config top level ones and apply them to remote packages. In that case we still could add local packages targets as such in the project config |
This issue is about |
Currently, there are three kinds of cabal configurations considered when determining an option of an `ElaboratedConfiguredPackage`: * Global configuration, in `.cabal/config` * Local configuration, in - Options passed in the cabal invocation, e.g. `cabal build --enable-executable-dynamic` - Fields in the top level `cabal.project`, or `cabal.project.local`, e.g. `extra-include-dirs: /opt/homebrew/include` Note thus that top-level cabal.project flags and cli flags are treated all together at the same level (`local`). * Per package configuration, as in package HsOpenSSL extra-include-dirs: /opt/homebrew/Cellar/openssl@3/3.2.0_1/include extra-lib-dirs: /opt/homebrew/Cellar/openssl@3/3.2.0_1/lib Then, we have a definition for whether a package is local to the project. The local packages are the packages listed in the project which have a specific source package, rather than just being listed by name in a `source-repository-stanza`, or in a `package <package-name>` stanza that configures installed packages. In this patch, we try fix the mistmatch between the `local` flags and the packages which are deemed `local`, and define a specification for what exactly should happen..... TODO Fixes haskell#7297, haskell#8909, haskell#2997
Currently, there are three kinds of cabal configurations considered when determining an option of an `ElaboratedConfiguredPackage`: * Global configuration, in `.cabal/config` * Local configuration, in - Options passed in the cabal invocation, e.g. `cabal build --enable-executable-dynamic` - Fields in the top level `cabal.project`, or `cabal.project.local`, e.g. `extra-include-dirs: /opt/homebrew/include` Note thus that top-level cabal.project flags and cli flags are treated all together at the same level (`local`). * Per package configuration, as in package HsOpenSSL extra-include-dirs: /opt/homebrew/Cellar/openssl@3/3.2.0_1/include extra-lib-dirs: /opt/homebrew/Cellar/openssl@3/3.2.0_1/lib Then, we have a definition for whether a package is local to the project. The local packages are the packages listed in the project which have a specific source package, rather than just being listed by name in a `source-repository-stanza`, or in a `package <package-name>` stanza that configures installed packages. The reason why local packages being installed are treated as non-local is that TODO In this patch, we try fix the mistmatch between the `local` flags and the packages which are deemed `local`, and define a specification for what exactly should happen..... TODO Fixes haskell#7297, haskell#8909, haskell#2997
I've observed some quite interesting behaviour regarding this and related issues (#7236, #8909), which report that flags passed to install are ignored and not applied to the executable being built. Namely, note the following
I'm investigating... |
The target of `cabal install` is not considered to be a local package, which means local configuration (e.g. in cabal.project, or flags like --enable-profiling) does not apply to it. In 76670eb, we changed the behaviour to applying the local flags to cabal install targets, but it used the literal target string as a package name to which the flags were additionally applied. However, `cabal install` targets are NOT necessarily package names, so, e.g., if we did `cabal install exe:mycomp`, the local flags would not apply since "exe:mycomp" is not a recognized /package/. The solution is to parse the target selectors first, and apply the local flags to the package of the resolved targets. Fixes haskell#7297 haskell#8909 and the install part of haskell#7236
Fix in #9697. |
To add a bit to the discussion: So
would apply What I've done is properly account for |
The target of `cabal install` is not considered to be a local package, which means local configuration (e.g. in cabal.project, or flags like --enable-profiling) does not apply to it. In 76670eb, we changed the behaviour to applying the local flags to cabal install targets, but it used the literal target string as a package name to which the flags were additionally applied. However, `cabal install` targets are NOT necessarily package names, so, e.g., if we did `cabal install exe:mycomp`, the local flags would not apply since "exe:mycomp" is not a recognized /package/. The solution is to parse the target selectors first, and apply the local flags to the package of the resolved targets. Fixes haskell#7297 haskell#8909 and the install part of haskell#7236
The target of `cabal install` is not considered to be a local package, which means local configuration (e.g. in cabal.project, or flags like --enable-profiling) does not apply to it. In 76670eb, we changed the behaviour to applying the local flags to cabal install targets, but it used the literal target string as a package name to which the flags were additionally applied. However, `cabal install` targets are NOT necessarily package names, so, e.g., if we did `cabal install exe:mycomp`, the local flags would not apply since "exe:mycomp" is not a recognized /package/. The solution is to parse the target selectors first, and apply the local flags to the package of the resolved targets. Fixes haskell#7297, haskell#8909, the install part of haskell#7236, haskell#8529, haskell#7832
The target of `cabal install` is not considered to be a local package, which means local configuration (e.g. in cabal.project, or flags like --enable-profiling) does not apply to it. In 76670eb, we changed the behaviour to applying the local flags to cabal install targets, but it used the literal target string as a package name to which the flags were additionally applied. However, `cabal install` targets are NOT necessarily package names, so, e.g., if we did `cabal install exe:mycomp`, the local flags would not apply since "exe:mycomp" is not a recognized /package/. The solution is to parse the target selectors first, and apply the local flags to the package of the resolved targets. Fixes haskell#7297, haskell#8909, the install part of haskell#7236, haskell#8529, haskell#7832
The target of `cabal install` is not considered to be a local package, which means local configuration (e.g. in cabal.project, or flags like --enable-profiling) does not apply to it. In 76670eb, we changed the behaviour to applying the local flags to cabal install targets, but it used the literal target string as a package name to which the flags were additionally applied. However, `cabal install` targets are NOT necessarily package names, so, e.g., if we did `cabal install exe:mycomp`, the local flags would not apply since "exe:mycomp" is not a recognized /package/. The solution is to parse the target selectors first, and apply the local flags to the package of the resolved targets. Fixes haskell#7297, haskell#8909, the install part of haskell#7236, haskell#8529, haskell#7832
The target of `cabal install` is not considered to be a local package, which means local configuration (e.g. in cabal.project, or flags like --enable-profiling) does not apply to it. In 76670eb, we changed the behaviour to applying the local flags to cabal install targets, but it used the literal target string as a package name to which the flags were additionally applied. However, `cabal install` targets are NOT necessarily package names, so, e.g., if we did `cabal install exe:mycomp`, the local flags would not apply since "exe:mycomp" is not a recognized /package/. The solution is to parse the target selectors first, and apply the local flags to the package of the resolved targets. Fixes haskell#7297, haskell#8909, the install part of haskell#7236, haskell#8529, haskell#7832
The target of `cabal install` is not considered to be a local package, which means local configuration (e.g. in cabal.project, or flags like --enable-profiling) does not apply to it. In 76670eb, we changed the behaviour to applying the local flags to cabal install targets, but it used the literal target string as a package name to which the flags were additionally applied. However, `cabal install` targets are NOT necessarily package names, so, e.g., if we did `cabal install exe:mycomp`, the local flags would not apply since "exe:mycomp" is not a recognized /package/. The solution is to parse the target selectors first, and apply the local flags to the package of the resolved targets. Fixes haskell#7297, haskell#8909, the install part of haskell#7236, haskell#8529, haskell#7832
The target of `cabal install` is not considered to be a local package, which means local configuration (e.g. in cabal.project, or flags like --enable-profiling) does not apply to it. In 76670eb, we changed the behaviour to applying the local flags to cabal install targets, but it used the literal target string as a package name to which the flags were additionally applied. However, `cabal install` targets are NOT necessarily package names, so, e.g., if we did `cabal install exe:mycomp`, the local flags would not apply since "exe:mycomp" is not a recognized /package/. The solution is to parse the target selectors first, and apply the local flags to the package of the resolved targets. Fixes haskell#7297, haskell#8909, the install part of haskell#7236, haskell#8529, haskell#7832
The target of `cabal install` is not considered to be a local package, which means local configuration (e.g. in cabal.project, or flags like --enable-profiling) does not apply to it. In 76670eb, we changed the behaviour to applying the local flags to cabal install targets, but it used the literal target string as a package name to which the flags were additionally applied. However, `cabal install` targets are NOT necessarily package names, so, e.g., if we did `cabal install exe:mycomp`, the local flags would not apply since "exe:mycomp" is not a recognized /package/. The solution is to parse the target selectors first, and apply the local flags to the package of the resolved targets. Fixes haskell#7297, haskell#8909, the install part of haskell#7236, haskell#8529, haskell#7832
Describe the bug
Can't install profiling-enabled exe with cabal 3.2.0.0, while direct running works correctly.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The built executable can have
+RTS -p
enabledSystem information
macOS Mojave
cabal
,ghc
versionsAdditional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: