9 ms·
OpenBSD has two new C compilers: chibicc and kefir
- kazinator 4y ago> Here are the number for chibicc: text data bss dec hex 753670 40034 29848 823552 c9100 > And here are the numbers for kefir: text data bss dec hex 2374884 12071 30120 2417075 24e1b3 These are behemoths; especially the latter. Only compared to the grotesquelly aberrant code sizes of GCC and its ilk does this look "small". (The numbers in fact give me a dollop confidence that these are might be substantially more than toys.)
- sylware 4y agowhy cannot we have the same with c++ ? I wonder.... (very ironically)
- phendrenad2 4y agoOne of my main complaints about the BSDs is that they include the entire source trees for LLVM/clang and GCC. It seems like it's the only way for them to maintain the two golden BSD rules: "You shall have in your codebase everything needed to build a complete BSD system" and "You shall run on at least 30 or 40 different CPU architectures". I wish git submodules were more modular(!), so I could clone OpenBSD and LLVM/gcc would be an replaceable submodule, and instead drop in something like smallc.
- ggm 4y agoDo they compile the kernel, or even just fragment .o for safe inclusion in the kernel?
- prianaquino 4y agoNice
- alex3305 4y agoThanks for this. I don't know anything about compilers, but I really enjoyed reading this. Besides the technical insights it provided, I also loved the positive attitude of this article. Two excerpts that stood out for me: > [...] if the code kefir produces is correct, then it is amazing that one person was able to create a complete C17 compiler and that fact should be celebrated. > I'll admit this is not something I would have thought of but it appears to work just fine.
- boberoni 4y ago> Kefir also says in all bold letters in its README.md: "Usage is strongly discouraged. This is [an] experimental project which is not meant for production purposes." > That was all the encouragement I needed. I love this
- jraph 4y ago"Usage is strongly discouraged, not meant for production" is a clue for "I actually put care into this thing, production use is probably fine" Garbage-quality projects don't bother putting such warnings. They might even not be aware they are garbage. (/s)
- dijit 4y agoThis is sarcasm but there is a lot of truth in it unfortunately. I'm sure there must be a term for this... known incompetence > unknown incompetence. Doing your own research on complicated products is hard, that's why we as a community seem to move on to things via trial and error.
- winReInstall 4y agoAh, yes, love those, cobbled together embedded compilers. Not a word in the Release.Me about the quirks. Just a "STABLE!!!". Like binary C-Operators will only work on the first 8 bits, the rest is up there and needs to be shifted in and out.. basically work it out yourselve, once it wont work. Then explain to the manager, that his hot project tooling from the megacorp upstream was basically license-brokken copy pasted garbage from some hobbyist half way around the world). And get a no, when asking for at least posting the patches back. Or the "Working feature" which is just some api header, going into a inlined binary blob returning some constant. Which is just some flytrap to get you to drive by develop it for them. Twelve angry part time devs, make up one full working project. The only professional in some industries is looking at you every morning from the mirror, begging for a mercy killing.
- Rochus 4y agochibicc is great and also a very useful tool to do different kinds of C source code analysis and processing, such as https://github.com/rochus-keller/c2obx/ https://github.com/rochus-keller/c2obx/
- jart 4y agoI use chibicc to generate the documentation for cosmopolitan. https://github.com/jart/cosmopolitan/blob/master/third_party/chibicc/README.cosmo https://github.com/jart/cosmopolitan/blob/master/third_party... I added many of the GNU extensions too, including an assembler. https://github.com/jart/cosmopolitan/blob/master/third_party/chibicc/help.txt https://github.com/jart/cosmopolitan/blob/master/third_party... Needless to say, I've already ported it to OpenBSD. I ported it to NetBSD, FreeBSD, Windows, and Mac too.
- Rochus 4y agoThat looks like a very useful C library, thanks for the hint; as it seems it is much more than just a standard C library in that there are also threads, unicode and a lot (all?) of posix features; I do not have the full grasp yet, but it seems that I could use it as a runtime library for my Oberon+ language (which has a built-in FFI and can also transpile to C).
- cykros 4y agoIs it just me, or is the first time that "OpenBSD" and "New" were in the same sentence? I love OpenBSD, but in fairness, its biggest virtue is usually its rock solid stability and security, derived from everything in it generally being long battle tested before ever going into OpenBSD. The idea of bleeding edge C compilers seems a bit strange, given that reputation.
- practice9 4y agoIt's probably Debian you thinking of
- naniwaduni 4y agoNot really, no? Plenty of bleeding-edge goes into OpenBSD, most of it never makes it out to the rest of the world before being battle-tested there.
- paldepind2 4y agoThe "new" in the headline refers to these compilers being newly ported to OpenBSD. OpenBSD also sometimes gets new features, sees new releases, etc. There's nothing weird about seeing "new" and "OpenBSD" in the same headline.
- asveikau 4y ago> OpenBSD also sometimes ... sees new releases They do two releases per year on a schedule.
- bejelentkezni 4y agoIt got a brand-new filesystem a couple years ago.
- nix23 4y agoUFS2 from FreeBSD? Brand-new??
- aidenn0 4y ago
- skc 4y ago
- HideousKojima 4y agoIt's the name of a weird fermented milk drink in a lot of Slavic and other languages (I first encountered it in the Czech Republic): https://en.m.wikipedia.org/wiki/Kefir https://en.m.wikipedia.org/wiki/Kefir
- jwilk 4y agoNon-mobile link: https://en.wikipedia.org/wiki/Duck https://en.wikipedia.org/wiki/Duck
- proto_lambda 4y agoI would argue ducks are more mobile than your average glass of kefir.
- jwilk 4y agoOops, sorry, I always confuse the two. The correct link: https://en.wikipedia.org/wiki/Kefir https://en.wikipedia.org/wiki/Kefir
- darrenf 4y agoThere are shelves and shelves of it in UK supermarkets, it's very popular here. I live a walk away from a dairy that produces it (including kefir soap bars) https://www.instagram.com/wildcroftdairy/ https://www.instagram.com/wildcroftdairy/
- bawolff 4y agoNot just europe. I'm in canada and its very common to see it in grocery stores (maybe not the most popular drink, but popular enough people know what it is). I fully knew what Kefir is before this post. I had never heard of the slur everyone is talking about until reading this comment section.
- _g6sn 4y agoKefir author here. Quite surprised to see it on HN. A few notes in response to Brian's post and comments: - Kefir name is simply a reference to milk drink, no other connotation is intended. Updated project README with this information. - The compiler is indeed quite primitive, especially, in terms of code generation. My main goal was implementing a C compiler that is reasonably compliant with language standard and platform ABIs, so I decided to simply ignore any performance considerations as I wouldn't compete with well-established compilers anyway. Usage of threaded code is also caused by the same reason -- it is very simple to obtain assembly from intermediate representation when the assembly is mostly composed from references to runtime routines. Even without considering more sophisticated schemes of code generation, current approach is not optimal -- threaded code encoding scheme is very wasteful in terms of generated code (which was also noted in the blog post) and has awful runtime performance. - I have tried to keep compiler compliant with the standard as well as compatible some of widespread C extensions (with some exceptions which I listed in README). Will try to address compilation errors found by Brian. Unfortunately, currently I do not have much time to work on the compiler. Identifying and fixing such bugs might also be quite tedious, so I expect that there are enough unnoticed compatibility problems there. - Patches implementing OpenBSD support are appreciated. I plan to integrate those into the main code tree at some point.
- int_19h 4y agoHeh, when I saw a C compiler named "kefir", I immediately thought that it must be made by someone from the former USSR.
- watersb 4y agoSummertime: refrigeration is nowhere, so kefir is everywhere... Good times.
- jcahill 4y agobumping the author's chain and bluntly suggesting that others (like myself) without much/any stake in openBSD's C compilers should stfu with the name flaming now, because the fact that it's still continuing in replies at this point is more a matter of narcissism and disrespect for the submission than anything else.
- 1vuio0pswjnm7 4y agoThanks to the author for oksh (portable OpenBSD ksh). It is a pleasant alternative to Bash on Linux. 288KB vs 1.3MB. Wonder if oksh will compile on mips74Kc. I started to do something similar for NetBSD ash, for personal use only. Dash and busybox are OK, but I want both fc and command line history.
- 1vuio0pswjnm7 4y agoI have managed to compile dash with fc and history. I also want autocomplete.
- linksnapzz 4y agoAll I want for Christmas is a compliant C++11 compiler/transpiler, written in plain portable ANSI C.
- anthk 4y agocproc?