1. 2

    Nice, I think there was a patch for chibicc that added inline asm support. The last bits are compiling a libc and kernel for either chibicc or cproc and we can have a full linux userland + kernel built without a C compiler implemented in C++.

    1. 3

      I mean, it sounds like there’s good reasons that GCC and LLVM are written in C++…

      1. 5

        Maybe it’s the same “arbitrary constraints are fun” mindset that drives a lot of stuff aroun here?

        Me, I’m working on an implementation of Doom in BCPL whose source code will not contain the letter “e”. Because reasons!

        1. 5

          To quote the cproc author:

          However, if you are asking why I’d want to be able to build the oasis userspace with a compiler written in 7000 lines of C as opposed to one written in 5 million lines of C++, then I don’t really know how to answer.

          Anyway…

          Do you regularly compile gcc or clang from source? Do you know how annoying it is to require more than 16GB of ram and 30 minutes a pop? Do you know how unnecessarily hard this makes bootstrapping a package tree/distro/architecture?

          It’s not arbitrary to want to reduce overall complexity of your computer system - especially removing projects too large for small teams to realistically maintain.

          If you can maintain your system with a small team you can side step huge amounts of bureaucracy and tailor the solutions to your own problems. I don’t think its arbitrary to want to avoid depending on projects out of your control.

          1. 3

            Those are valid points.

            However, I’d still worry whether these little compilers generate high quality code. Can they compete with all the work that goes into optimization in Clang/GCC? Saving time and/or space in the built product is worth some pain while building.

            Oh, and do they offer sanitizers? IMHO developing in C/++ these days without using address and UB sanitizers is foolhardy. Those things save my bacon so often. (Of course that only applies to the dev & test cycle, not deployment.)

            1. 4

              However, I’d still worry whether these little compilers generate high quality code.

              cproc generates code about on par with -O2 and sometimes -O1.

              Oh, and do they offer sanitizers? IMHO developing in C/++ these days without using address and UB sanitizers is foolhardy.

              I use these tools too, it would be nice to add, and there is no evidence that it would be impossible to do so in a reasonable amount of effort and code. As an example, tcc already comes with a bounds checking flag https://bellard.org/tcc/tcc-doc.html#Bounds.

              I would also say I think having simpler options doesn’t mean I advocate throwing away the advanced options when they make sense.

          2. 1

            thats awesome!

          3. 1

            such as? The only reason I can think of is because if you already use C++, it makes sense to have your C++ compiler in C++, and a C compiler (with a lot of baggage) sort of falls out by accident when you do this.

            To quote the cproc author:

            However, if you are asking why I’d want to be able to build the oasis userspace with a compiler written in 7000 lines of C as opposed to one written in 5 million lines of C++, then I don’t really know how to answer.

          4. 3

            we can have a full linux userland + kernel built without a C compiler implemented in C++

            Already done, with tcc. And doesn’t cproc still lack its own preprocessor?

            1. 2

              I don’t think tcc can build the linux kernel anymore.

              1. 2

                Indeed, due to missing asm goto. Clang had the same problem until a year or two ago.

          1. 1
            1. 3

              All the time. Frequently when I’m backpacking outdoors the code I’m working on invades my dreams. I don’t mind it, it motivates me to get to it when I get off the trail.

              1. 1

                I frequently experience insights when backpacking, or even day hiking. Its really nice to let my mind wander when I am going along a trail.

              1. 13

                As someone who doesn’t use SerenityOS, I’m most excited about their independent browser engine “LibWeb”. If I could easily run their web browser without installing their OS, I’d love to test my websites in it and make sure they’re compatible.

                That said, maybe I should go to the trouble of installing SerenityOS, now that it has a full time dev.

                1. 5

                  It is pretty easy to use. All I had to do was install the dependencies, then run the commands to compile it that were in the repo. It worked first try!

                  1. 2

                    It’s a 32-bit OS, right? Does that mean it won’t run properly on 64-bit hardware? Does it require emulation on modern CPUs? I’m not sure I have a computer that will run it natively.

                    1. 7

                      Its recommended to use it in qemu. It is possible to run on bare metal, but it is quite involved I think.

                1. 3

                  For those invested in setting up standalone 9front servers for cpu+auth (as in the OP), this video may be helpful as a walkthrough style reference: https://youtu.be/PjVpB3SpAfQ

                  1. 2

                    OP here. This seems super helpful, and it seems like it is basically in video form what I wrote in text form + how to install 9front. Thanks!

                    1. 2

                      You did great!

                      Love seeing 9 content :)