6 ms·
One of the most commonly cited drawbacks about C (limited standard library and package management) is something I’ve grown to enjoy when working in a well-love
by kianN 2y ago
One of the most commonly cited drawbacks about C (limited standard library and package management) is something I’ve grown to enjoy when working in a well-loved C codebase.
Instead of learning and working with bloated tool chains, every tool in the repo has been built or added carefully for the task at hand. Simplicity provides a lot benefits over time.
- klysm 2y agoC toolchains are the most painful to set up in my experience and have incredible bloat. Familiarity is not simplicity
- kianN 2y agoI’ve never been on a system that doesn’t have either gcc or clang built in. But disclaimer that my experience in C is limited to a specific subset of scientific computing, so my experience is definitely limited
- klysm 2y agogcc/clang isn’t really sufficient though right? Usually there is another build system on top
- kianN 2y agoI only use clang with a Makefile and I’ve done some relatively complex projects albeit with only a few collaborators.
- dmitrygr 2y agoI haven’t seen a system that has GCC but lacks make
- inferiorhuman 2y agoYeah, but is it a version of make that's compatible with your makefiles?
- theamk 2y agolikely yes? I've never had problems with make versions specifically. Usually the project requires distro at most X years old because of gcc/clang version or shared library version. By the time you solve those, your make is new enough as well.
- inferiorhuman 2y agoI mean yeah if all you're using is Linux then the issues with buggy versions of GNU make is something you've probably not seen in a while. Apple is still on 3.81 due to GPLv3 which means bugs. None of the BSDs ship with GNU make in the base system, and I believe they all install it at gmake (which means you've gotta be careful about hardcoding calls to make.
- ryao 2y agoIt is possible to write portable make files that work with both.
- inferiorhuman 2y agoThe pain in doing so and the very real chance you're trying to do something that can't be done in a portable manner is why things like cmake (and every other build system under the sun) exist.
- maccard 2y agoIn my experience as a regular MacOS user, the "portable" solution is to install the version of make that everyone else uses (i.e. it's not portable)
- maccard 2y agoWindows, for one.
- sgarland 2y agoThat’s on you for using Windows.
- maccard 2y agoMy experience with "portable" software is that it's portable as long as you're using the same OS and toolchain as the author. Other systems exist, and plenty of us are less belligerent about our choice of OS.
- skydhash 2y agoAs for windows, I always assume you need to install an IDE like visual studio, clion, codeblocks.
- maccard 2y agoCmd and powershell exist and have done for a long time. There was a period of time where the visual C++ compiler was bundled with the IDE but it’s been available separately for the best part of a decade. Various incarnations of gnu-on-windows have existed for longer than that - Msys/cygwin/wsl are all feasible options and have been for ages. But, none of them come preinstalled.
- jimbob45 2y agoCouldn’t agree more. Vcpkg + CMake doesn’t come close to the convenience of NuGet + MSBuild. The latter Just Works every time. You can’t say the same about C.
- dig1 2y agoMaybe I'm missing something, but what is painful to set up with C toolchains? On almost every *nix, (g)cc, vi(m) and make are enough to be dangerously productive. Sure, you can overcomplicate stuff with modern IDEs and IDE-like tools, but that is out of the realm of the usual C toolchain.
- klysm 2y agoI’ve never seen a real project that doesn’t use make, cmake, or some other glue on top of gcc/clang. Dependency management is absolute hell as well
- immibis 2y agoDependency management in C is the hell that you and your dependency make it, alone. You can try to copy a .a file and a directory of headers into your project, or you can try to make a massive graph of 1000 dependencies that needs a SAT solver to untangle. Dependencies are hell in JavaScript, Haskell, and Python too, but you don't notice because the computer works through the most common hells automatically... so developers don't hesitate to create hells. In C, they hesitate.
- deleted 2y ago[deleted]
- Ygg2 2y ago> In C, they hesitate. Looks at most Linux distros. Are you sure about that?!
- BoingBoomTschak 2y agoAre you really putting make and CMake in the same bag? POSIX make and Plan 9 mk are incredibly simple, compared to autotools/CMake; even BSD/GNU make, with all their extensions, are quite simple. Personally, after having gone through a lot (GNU make, sh script + POSIX make, CMake + conan at work), I think a simple POSIX 2024 make + pkgconf(ig) really is enough for simple programs; and Windows devs can use WSL or whatever.
- checker659 2y agoOnce you set things up, chances are it'll still build just fine in 5 years tho.
- 1vuio0pswjnm7 2y agoWhat are the "least painful" toolchains to set up. How do they compare to GCC in (a) size and (b) portability.
- inferiorhuman 2y agoLLVM is a bit easier to set up in my experience. One of the most irritating things about setting up a GNU toolchain is the hard dependency on texinfo (which has been dropped in later versions I think). In general I've found rust pretty easy to build.
- wfn 2y agoAgree regarding easiness of building rust (`cargo build`), extremely satisfying (git clone and cargo build...) Does anyone have any comments on Bazel[1] because I'm kind of settling on using it whenever it's appropriate (c/c++)?.. [1] https://bazel.build/ https://bazel.build/
- 1vuio0pswjnm7 2y agoIs python actually a requirement for compiling the rust toolchain so compiling rust toolchain requires compiling python first https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html https://rustc-dev-guide.rust-lang.org/building/how-to-build-...
- klysm 2y agoThen the c toolchain needs to also be considered from a bootstrapping standpoint
- 1vuio0pswjnm7 2y agoIs cmake actually a requirement for compiling LLVM such that one must compile cmake before one can compile LLVM. Compiling a statically-linked cmake is time-consuming and difficult if not infeasible.
- 1vuio0pswjnm7 2y ago
- johnklos 2y agoYou're not wrong, but you're closer to wrong than right. C toolchains are the best of a collection of rather sucky things. I can compile all sorts of things on my Mac LC III+ with 36 megabytes of memory. Sure, Perl takes nine days, but it works. What other language can actually be used on a machine with such little memory?
- lelanthran 2y ago> C toolchains are the most painful to set up in my experience and have incredible bloat. Familiarity is not simplicity What are you comparing it to? C++? Java?
- dezgeg 2y agoautotools would like a word with you
- kianN 2y agoHaha I definitely greatly benefit from autotools infrastructure to such a degree that I took it for granted in my above comment.
- 01HNNWZ0MV43FF 2y agoI don't usually have tools in my repo, I only have my own code
- FiniteIntegral 2y agoEven though I love 3rd party tools (SDL my beloved) I still find novel uses in the C library. Especially for string-related problems people say "just do it from first principles". Sometimes snprintf is enough for my debugging!