April 26, 2022

On Tuesday, 26 April 2022 at 01:56:42 UTC, norm wrote:

>

Conan works with either packaged binaries or packaged sources. I think the comparison is valid. I also disagree that dub is easier. Sure it is much simpler to get started for trivial projects but with any non-trivial project you end up hitting its walled garden pretty hard.

My (limited) understanding of Conan is that Conan-central compiles packages to binaries for various configurations (over 100 configurations for C++), but that it also allows for packaging of precompiled binaries. Isn't this a security hazard?

Is it possible to configure Conan so that it only compiles from sources and never downloads binaries?

April 26, 2022

On Tuesday, 26 April 2022 at 01:21:58 UTC, Mike Parker wrote:

>

Without dub, we would not have the ecosystem that we do have.

I think so too.

>

Personally, I love it. It makes using dependencies a snap. I'm happy with the default source tree expectations, and I don't mind compiling C libraries separately when I need them.

Had to put off my cmake/ninja glasses first to get rid of some prejudice, cmake btw is not heaven either, but does the job and has and is still improving. Dub has already improved a lot over time I do not experience any big issues with it since quite some time though my use cases are quite straight fwd.

>

So I propose someone, anyone, who has an interest in seeing dub evolve raise their hand and take on the task of gathering requirements. Not dive in and start refactoring code, not sit down and write a new build tool, but to gather the gripes and complaints from bitch sessions here and on Discord and distill them into lists of needs, wants, and nice-to-haves. (I'd do it myself, but I just don't have the time.)

Then that list can be a starting point for a plan to move forward. I'm sure I can put together a team of interested parties willing to donate a little of their time to provide input on formulating that plan. Then we can look at how to actually get the work done, e.g., putting out a task list that contributors can spend time on, picking out more complicated tasks for contract work funded from our ecosystem fund, etc.

So please, someone take all this energy directed at telling us all how terrible dub is and take the first step toward redirecting at turning dub into something more of us are willing to use.

This is helpful. Thanks for doing this Mike.

April 26, 2022

On Tuesday, 26 April 2022 at 01:21:58 UTC, Mike Parker wrote:

>

On Monday, 25 April 2022 at 20:12:19 UTC, deadalnix wrote:

>

The least power for the job definitively implies not inserting a build system in the package manager.
The question is, what exactly is dub missing and how can it be improved? Which perceived shortcomings are reasonable to address and which are not? And assuming we can answer those questions, who is going to address them?

Excellent question. My answer would be that it doesn't miss anything, to the contrary. If it was limiting itself to fetching dependencies and allow to publish new version of these, then it would be perfect.

But in addition of doing that, it is telling me how to build, how to do releases and so on. That was not a void i needed filling, I had tools to do this just fine. Now dub is getting into the way by interfering with say tools.

>

So please, someone take all this energy directed at telling us all how terrible dub is and take the first step toward redirecting at turning dub into something more of us are willing to use.

I do not want to improve dub, I do not want to even use it. I'm more or less dragged along because this is what people expect in the ecosystem. It causes way more problems for me that it solves. If that was up to me, I wouldn't fix it, I would just stop using it.

April 26, 2022

On Saturday, 23 April 2022 at 20:15:27 UTC, deadalnix wrote:

>

Ho, you wanted to distribute a package? Well, now you have a new build system. make was working great for you? Too bad. Can dub run make? It doesn't look like it but who knows. I don't.

Does your makefile support other platforms than Linux? How about Windows? Makefiles aren't even native for Windows. I remember before dub came about I had to recreate the Unix-like ecosystem in MSYS/Cygwin just to have a chance to compile a D library. These days I do dub build and most projects compile with no issue on Windows.

Yes, it is limiting, and that is it's strength. With boundaries comes reliability and consistency. If I want to reuse a piece of code I want to dub add it to a project and start using it, not chase down dependencies and try to make its code structure fit into mine.

And the general practice seems to show it's the right approach. Cargo is a massive success in Rust and C++ is constantly trying to get their package manager story right.

April 26, 2022

On Tuesday, 26 April 2022 at 11:00:26 UTC, JN wrote:

>

Yes, it is limiting, and that is it's strength. With boundaries comes reliability and consistency.

Don't fart on me and tell me it's Channel.

Here the simple truth. Either the build is
1/ simple in which case dmd -i is enough and dub superfluous.
2/ complex in which case dub's "strength" is that it is too limiting to do it.

You are getting real D users, people who have been using it for many many years, telling you dub is creating more problem for them that it solves.

And for the windows build, I'm glad you brought that up. As pointed out, I have several application in that repo. Some of them build on windows, other don't. Ever since I added dub, the ones that used to build on windows still build on windows, and the one that don't don't build with dub.

A grand total of zero progress has been made thanks to dub's amazing "strength" on this front. Zero, niltch, nada, niente.

April 26, 2022

On Tuesday, 26 April 2022 at 10:48:49 UTC, deadalnix wrote:

>

I do not want to improve dub, I do not want to even use it. I'm more or less dragged along because this is what people expect in the ecosystem. It causes way more problems for me that it solves. If that was up to me, I wouldn't fix it, I would just stop using it.

Then don't use it, use instead your custom build system. If your project is open source someone else will port it on dub/Conan/Cmake/AUR/Microsoft Store/some other exotic repository. You don't need to use a tool you don't like.

If peoplewant something from you that you don't want then it's up to them to fit their needs if your project is free software.

April 26, 2022

On Tuesday, 26 April 2022 at 11:00:26 UTC, JN wrote:

>

On Saturday, 23 April 2022 at 20:15:27 UTC, deadalnix wrote:

>

Ho, you wanted to distribute a package? Well, now you have a new build system. make was working great for you? Too bad. Can dub run make? It doesn't look like it but who knows. I don't.

Does your makefile support other platforms than Linux? How about Windows? Makefiles aren't even native for Windows.

Is this still an issue? Doesn't winget fix this?

April 26, 2022
On Tue, Apr 26, 2022 at 01:21:58AM +0000, Mike Parker via Digitalmars-d wrote: [...]
> dub exists because it filled a huge, gaping hole in the D ecosystem.
> 
> Go back far enough and you'll find "build", later renamed "bud", by Derek Parnell. This was the first D build tool the community rallied around.
[...]
> Gregor Richards wasn't happy with bud, so he created "Rebuild" as an alternative build tool, but added a package manager on top of it called "DSSS" (D Shared Software System).
[...]
> At one point I had three platform-specific make files, a `dsss.conf`, and a `forbud.txt` (I eventually replaced some of that with a `buildme.d file`).
> 
> There was no standard way of building D projects, and it sucked. Then Derek and Gregor disappeared, and suddenly these build systems everyone is using are no longer supported. No one takes them over, so we're in the Dark Ages again. Then dub comes along and saves the day.
> 
> It caught on quickly. Then people start thinking: "What happens if Sönke disappears? This should be an official D thing." So dub gets added to the installation. And here we are.

Thanks for the summary, that was very insightful.


[...]
> The question is, what exactly is dub missing and how can it be improved?  Which perceived shortcomings are reasonable to address and which are not?  And assuming we can answer those questions, who is going to address them?

The primary functionality missing from dub that I rely on is explicit build dependency graph specification. (Note: I'm not talking about *package* dependencies, which dub actually does an OK job at, but *build* dependencies.)

What I mean is this: my projects often involve a main executable, which is the primary target of the project, plus several helpers, which are either secondary targets sharing most of the same sources, or code generators that create one or more targets required to compile the main executable.  Occasionally, there may also be auxiliary targets like HTML pages, procedurally-generated images, and other resources.

Currently, for building all these targets, I use SCons (yes, yes, I know). It's not perfect, but it does what I want: it has no problem handling complex build jobs like building a subset of source files into helper utility U1, running U1 in order to generate some extra D source files, then compiling the results into an executable.  It can also, *at the same time*, compile a different subset of source files into helper utility U2, run U2 on a set of HTML templates and generating HTML files, then running a PHP postprocessing script on said HTML files, then install these files into a staging directory hierarchy, and then creating a tarball to be uploaded to the target webserver.

As far as I know -- and if I'm wrong I'd be happy to be corrected -- dub is unable to handle the above (at least not natively -- I'd have to write my own code for building the non-D parts of the build AFAIK, which defeats the purpose of having a build system in the first place).

This is my primary complaint about dub.

There are also secondary issues, like:

- Network dependence (I'd *really* like for it *not* to depend on
  internet access being available by default, only when I ask it to).
  IIRC there's some switch or option that does this, it would be nice if
  there was a local setting I could toggle to make this automatic.

- Performance: is there an option to skip the expensive NP-complete
  dependency resolution step at the beginning for faster turnaround
  time? When I'm debugging something I do *not* want dub to do anything
  except recompile local source, no network access, no package
  dependency resolution, nothing, just *build* the darned thing and
  leave it at that.

- Reproducibility: if I change one source file out of a directory of 50,
  I want the build system to be able to detect that one change,
  determine the *minimum* sequence of actions to update current targets,
  and run only those actions. After running these actions, the targets
  should be in EXACTLY the same state as if I had rebuilt the entire
  workspace from a clean checkout. And this should NOT be dependent on
  the current state of the workspace (it should know to overwrite stale
  intermediates, etc., so that the final targets are in the correct
  state).

- Selective builds: sometimes during development I only want to rebuild
  one target out of possibly 5 or 10. There has to be an easy way only
  build a subset of targets (and it should perform the *minimum* actions
  needed to achieve this, in a completely reproducible way, as described
  above).

- Parallel building: if the actions required to build targets T1 and T2
  are not dependent on each other, it should know to run them in
  parallel so that the build is completed as quickly as possible. This
  should be baked-in behaviour that does not require any additional
  effort from the user.


If dub can be made to do all of the above, I'd be happy to adopt it for my projects.


T

-- 
I'm still trying to find a pun for "punishment"...
April 27, 2022
On 27/04/2022 3:35 AM, H. S. Teoh wrote:
>> The question is, what exactly is dub missing and how can it be
>> improved?  Which perceived shortcomings are reasonable to address and
>> which are not?  And assuming we can answer those questions, who is
>> going to address them?
> 
> The primary functionality missing from dub that I rely on is explicit
> build dependency graph specification. (Note: I'm not talking about
> *package* dependencies, which dub actually does an OK job at, but
> *build* dependencies.)
> 
> What I mean is this: my projects often involve a main executable, which
> is the primary target of the project, plus several helpers, which are
> either secondary targets sharing most of the same sources, or code
> generators that create one or more targets required to compile the main
> executable.  Occasionally, there may also be auxiliary targets like HTML
> pages, procedurally-generated images, and other resources.
> 
> Currently, for building all these targets, I use SCons (yes, yes, I
> know). It's not perfect, but it does what I want: it has no problem
> handling complex build jobs like building a subset of source files into
> helper utility U1, running U1 in order to generate some extra D source
> files, then compiling the results into an executable.  It can also, *at
> the same time*, compile a different subset of source files into helper
> utility U2, run U2 on a set of HTML templates and generating HTML files,
> then running a PHP postprocessing script on said HTML files, then
> install these files into a staging directory hierarchy, and then
> creating a tarball to be uploaded to the target webserver.
> 
> As far as I know -- and if I'm wrong I'd be happy to be corrected -- dub
> is unable to handle the above (at least not natively -- I'd have to
> write my own code for building the non-D parts of the build AFAIK, which
> defeats the purpose of having a build system in the first place).

Pre build commands.

For D stuff in dub something like this works fine.

"preBuildCommands": ["dub run package:tool -- args"]

But what you are describing is something automatic, which is not currently supported.

> This is my primary complaint about dub.
> 
> There are also secondary issues, like:
> 
> - Network dependence (I'd *really* like for it *not* to depend on
>    internet access being available by default, only when I ask it to).
>    IIRC there's some switch or option that does this, it would be nice if
>    there was a local setting I could toggle to make this automatic.

https://dub.pm/settings

So yeah settings file already supports this.

> - Performance: is there an option to skip the expensive NP-complete
>    dependency resolution step at the beginning for faster turnaround
>    time? When I'm debugging something I do *not* want dub to do anything
>    except recompile local source, no network access, no package
>    dependency resolution, nothing, just *build* the darned thing and
>    leave it at that.

I've had a look at this, it would take a good bit of refactoring to split this out into dub.selections.json *I think*.

But yeah you're right, if nothing has changed it should be cached.

> - Reproducibility: if I change one source file out of a directory of 50,
>    I want the build system to be able to detect that one change,
>    determine the *minimum* sequence of actions to update current targets,
>    and run only those actions. After running these actions, the targets
>    should be in EXACTLY the same state as if I had rebuilt the entire
>    workspace from a clean checkout. And this should NOT be dependent on
>    the current state of the workspace (it should know to overwrite stale
>    intermediates, etc., so that the final targets are in the correct
>    state).

I was questioning if the problem here is the compiler stuff, but its not.

However, I don't think that this should be the default. Processing all of those dates, caching them... yeah won't be cheap either.
April 26, 2022
On Wed, Apr 27, 2022 at 03:57:24AM +1200, rikki cattermole via Digitalmars-d wrote:
> On 27/04/2022 3:35 AM, H. S. Teoh wrote:
[...]
> > What I mean is this: my projects often involve a main executable, which is the primary target of the project, plus several helpers, which are either secondary targets sharing most of the same sources, or code generators that create one or more targets required to compile the main executable.  Occasionally, there may also be auxiliary targets like HTML pages, procedurally-generated images, and other resources.
[...]
> > As far as I know -- and if I'm wrong I'd be happy to be corrected -- dub is unable to handle the above (at least not natively -- I'd have to write my own code for building the non-D parts of the build AFAIK, which defeats the purpose of having a build system in the first place).
> 
> Pre build commands.
> 
> For D stuff in dub something like this works fine.
> 
> "preBuildCommands": ["dub run package:tool -- args"]

Does this mean I have to create an entire subpackage just for this purpose?  Or in fact, one subpackage per auxiliary target?  If so, that would seem needlessly cumbersome for something that, in my mind, is a trivial additional node in the build graph.

Also, treating these auxiliary build targets as second-class citizens doesn't really sit right with me. I mean, after all, it all boils down to "build sources S1, S2, ... into targets T1, T2, ... by running command(s) C1, C2, ...".  What if I decide to insert a postprocessing step in the middle of one of these build chains?  E.g., after creating a HTML file, before installing it to the staging area, I decide that I want to run a HTML tidying utility on it?  Does that mean I have to create another subpackage to represent this extra step?


> But what you are describing is something automatic, which is not currently supported.

What do you mean by "automatic"?  These targets are generally not automatically inferrable, i.e., I'm not expecting that if I say "build xyz.html" dub would magically know that in order to build HTML files it needs to compile a.d, b.d, c.d into abc.exe and run abc.exe on xyz.template in order to produce xyz.html.  Obviously these build steps must be explicitly stated somewhere.

But I do expect that build products generated by these steps would be smoothly integrated into the build, i.e., if "code.template" is preprocessed by some tool "helper.exe" to produce "code.d", then there should be a way to compile "code.d" into the main executable as well.


[...]
> > - Network dependence (I'd *really* like for it *not* to depend on
> >   internet access being available by default, only when I ask it
> >   to).  IIRC there's some switch or option that does this, it would
> >   be nice if there was a local setting I could toggle to make this
> >   automatic.
> 
> https://dub.pm/settings
> 
> So yeah settings file already supports this.

Which setting disables network lookup by default?  Glancing at that page, it's not obvious which setting it is and what value I should set it to.


> > - Performance: is there an option to skip the expensive NP-complete
> >   dependency resolution step at the beginning for faster turnaround
> >   time? When I'm debugging something I do *not* want dub to do
> >   anything except recompile local source, no network access, no
> >   package dependency resolution, nothing, just *build* the darned
> >   thing and leave it at that.
> 
> I've had a look at this, it would take a good bit of refactoring to split this out into dub.selections.json *I think*.
> 
> But yeah you're right, if nothing has changed it should be cached.

Not just that, when I'm recompiling a project during debugging, I don't want dub to look at the network *at all*.  I don't care if upstream has released a critical zero-day exploit fix, I do NOT want the code to suddenly change from under me when I'm trying to trace down a segfault. I want it to just build the sources that are currently on the local machine, and that's it.

Also, sometimes if I'm on the road without internet access, I do not want to suddenly become unable to build my project.


> > - Reproducibility: if I change one source file out of a directory of
> >   50, I want the build system to be able to detect that one change,
> >   determine the *minimum* sequence of actions to update current
> >   targets, and run only those actions. After running these actions,
> >   the targets should be in EXACTLY the same state as if I had
> >   rebuilt the entire workspace from a clean checkout. And this
> >   should NOT be dependent on the current state of the workspace (it
> >   should know to overwrite stale intermediates, etc., so that the
> >   final targets are in the correct state).
> 
> I was questioning if the problem here is the compiler stuff, but its not.
> 
> However, I don't think that this should be the default. Processing all of those dates, caching them... yeah won't be cheap either.

Two comments here:

1) Dates should NOT be used as the basis for detecting changes, because
   it's not reliable. Preferably some kind of checksum should be used (a
   cheap one like md5 or CRC would do -- we don't need strong crypto
   strength here). Why?  Because sometimes, an updated timestamp does
   *not* mean the file actually changed.

   For example, if I `git checkout` a branch to look at something and
   switch back later, the file may have been touched during the switch,
   but afterwards its contents are identical to when it was last built.
   In this case, targets that depend on that file do not need to be
   rebuilt; it can be skipped entirely. This can sometimes lead to
   better performance, e.g., if a commonly-imported module is touched in
   this way, but you realize it hasn't actually changed, you can prune
   away large parts of the build graph.

2) The performance issue has already been solved, see for example:

	https://gittup.org/tup/

   The underlying idea is: *don't* scan the entire source tree to detect
   changes, use modern OS facilities (inotify, FileSystemWatcher, etc.)
   to let the OS tell you when something changes.  This allows the build
   time to be O(n), where n is the size of the change, rather than O(N)
   where N is the size of the workspace.  This is important for
   scalability to large projects where N is usually significantly larger
   than n.


T

-- 
An elephant: A mouse built to government specifications. -- Robert Heinlein