Closed the-horo closed 10 months ago
✅ PR OK, no changes in deprecations or warnings
Total deprecations: 0
Total warnings: 0
Build statistics:
statistics (-before, +after)
-executable size=5228376 bin/dub
-rough build time=62s
+executable size=5232472 bin/dub
+rough build time=61s
Currently you can work around this by using dflags
on dependencies. It isn't pretty but it works.
GDC should really treat deprecations and warnings differently though.
Currently you can work around this by using
dflags
on dependencies. It isn't pretty but it works.
Can you explain me how this solution would go as I didn't know you could do that?
"dependencies": {
"vibe-d": { "version": "~>0.9", "dflags" : [ "-preview=in", "-revert=dtorfields" ] }
}
It will apply transitively, so eventcore
, vibe-core
, etc... will have those DFLAGS defined.
Not ideal but until we take the time to untangle how we want the build system to look like, this is the "best" way to do it.
"dependencies": { "vibe-d": { "version": "~>0.9", "dflags" : [ "-preview=in", "-revert=dtorfields" ] } }
It will apply transitively, so
eventcore
,vibe-core
, etc... will have those DFLAGS defined. Not ideal but until we take the time to untangle how we want the build system to look like, this is the "best" way to do it.
My issue is more of the flags being put in the wrong place and overwriten rather then not applying transitively:
$ DFLAGS='-Wno-error' dub -v build --compiler=gdc
...
Building dub 1.36.0-beta.1+commit.37.gf86ed3e9: building configuration [application]
gdc -Wno-error -o <cache>/dub -Werror -Wall -fversion=DubUseCurl -fversion=DubApplication ...
The same thing happens if I put dflags "-Wno-error"
in dub.sdl
.
There should be a way to have flags be passed later on the command line so that their values are respected, that's what I'm trying to fix.
Have you tried "buildRequirements": [ "allowWarnings" ]
?
@Geod24 I think there is a common use case which Dub doesn't support very well. While developers working on a given project may find that adding "buildRequirements": [ "allowWarnings" ]
to their dub.sdl/json may be the ideal approach, the same is not true for consumers of projects which ideally should not need to modify the source code of any of their dependencies. E.g. imagine a user of Linux distro that wants to rebuild their entire system for their exact CPU. Many of them would like the simplicity exporting CFLAGS=-march=native
and hitting "rebuild all".
Have you tried
"buildRequirements": [ "allowWarnings" ]
?
Yes, that fixes it, but my issue is not about having a way to disable it, it's having an easy-access way to do it. Editing the dub.*
file I don't consider enough. You can also consider the second issue of having user flags be respected more, which I think is always nice.
@Geod24 I think there is a common use case which Dub doesn't support very well. While developers working on a given project may find that adding
"buildRequirements": [ "allowWarnings" ]
to their dub.sdl/json may be the ideal approach, the same is not true for consumers of projects which ideally should not need to modify the source code of any of their dependencies. E.g. imagine a user of Linux distro that wants to rebuild their entire system for their exact CPU. Many of them would like the simplicity exportingCFLAGS=-march=native
and hitting "rebuild all".
I agree with this. Gentoo, for which I maintain D packages, does require disabling -Werror
: https://devmanual.gentoo.org/ebuild-writing/common-mistakes/index.html#-werror-compiler-flag-not-removed.
@the-horo : I can see the use case being useful, I myself had my share of similar issues. I'm starting to think the way we currently do DFLAGS does not make much sense, as it's its own build type. Anyway, looking at the code with a fresh pair of eyes, I think we should go ahead with it.
This change is mostly about being able to build programs without
-Werror
or-w
.dub
setting up so that warnings are errors by default can be nice for developers making their code more correct but it is useless for consumers. Currently, there is no way to disable that without modifying the project configuration to addallowWarnings
tobuildRequirements
. Users should, at least, be able to add-wi
toDFLAGS
and have the preference respected.This isn't so much a problem with
dmd
orldc
in my experience as they mostly report deprecations, the problem is withgdc
where every deprecation is a warning and the-Werror
makes builds fail where they otherwise should have succeeded with only some warnings.