News for hackers. Stuff that matters.
Re:FreeBSD spends 7% of its boot time running a bubblesort o... by IshKebab on Friday May 19, 2023 @03:56PM (#36006149)
There's no standard build system. Think about how you add a dependency in Rust, Go, JavaScript, even Python.

Now do it in C/C++. Absolute nightmare.

Look at how many header-only C++ libraries there are out there. They're making compilation time drastically worse purely to avoid the need to faff with a shitty build system. It's a good trade-off too. I use header-only libraries where possible. They're convenient and popular.

Actually vcpkg seems to be going some way to fixing that but I have yet to convince my co-workers to use it.

Re:FreeBSD spends 7% of its boot time running a bubblesort o... by JohnFen on Friday May 19, 2023 @05:05PM (#36006837)
> to avoid the need to faff with a shitty build system.

Then maybe don't use a shitty build system?

It's true, C is not trying to be a programming environment or tech stack. It's a language, that's it. Whether or not that's desirable depends on what you're trying to do, it's not something that is good or bad in some absolute sense.

You have your choice of build systems, so pick one that meets your needs.

Vcpkg isn't for me, either, because it doesn't solve any problem I have. If it does for you, awesome!

Re:FreeBSD spends 7% of its boot time running a bubblesort o... by IshKebab on Friday May 19, 2023 @05:18PM (#36006970)
> You have your choice of build systems, so pick one that meets your needs.

And can I pick the one that my dependencies use too? Didn't think so.

Re:FreeBSD spends 7% of its boot time running a bubblesort o... by JohnFen on Friday May 19, 2023 @05:40PM (#36007151)
Your dependencies have already been built. You're just linking to them. So yes, you can.
Re:FreeBSD spends 7% of its boot time running a bubblesort o... by inferiorhuman on Friday May 19, 2023 @06:37PM (#36007562)
And what if the dependencies haven't been built yet?
Re:FreeBSD spends 7% of its boot time running a bubblesort o... by icedchai on Friday May 19, 2023 @06:51PM (#36007708)
Build them and install them in /usr/local, just like we did 30 years ago.
Re:FreeBSD spends 7% of its boot time running a bubblesort o... by inferiorhuman on Friday May 19, 2023 @07:27PM (#36007959)
With what? The whole point of this line of discussion is that building stuff in C is suboptimal, often requiring the end user to juggle n different build systems by hand to get all the dependencies installed.

Since we're talking FreeBSD here, thirty years ago we had Modula-3 whose build system is lightyears ahead of anything make based.

Re:FreeBSD spends 7% of its boot time running a bubblesort o... by icedchai on Friday May 19, 2023 @07:52PM (#36008102)
You already answered your own question: with whatever tools that dependency requires, often ./configure && make && make install

In the event you find yourself doing this constantly, write a shell script.

Re:FreeBSD spends 7% of its boot time running a bubblesort o... by inferiorhuman on Friday May 19, 2023 @10:03PM (#36008764)
And now we're back at: this is why C is more difficult, for no good reason, than the alternatives. For small projects that you're only building locally, your approach may work. Once you expect any sort of cross-platform compatibility and/or start distributing your project to others, this approach falls apart and fast. Instead of focusing on development you'll be focusing on playing whack-a-mole with incompatibilities between the different shells (or versions of make, etc.) offered on different operating systems.

Again the problem is that no package/dependency management for C/C++ means that C is balkanized and more difficult to deal with compared to other languages. Using third party libraries in C is far more difficult and error prone than it ought to be.

Pretty much every language that provides more comprehensive dependency management also provides easy enough access to allow you to NIH/DIY it if you need/want to. For instance contrast this with something like rust where cargo is standard across all supported platforms and provides proper dependency management. You can still call the rust compiler (rustc) and whatever linker yourself if you so desire.

Re:FreeBSD spends 7% of its boot time running a bubblesort o... by IshKebab on Saturday May 20, 2023 @02:18AM (#36009775)
Honestly if you lack the vision to see why that sucks I really suggest you try a language with good package management - e.g. Go or Rust. Maybe it will make it easier to see all the problems with the traditional C approach if you can see how it should work.
Re:FreeBSD spends 7% of its boot time running a bubblesort o... by icedchai on Saturday May 20, 2023 @02:01PM (#36014120)
C and C++ dependency installation is "sub-optimal" but it is certainly well understood. The fact that there are many cross platform, open source projects written in C and C++ proves this. If you can't deal with makefiles and scripts, maybe stick to Go and Rust?
Re:FreeBSD spends 7% of its boot time running a bubblesort o... by steveklabnik on Saturday May 20, 2023 @02:33PM (#36014415)
> If you can't deal with makefiles and scripts, maybe stick to Go and Rust?

Many people will in fact do just this.

Re:FreeBSD spends 7% of its boot time running a bubblesort o... by inferiorhuman on Monday May 22, 2023 @12:18AM (#36027409)

  C and C++ dependency installation is "sub-optimal" but it is certainly well
  understood. The fact that there are many cross platform, open source projects
  written in C and C++ proves this.
Nope. It proves that people have found work arounds up to and including cargo culting things. Any large enough project is going to rely on something else to generate the makefiles, and if you depend on anything large enough you're gonna get stuck having to build and/or install whatever other makefile generators are required. Simply put it's an archaic mess.

  If you can't deal with makefiles and scripts, maybe stick to Go and Rust?
To be clear it's not that I can't deal with makefiles it's that I don't find it a good use of my time*. Take, for instance, the FreeBSD ports tree. make(1) is its achilles heal and the main reason it's obscenely slow to deal with (even compared to something like portage). Besides, doing anything by hand is inherently error prone be it bounds checking array access or cobbling together dependency management.

* And, sure, in years past I wrote a drop-in replacement for automake/autoconf in perl whose big (speed) advantage was that it didn't spawn a new shell for each check. It was a neat hack, but that's all anything papering over the make(1) interface is.

Re:FreeBSD spends 7% of its boot time running a bubblesort o... by JohnFen on Friday May 19, 2023 @07:00PM (#36007780)
Then build them. I'm not seeing the issue here, to be honest, so I'm not sure what I should be addressing.

If the issue is that you don't like how the dependency has arranged to build (I'm not sure why you'd actually care, but just in case...), then port the makefile (or whatever) to your preferred system.

Or, another guess, is the issue that you want to build all your dependencies as if they were an integral part of your own project? If that's the case, I would argue that you're doing it wrong and another tech stack would make you happier.