-
Notifications
You must be signed in to change notification settings - Fork 20
Optimization flags should not be package specific #19
Comments
@xubaiw @Kha I am a bit confused as to the logic here. Why would you want to modify the the compilation of dependent packages (without its permission)? If a dependent package states that it is to be compiled with However, if a dependent package wants to make the optimization level of a package modifiable by end users, it could so with something like: package A (dir) (args) {
leancArgs := if args.isEmpty then #["-O3", "-DNDEBUG"] else args.toArray
...
}
package B {
dependencies := #{{name := `A, args := #["-O1"], ...}]
...
} |
So debug info of the dependencies is unnecessary? Maybe I have mistaken it, I see Besides, something like profile in |
Yes, offering a choice of build profiles independent from the specific package configuration is standard practice in any package manager for a compiled language. Whether dependencies should be built in debug mode as well (and whether debug or release should be the default) seems to be a contentious topic, but "make as much of the program debuggable as possible in debug mode" looks like a fine default to me. Bad enough that most languages only ship a precompiled, optimized stdlib... :) . |
@xubaiw @Kha I don't disagree that build profiles are good. But as you mentioned @Kha, enforcing them on dependencies is questionable. More important, this is the |
Yes, it's too early to talk about debugging in Lean. You can close this issue if Kha has no further questions. |
Debug symbols is not the primary reason cargo defaults to the debug profile, it's speed. Something like 75% of compilation time for Lean is spent inside LLVM, so this is just as true for us.
All parts of the pipeline will likely need to adhere to the build profile. If Lean ever outputs sensible DWARF metadata, LLVM optimizations should be disabled to make the most out of them. |
I think for now the most important part is to ensure that introducing build profiles is backward compatible. Users shouldn't need to change their package configuration for this, nor should they hard-code |
also add `more` prefix to `leanArgs`/`leancArgs`/`linkArgs` closes leanprover/lake#19
lake/Lake/Package.lean
Lines 179 to 184 in 111a47f
Lake is currently specifying default optimization flags to
-O3 -DNDEBUG
, which would cause a problem when there is package dependencies, since a package cannot override theleancArgs
of the package it depends on. Optimization level should be a global choice and users can simply change it using command line args.The text was updated successfully, but these errors were encountered: