r/cprogramming • u/Cutro3010 • May 25 '26
Why doesnt C have something like rust crates or python pip?
Its more of a curiosity than anything. I'm not very experienced in C, before finally deciding ti switch to C programming journey I tried looking at rust, and found the crates very easy to setup and use. Why doesnt C have something similiar? Is there an actual reason, or simply nobody has already invented something like that?
76
Upvotes
19
u/nimrag_is_coming May 25 '26 edited May 25 '26
People have invented a package manager for C. The problem is that they keep inventing them and nobody can agree on what's correct, and most of the time they aren't used anyway. I think the biggest is probably Cmake packages (although it's not really a package manager as it is a build system), and vcpkg (which still isn't that popular), and both of them are still mostly for c++.
Edit: Another thing to note is that a lot of newer languages are more standardised as well. Rust has one official compiler that everyone uses, while C has three major ones, plus about four other modestly popular ones that are used a fair amount, and hundreds of other ones that have come and gone over the years.
15
u/EpochVanquisher May 25 '26
It’s really just that C is so different on each platform and there are a lot of configuration options, so it’s hard to manage.
There are package managers out there, like Conan and vcpkg.
On Linux, you can use apt, dnf, portage, pacman…whichever package manager comes with your system, and then pkg-conf to find them.
On Mac, use Brew.
There’s also Nix as an option.
None of these options work beautifully across all platforms and toolchains. It’s just so much work to deal with cross-platform issues with C.
5
u/EndlessProjectMaker May 25 '26
You choose C when you need tight control of everything, what is a static link, what a dynamic one, a runtime dependency etc. with a transitive package manager you kind of loose control about what is included, having an “automatic” software bom is not desirable in many context. I guess this is why no package manager “hooks up” in the c community.
Think about big projects like the Linux kernel, or small projects like embedded firmware. In both extremes you need/want a controlled sbom.
130
u/ByMeno May 25 '26
C is much older than the internet-era package ecosystem model. It was designed in the 1970s, when software distribution mostly relied on source tarballs, Unix system libraries, and vendor-specific toolchains.
C is also intentionally minimal and standardized only at the language level. There is no official build system, dependency format, metadata standard, or ABI guarantee between compilers and platforms.
That said, package managers for C do exist today, such as Conan and vcpkg. The difference is that, unlike Rust’s Cargo or Python’s pip, C never adopted a single universal ecosystem or standard package manager.
14
u/Teldryyyn0 May 25 '26
Why didn't the first cars have air conditioning
7
u/James-Kane May 26 '26
We write our own vulnerabilities in C. We don't vendor them in from an untrusted supply chain.
6
u/dashingThroughSnow12 May 26 '26
Everyone makes mistakes but C devs have avoided this one.
6
u/swdee May 26 '26
Because C programmers come from an era were they could read readme.txt files and could handle;
Unfortunately this skill was lost with the web programmers so they needed prebuilt packages to install.
3
u/Rich-Engineer2670 May 25 '26
C is 50+ years old. There are third-party tools that add that functionality in the toolchain, but the language was never built with it -- or even the concept of the Internet.
3
u/brewbake May 25 '26
Considering these things a “part of a language” is a concept that appeared much later than C was developed. C is classic Unix philosophy — be as small as possible, do one thing and do it well.
Realistically on any new system it takes about 5 minutes to install everything I need (libcurl, hiredis etc) with the available package manager (brew, dnf etc).
3
u/ybungalobill May 25 '26
C follows unix tradition, and doesn't try to do anything beyond being a system programming language. It delegates such things like package management and build system to other tools. In the olden days these were tar and make correspondingly. Nowadays it's usually your system's default package manager and your favorite one, of the plethora, of build systems available.
IMHO C's approach is superior. "Modern" languages tend all come with their own package manager and build system. From purist pov this violates unix tradition. From practical pov it creates a mess when you start mixing different languages in one project.
2
u/poorlilwitchgirl May 25 '26
A lot of comments here are saying that the reason is that package managers weren't a thing when C was created. While that's true, the more important reason is that C and Unix were developed simultaneously to be a unified development platform, so when package managers became a thing, they were integrated at the OS level rather than the language level. Granted, C is the most widely ported language on Earth and can be used on essentially any operating system ever built, but its design is still driven primarily by the needs of Unix-based development, and traditionally under Unix the OS and the C toolchain are tightly integrated. A siloed C-only package manager would be both superfluous, given the plethora of package managers available for POSIX systems, and a poor fit for the distributed, modular C ecosystem.
2
u/RedWineAndWomen May 25 '26
Because we don't want all the supply chain attacks that come with it? ;-)
2
u/un_virus_SDF May 25 '26
C have no standard build system.
Now try to use cratrs in rust without cargo.
You will find your answer.
Dependency management is often either done by hand, sometimes with the help of a programme (e.g. github linked repository).
Or sometimes they're just managed by your OS. Most of the time it's quite easy to manually install something on your pc.
2
u/Maleficent_Memory831 May 25 '26
Why should it? This "feature" in Rust and Python feel like anti-features. A build system should be independent and distinct from the language. Otherwise you are locked in to one system only, a system likely built around one persons biases.
Now then you fall in love with crates and pips, but now you have a project big enough that it includes many different programming languages. What do you do? Do you pretend that the entire world should act like Rust so that you do not violate the Rust Religion, so everyone must use crates? Or do you go with a language agnostic build system?
What do you do if your independent build team does not use crates or pip? You've got to work without it, and no amount of whining will change their minds (nothing worse than a first year intern trying to change the entire corporate culture to match how things were in school).
C is from the guys who did Unix. The philosophy in Unix was each tool does one and only one job, and does that job well. No tools that try to do everything, as was common in the pre-Unix era. This means each tool is simpler, easier to understand, easier to develop, easier to debug. Even the C compiler was a set of multiple tools, and today's C compilers are often the same way with multiple executables being called in sequence.
If the C pre-processor was not a part of C itself, then why the hell should some stupid ass Make wannabe be a part of C?
(I once interviewed with Stu Feldman, the creator of Make)
2
u/pm_op_prolapsed_anus May 26 '26
Look into vcpkg. If you find an alternative you like better, use that
2
u/Voyac May 26 '26
I doesnt? I have just installed libxls with dnf package manager...
2
u/lmemsm May 26 '26
There are options in C: https://github.com/clibs/clib
0
u/duane11583 May 25 '26
do not think rust crates are that great. i am not a fan of rust but i am required to use this bullshit
there are existing tools that work well… but the rust-heads think they must replace everything end to end the rust way or the highway. rust is hostile to these tools like make, cmake, scons you name it and related things
rust also enforces a naming convention that is hostile to non rust code.
for example you might have a C function named FOO_bar() in C and say a large/huge number of functions named that way. as far as rust is concerned you should rename every one of those functions otherwise you get endless warnings
and if you have a requirement you must get rid of all warnings you are screwed
oh and dont tell me to disable that warning cause disabling it is exactly a very broad brush that goes too far, and decorating each of several thousand functions is painful in short if you declare a function as extern “c” is should relax the naming convention for that extern “c” function. but no.. rust rules or the highway they seem to know better.
rust has zero stable abi. none period. rust is hostile to a third party package like a prebuilt library.
example: i wish to provide a prebuilt linkable lib that performs something rust is hostile to this.
for various reasons i cannot or shall not provide source to this library
why? because the cargo process generally requires the entire source code to be present for all modules(crates) because cargo must recompile all source code. every single time
oh yea rust/cargo can create a library… but…
each version of the compiler: rustc is allowed to change the calling convention for any function in any way it chooses. this means if you create a library using rust 1.96 there is zero guarantee that it will work with rust version 1.95 or rust 1.97
rust does not support standard libraries as a result.
rust / cargo does not support the concept of pre and post build operations
example: pre building i need to run a script that converts data files into compile able data tables.
example post build i need to perform a digital signature operation on the app, or i need to convert the elf to a bin or hex file to load on my board.or any thing like that.
1
u/shoesmith74 May 25 '26
Libraries are the packages for C.
1
u/trannus_aran May 25 '26
It's called "your system's package manager"
1
u/MikeUsesNotion May 25 '26
The languages that have package managers are OS/hardware agnostic for all but a relative handful of packages, so for the base case it's easy. For native libs, you'd have to slice it all kinds of ways by hardware, OS, system libraries, stuff like that.
That's why native libs are handled with an OS package manager if there is one, and with manual downloads if there isn't.
1
u/stewartesmith May 26 '26
One I reach to a lot is https://github.com/rustyrussell/ccan (unfortunately the domain was taken over by squatters).
The idea behind it was to collect the small things that aren’t worth (or aren’t possible to as they’re all header files and macros) turning into libraries.
Honestly, I find it’s either something significant enough that I should just link to the library that’s packaged separately, or it’s something like what I get from CCAN, so is just copied in. This view is from a very Linux/Unix point of view - Windows and macOS* have different standard operating procedures.
[* yes, I know macOS is technically Unix, I’m talking about macOS apps, not something you’d find packaged in homebrew]
1
u/Lutz_Gebelman May 26 '26
There is. It's called pacman... or apt, or dnf, or whatever distro package manager you are using
1
u/mze9412 May 26 '26
Package managers for third party libraries are IMO a requirement in today's fast moving vulnerability scene. If updating your third party components means someone is downloading source code or a compiled dll from somewhere ... And how do you reliably create a sbom?
Building everything from git repost with tags or commit sha is also already close to using a package manager ;)
1
u/RazzmatazzLatter8345 May 26 '26
C++ doesn't have an official package manager or build system either, although there are common options available: (CONAN/vcpkg) for package management; CMAKE / MsBuild for build systems.
The C++ standards committee focuses on the core language and standard library and traditionally has seen such minutiae as outside of its mandate.
C++ has changed A LOT more than C over the years. Given C is far more conservative and resistant to change than C++, the lack of an "official" package management system is not particularly surprising.
Also the definition of C++ is set by committee whose sole job it is to define the language. Rust and C# (maybe python too, not sure) are more centered on a single organization, which works on both the language standard (if there is one), the creation of compilers as well as tooling. The designers of C and C++ leave making compilers and tooling and such to others. While the big C++ compilers are mostly compatible with the international standard that defines the language, there is no such coordination on unimportant little ancillary details like package management and build systems. Hence there are competing versions of compilers, package managers, build systems, etc.
1
u/austinwiltshire May 26 '26
I feel like docker works as a package manager just fine if you don't want to use Conan. You can install things straight into the system then, which is where they often insist being.
1
u/patmorgan235 May 26 '26
C is older than DNS.
It predates the ubiquitous Internet/web that we live in today. When C has header files because computers weren't powerful enough to complie whole programs, they had to be split up into multiple pieces so you didn't run out of RAM.
Package management didn't become common for a programing lange tool set to provide until very recently.
1
u/PhysicalFinance1578 May 27 '26
actually linux distros are package collections for c. if a new distro version comes out, it is tied to a libc and stdc++ lib. and you can manage the c packages with apt
1
u/alex_sakuta May 27 '26
Supply Chain Attack is not a joke Jim! Millions of people suffer daily from it.
PS: Explanation for people who won't get the joke because they don't know what is SCA.
When you use a package manager you are allowing someone else's code into your codebase and there can be potentially harmful code hidden in the package. This is called Supply Chain Attack.
Now C was written before the concept of package mangers existed but even now with Conan's and vpkg's existence people avoid package management and instead prefer package vendoring when working with C.
Package vendoring means you find an open source package and then you just copy parts of it that are required for your particular application instead of the whole package and basically manage these parts of code as if they are your own.
PS: For people who didn't get the reference of the joke.
"Dwight Schrute" in an episode of "The Office" says to "Jim", the character famous from pranking him, the following line.
Dwight says this line when Jim pretends to be Dwight by wearing the exact same attire as Dwight and also tells everyone in the office to refer to him as Dwight.
1
u/Sva522 May 27 '26
Because we already have disto packagé manager and the system rely on it
1
u/deax1 May 28 '26
It's like driving a manual car or listening to vinyl on record. A nice automated system removing friction from this and this isn't a requirement.
1
u/yiyufromthe216 May 29 '26
Because it does. Whatever package manager your distribution ships with is used to manage the dependencies related to the project.
1
u/Wizarsy May 29 '26
Historical factors... if you want a package manager, use Conan.
1
u/Inner-Fix7241 May 29 '26
C was invented when dinosaurs were still alive, that's why.
1
u/TheChief275 Jun 01 '26
Cargo is the absolute worst though?
1
u/Federal_Ad7921 Jun 25 '26
A big reason is that C predates modern package management by decades. C was designed in an era where libraries were often provided by the OS, compiler vendor, or built directly from source, so there was never a single ecosystem-wide package registry like Rust's Cargo/crates.io.
There are modern attempts (Conan, vcpkg, Hunter, etc.), but C's portability requirements, multiple compilers, ABI compatibility issues, and huge legacy ecosystem make it much harder to standardize on one solution. Rust had the advantage of designing the language, build system, and package manager together from the start.
1
u/IhategeiSEpic May 26 '26
Because a compiled language doesnt need it.
0
u/I_M_NooB1 May 26 '26
Because it's an old stinky language
2
u/curious_monkey1995 May 26 '26
So that you can raw dog your own
23
u/[deleted] May 25 '26
[removed] — view removed comment