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

Add `configure-options` option #1438

Closed
borsboom opened this issue Nov 27, 2015 · 15 comments

Comments

Projects
None yet
6 participants
@borsboom
Copy link
Contributor

commented Nov 27, 2015

I'm opening this issue discuss the possibility of adding a configure-options option, to add arguments passed to Setup.hs configure, as mentioned in #846 (among others).

I'm broadly in favour of the idea, with the following misgivings and design considerations.

Stack may not be using the Cabal library forever, in which case these options would no longer work. But moving away from Cabal is a ways off (if ever), and I think in that case we'd just bite the bullet and remove this option.

Some configure options must apply to all packages in a snapshot (e.g. --enable-library-profiling needs all packages to be built with that flag, and likely similar for --enable-split-objs), while others will work when only only to local packages or to targets. ghc-options can already suffer from similar problems and they're not handled very well right now, but it's more acute with configure-options. We'd need to be able to indicate which packages the configure-options apply to (e.g., all packages including snapshots, all local packages, or specific packages).

The alternative is that, when need for a new configure option is identified (e.g. in #1284 and #593), we add it to Stack explicitly. Since configure arguments will normally fall into two or three categories, it should be possible to modify the current design to make it quite easy to add these whenever the need comes up.

For either approach, Stack's current design doesn't handle the snapshots case very well, but extensible snapshots (#863, #1265) should fix that.

ping @mgsloan and @snoyberg

@fosskers

This comment has been minimized.

Copy link
Contributor

commented Jan 6, 2016

I'm in favour of something akin to:

configure-options:
  "*": --enable-split-objs

as mentioned by @mgsloan in #1341 .

I found these threads after attempting to invoke -split-objs somehow with stack, and found it wasn't straightforward. I'm okay with having to wipe my package dbs and recompile my dependencies to account for new configuration options.

@fosskers fosskers referenced this issue Jan 18, 2016

Open

[WIP] Conversion to `microlens` #78

6 of 6 tasks complete
@fosskers

This comment has been minimized.

Copy link
Contributor

commented Jan 21, 2016

Any thoughts on this @borsboom , @snoyberg , @mgsloan ?

@mgsloan

This comment has been minimized.

Copy link
Collaborator

commented Jan 22, 2016

@fosskers This'll be addressed along with the revamp of ghc-options, extra-deps, and implementation of custom snapshots. Other things have been taking priority over that, though, so it may be a while yet before that happens.

There's no strong reason to block implementation of this on those changes, though, so marking this "awaiting PR", feel free to implement.

@fosskers

This comment has been minimized.

Copy link
Contributor

commented Jan 22, 2016

Thank you. In the interim, is there some other hacky way to use --enable-split-objs?

@mgsloan

This comment has been minimized.

Copy link
Collaborator

commented Jan 23, 2016

Hmm, does --ghc-options -split-objs work?

@fosskers

This comment has been minimized.

Copy link
Contributor

commented Jan 24, 2016

If I already have an established ~/.stack with snapshots that weren't built with that option, then I'm seeing the same executable size before and after attemping that on a project of mine.

Testing

And the same after I completely wipe my ~/.stack and ./.stack_work. Binary size of final executable sitting at 8.2mb.

For reference, after wiping those directories and trying to build fresh, the command I use is: stack build --ghc-options="-split-objs"

So unless I'm doing something wrong, I have to say that this not working is probably a bug with stack.

@mgsloan

This comment has been minimized.

Copy link
Collaborator

commented Jan 24, 2016

The --ghc-options flag only affects local packges - http://docs.haskellstack.org/en/stable/yaml_configuration.html#ghc-options . Set apply-ghc-options: everything for them to apply to snapshot packages as well. Here's why this came into existence. This'll likely get cleaned up in the future, still some rough corners here.

@fosskers

This comment has been minimized.

Copy link
Contributor

commented Jan 26, 2016

After making a completely clean stack environment, and putting the following in my stack.yaml:

ghc-options:
  "*": -split-objs

apply-ghc-options: everything

...among the usual settings, then building my project with stack build (all deps are pulled and built fresh), I still see no reduction in executable size.

@mgsloan

This comment has been minimized.

Copy link
Collaborator

commented Jan 26, 2016

Hmm, I'm not sure then, sorry. Perhaps --enable-split-objs has more effects in cabal than passing that flag into GHC

@acfoltzer

This comment has been minimized.

Copy link
Contributor

commented Feb 1, 2016

I'd just like to add here that this would go a long way toward filling the gap left by MinGHC's death. When configuring a Windows system via Cygwin SSH, I had to go through the steps in #1714 to get a working cabal-install in the Stack snapshot.

@YPares

This comment has been minimized.

Copy link
Collaborator

commented Feb 12, 2016

Is it possible right now to pass a --with-gcc option to the configure process?
I'm not sure where this was left at.

@mgsloan

This comment has been minimized.

Copy link
Collaborator

commented Feb 13, 2016

As far as I know, --with-gcc is not currently supported, but it could potentially be considered under the umbrella of #652 . If a flag can be passed to cabal's configure step to make this happen, then this would be supported by #1438

@mgsloan

This comment has been minimized.

Copy link
Collaborator

commented Jun 6, 2016

Bumping to P1 due to popularity of this issue.

@sjakobi

This comment has been minimized.

Copy link
Contributor

commented Jul 12, 2016

Is it possible right now to pass a --with-gcc option to the configure process?

This is now possible with #2264.

@mgsloan mgsloan added the blocked label Aug 12, 2016

@mgsloan

This comment has been minimized.

Copy link
Collaborator

commented Aug 12, 2016

Marking this as blocked on the unification of flags and ghc-options - #849

@mgsloan mgsloan removed the blocked label Sep 22, 2017

@snoyberg snoyberg referenced this issue Apr 16, 2019

Merged

Add configure-options settings (fixes #1438) #4750

2 of 2 tasks complete

@snoyberg snoyberg closed this in e82067e Apr 18, 2019

snoyberg added a commit that referenced this issue Apr 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.