OpenBSD switches the default compiler on amd64 and i386 to clang
marc.info
marc.info
[0] https://github.com/openbsd/src/blob/0ecb71b5ec9e4b22a484606f...
Next time, if you want to be sure we read about your problems with OpenBSD, please use sendbug(8) and fill a report[1] or come talk to us on tech@.
[0] -- https://marc.info/?l=openbsd-cvs&m=150131738906455&w=2
I am not a programmer but I am curious: how does one select GCC as a compiler if the default is Clang? Just change what CC links to?
If there is a symlink it's probably ill advised to change it since it would be system-wide.
Switching compilers is a very common thing among systems developers.. bootstrapping OS builds, crosscompiling for a different arch, getting compiler feedback from another compiler, etc
I know CLANG is used in many research projects (which are often committed to the branch).
And i assume many, many legacy projects stick with GCC.
GCC however has many more platforms supported, so in certain use cases LLVM is out of the question entirely. That being said: for OS development (and many other projects) predictable and correct is more important than fast. Optimizations that lead to these performance gains are oftentimes harmful given that code is typically far from perfect.
Such blanket statements are not useful. Actually different compilers win on different benchmarks.
Look at any test e.g. https://www.phoronix.com/scan.php?page=article&item=gcc8-cla... — GCC is faster for FFTs, clang is faster for matrix factorization, … they trade blows basically.
LLVM itself, on the other hand, has many benefits. It has been around longer than GCC's standalone codegen library, and the API is quite good. There are more mature GPU ISA backends in LLVM as well, though GCC supports more exotic general purpose chips and microcontrollers. This works out better right now because companies have an easier time statically linking the (more permissively licensed) LLVM libs than the GCC ones, and so investing in these backends makes more sense for GPU vendors.
I remember working with CVS, it was horrendous; I'm surprised a project of this size is still on CVS.
It was an interesting migration project to follow seeing how the portage tree is huge.
Somebody corrected this (Gentoo VC software) later, but NetBSD does also still use CVS. Repo conversions are indeed big, interesting projects. I've closely-witnessed/been-peripherally-involved in a few, and there were some interesting papers written about various conversions years ago[0], when both git and mercurial were new and iirc monotone still had interest.
[0] both Mozilla and Sun were publishing their analysis and growing pains
Personally I advocate for Git, in leu of that, mercurial. CVS was so painful, it's just hard for me to imagine that people aren't actively figuring out a way off of it. It's literally one step above RCS...
I do know the pain of migration. I've done it at multiple companies, and am currently figuring it out for an extremely large codebase to get off of Perforce and onto Git.
There are significant productivity gains with Git across organizations that make it a worthwhile investment.
I was trying to install openbsd on a new router this week, and I had a hell of a time trying to repartition the disk such that it didn't pre-allocate partitions for X11 (which I had no use for). I could delete partitions but then I got empty spaces and seemingly no good way to resize via the primitive CLI. I googled around and found this thread [1], where someone suggested a GUI installer to help novice users install it, which got this reply:
"Uh no. The OpenBSD installation routine is perfect as is. I would not want to see a GUI installer on my favourite BSD."
Really, perfect? Could not be possibly improved? And because you don't want a GUI, no one should have one? All the rest of the replies were similar to boot.
I went back to Linux as I can only imagine what the rest of running it is like. Sometimes old stubborn cranks can really get in the way of progress.
You maybe missed option R:
R [part] Resize a partition in an automatically allocated label,
compacting unused space between partitions with a higher
offset. The last partition will be shrunk if necessary.
Works only for automatically allocated labels with no spoofed
partitions.
In OpenBSD, for any question first consult the man pages before "googling around". Their man pages are really good.With the actual installation instructions https://www.openbsd.org/faq/faq4.html
And how it does the auto https://man.openbsd.org/disklabel#AUTOMATIC_DISK_ALLOCATION
boot>
What am I supposed to do here? Does it require some weird incantation in order to load the kernel? It turns out you just have to hit enter.The OpenBSD install script really is quite simple. I'm not sure I would call it easy (simple ain't easy), but it's certainly straightforward and setup is usually just hitting enter a bunch of times. You only encountered trouble because you tried to fiddle with it and got frustrated.
Another huge benefit of OpenBSD compared to Linux is the incredible quality of documentation. Missing or outdated docs are considered a serious bug. To address your issue, let's look at the docs: https://man.openbsd.org/disklabel#AUTOMATIC_DISK_ALLOCATION
It looks as though if the installation target is smaller than 8GB, it won't create a separate partition for X11. That's useful to know. Additionally, you can specify your own partition template using the -T option.
It might be cool to see a graphical project like GhostBSD built on top of OpenBSD, but I have to agree with the curmudgeons that the text-based installer is pretty fantastic as-is.
> What am I supposed to do here? Does it require some weird incantation in order to load the kernel? It turns out you just have to hit enter.
> [...]
> Another huge benefit of OpenBSD compared to Linux is the incredible quality of documentation.
Where is the documentation that explains a) why you have to click <Enter> to continue the boot process and, b) the reason why this isn't self-documenting at the "boot>" prompt?
You don't have to hit enter at the boot> prompt. It pauses for a few seconds to allow you a chance to enter boot commands; you can hit enter to boot immediately, or it will proceed with a default boot after a few seconds if you do nothing.
Being able to reach the boot menu is critical when installing to a range of embedded devices such as routers. I use a null modem cable for input/output with my router, and the TTY settings need to be adjusted in order to see anything.
GUI bootloader alternatives often use the "press ESC really fast" strategy, which is arguably less intuitive if you're trying to figure out where the boot settings are.
Anyway the boot menu rather is self-documenting. It even responds to `help`. I eventually figured out the solution, but I still remember it as my first experience problem-solving on OpenBSD.
On my laptop the default configuration automatically boots too fast to read all of the sentence there. That's bad, but the tradeoff is I wait less time for my system to boot for all the times I don't need to reconfigure the boot.
That's what I mean by self-documenting, which the "boot>" example you gave is not. (Nor do I see any documentation about why it's not self-documenting.)
I don't think it's off topic-- for example, if the grub menu actually wrote "click" there would be a number of people who would grab the mouse and try to move a non-existent pointer to the letter "e".
Did you really think every server running OpenBSD requires someone to hit enter on the console to boot it?
Additionally, the manual tells you how to adjust the default boot settings.
After years of dealing with poor documentation, it takes some habit-building in order to check the openbsd manual every time you have a question. On Linux my first impulse is Google/StackOverflow.
Also, maybe you want to review the "GUI is easier than TUI" premise. Clicking per se is not inherently easier than hitting ENTER. And while I'm aware that I'm biased in that regard since OpenBSD is my favourite Unix, I'm honestly not aware of any other OS that's easier to install, GUI or not. You really have to read, understand answer those questions, there's no way around it. At this point, the difference between typing yes/no and ENTER vs clicking is minimal, usability-wise. On the other hand, the additional complexity brought by a GUI is a big burden on developers.
I remember this same discussion years ago on Debian land, when they didn't have a GUI install. Like an email from a random guy stating that if Debian would only fix their install and have a GUI, they would conquer the world. At a certain point, they finally built a GUI install, that was exactly the same questions asked in a GUI that even resembled the TUI. Biggest difference was, you could use your mouse. And eventually have some trouble because the installer wouldn't recognize your video card. In which case you could always fallback to the TUI install, but the question is: were there any usability gains at all by switching to a GUI? My point being, you can improve usability regardless of GUI or TUI.
In OpenBSD, if you are installing several similar machines with the same setup you can also do unattended installs (https://man.openbsd.org/autoinstall), and that would really make the install easier and simpler. I don't think you were referring to this anyway; but other than that, and putting the fallacious GUI vs TUI aside, I'm not sure how else you could make OpenBSD install much easier. I would be really curious to listen if someone have some specific ideas , and I'm pretty sure OpenBSD devs would also be interested.
I didn't see anyone getting in the way of progress. Someone said "I think the developers should make X for me," and other people replied "no they shouldn't." They could have said "yes, they should" and still nothing of substance would be done.
Yes, CVS; .. on top of which they invented read-only anonymous source control: https://www.openbsd.org/papers/anoncvs-paper.pdf
Of course you're free to use the, far more recent, GitHub mirror: https://github.com/openbsd
Edit: Not sure what the reason for downvoting an honest question is; from Googling, I can't find anything about incompatibility between GPL and BSD, and I didn't express any opinion about the merits of BSD vs. GPL.
BSD projects don't care for the anti-tivoization clause in the GPLv3 because it restricts where the software can be deployed, the GPLv2 was acceptable because there was no better alternative at the time and, again code was data in the case of a compiler.
A compiler tool chain typically _does_ insert code that you didn't write. For example, seen from the point of the loader, the entry point of an executable is not main. Similarly, one could argue that the function prologs and epilogs that gcc generates fall under the GPL.
Because of that, I think it is understandable that the BSD projects aren't willing to bet the existence of their projects "you code is mere data".
Can you really not compile code with gcc and have the result not be GPL licensed? This seems a bit dubious to me, although I honestly don't know enough to know if it's true or not
Judging by their behaviors, it seems both Apple's lawyers and those of some of the BSDs seem wary to bet the firm on GPLv3. Quite possibly, that's just caution.
The flip is not true.
Using GPL code in a BSD licensed project may not remain a BSD licensed project. The derivative work of a BSD and GPL mixing must be GPL.
So to take an example, someone could write a GCC patch that is licensed under BSD, and then later use the same patch in clang.
As for clang version, it looks to be 4.0.0 per https://github.com/openbsd/src/commit/53d771aafdbe5b919f264f...
> cc -v
OpenBSD clang version 4.0.0 (tags/RELEASE_400/final) (based on LLVM 4.0.0)
Target: amd64-unknown-openbsd6.1
Thread model: posix
InstalledDir: /usr/binI think I remember that they were even trying to move away from gcc to something home-grown and simpler, since gcc is such a huge dependency and even uses c++ now.
You remember pcc, "Portable C Compiler", which, though currently actively developed [0], has a not-so-dependable history. 1.0 released in 2011, 1.1 in 2014, and no releases since.
pcc was merged in, but with the spotty history, taken out of base again.
> Weren't the OpenBSD pretty clang-hostile a few years back?
Not quite. LLVM was evaluated for the main compiler back in 2013 [1], but the main drawbacks was LLVM can't be used for every platform that OpenBSD supports. They also go on to talk about how every open compiler is painful, because there are no LTS releases. Compiler bugs were a major problem for OpenBSD, and I doubt its changed enough for that to not be the case.
[0] Mailing list is still going strong, and patches are still coming in and merging. (http://marc.info/?l=pcc-list)
[1] Long read, but in-depth: http://marc.info/?l=openbsd-misc&m=137530560232232
OpenBSD has spent the last few years ensuring their code all builds with clang, and they support. All the add on software you might want to use also works well built in clang.
Except that you'll have to provide your real identity for copyright assignments. It may be hard create fake identities unless you are related to some big 3 letter agencies.