4 ms·
>I never understood the concept of "optional" library.[...] In case it is not installed the compiler will fail with a very clear error message. [...] and in you
by jasode 6y ago
>I never understood the concept of "optional" library.[...] In case it is not installed the compiler will fail with a very clear error message. [...] and in your makefile you will link your executable with -lpng. And that is all! This works in linux, bsd and macOS. What the fucking else do you need?
Interesting condescending tone there. I didn't downvote but if I can try to answer the core part of your misunderstanding: Many do _not_ want the build to fail when library png is missing.
Example projects using this type of build optionality are FFmpeg and Qt.
For example, ffmpeg lets you build with the optional Fraunhofer FDK AAC (libfdk_aac)[1] encoder but it is not GPL license compatible. If everyone followed your "assume libfdk_aac is already installed" advice, many people would be stuck at the "very clear error message" and not be able to have a working GPL ffmpeg.
Same idea with Qt optional libraries.
[1] https://trac.ffmpeg.org/wiki/Encode/AAC https://trac.ffmpeg.org/wiki/Encode/AAC
- kgwgk 6y agoCome on, then just edit a configuration file specifying what libraries you want to use and where they are! /s
- matthewaveryusa 6y agoOk, humor me for a second: What's wrong with that?
- kgwgk 6y agoIt's not "wrong". It's a choice. You can provide some code and let the users do whatever is needed to get it to compile on their system. Or you can try to automate the process with the best of intentions and create a monster. In any case, the reason why autotools exists in the first place is that people were less than thrilled with the work required to make things work by hand.
- twic 6y agoUsers should ask for something, and the build should build that, or fail if it can't. Randomly linking against things if they happen to be available is a terrible idea. Does any build ecosystem except C do this? I'm not sure even CMake does this.
- greatgoat420 6y agoWho is the user? Most "users" never build 99% of what they use from source. Sure a few things that they do build they would like control over. But randomly linking against things is the default because it make the package maintainer's job easier, and it is hard enough as it is to get people to maintain and update packages for distributions.
- jerf 6y agoI'd paste the output of ffmpeg's ./configure --help here to illustrate the point, but it would be a rather hostile HN post due to its sheer size. It's not really practical to expect someone to configure dozens or even hundreds of optional libraries in a configuration file. It would be a major hassle to have to get a config file correct rather than config detecting as much as possible. ffmpeg is an extreme case, but it's proportionally not that uncommon; many of the things people most want to compile by hand are naturally the things with a ton of optional libraries. The easy cases with 0 or a handful of options are handled by your package manager and you don't care, because there aren't any "options" for you to disagree with.
- rualca 6y ago> Ok, humor me for a second: What's wrong with that? There's absolutely nothing wrong with that, and in fact it's so simple that afterwards we can even write a script to automate setting those variables. Who needs convoluted build systems anyway?
- greatgoat420 6y agoMy sarcasm detector is on the fritz, what you are talking about is autotools, correct?