graydon2: (Default)
[personal profile] graydon2
Elsewhere I've been asked about the task of replaying the bootstrap process for rust. I figured it would be fairly straightforward, if slow. But as we got into it, there were just enough tricky / non-obvious bits in the process that it's worth making some notes here for posterity.

UPDATE: someone has also scripted many of the subsequent snapshot builds covering many years of rust's post-bootstrap development. Consider the rest of this post just a verbose primer for interpreting their work.

context


Rust started its life as a compiler written in ocaml, called rustboot. This compiler did not use LLVM, it just emitted 32-bit i386 machine code in 3 object file formats (Linux PE, macOS Mach-O, and Windows PE).

We then wrote a second compiler in Rust called rustc that did use LLVM as its backend (and which, yes, is the genesis of today's rustc) and ran rustboot on rustc to produce a so-called "stage0 rustc". Then stage0 rustc was fed the sources of rustc again, producing a stage1 rustc. Successfully executing this stage0 -> stage1 step (rather than just crashing mid-compilation) is what we're going to call "bootstrapping". There's also a third step: running stage1 rustc on rustc's sources again to get a stage2 rustc and checking that it is bit-identical to the stage1 rustc. Successfully doing that we're going to call "fixpoint".

Shortly after we reached the fixpoint we discarded rustboot. We stored stage1 rustc binaries as snapshots on a shared download server and all subsequent rust builds were based on downloading and running that. Any time there was an incompatible language change made, we'd add support and re-snapshot the resulting stage1, gradually growing a long list of snapshots marking the progress of rust over time.

time travel and bit rot


Each snapshot can typically only compile rust code in the rust repository written between its birth and the next snapshot. This makes replaying the entire history awkward (see above). We're not going to do that here. This post is just about replaying the initial bootstrap and fixpoint, which happened back in April 2011, 14 years ago.

Unfortunately all the tools involved -- from the host OS and system libraries involved to compilers and compiler-components -- were and are moving targets. Everything bitrots. Some examples discovered along the way:

  • Modern clang and gcc won't compile the LLVM used back then (C++ has changed too much -- and I tried several CXXFLAGS=-std=c++NN variants!)
  • Modern gcc won't even compile the gcc used back then (apparently C as well!)
  • Modern ocaml won't compile rustboot (ditto)
  • 14-year-old git won't even connect to modern github (ssh and ssl have changed too much)


debian


We're in a certain amount of luck though:

  • Debian has maintained both EOL'ed docker images and still-functioning fetchable package archives at the same URLs as 14 years ago. So we can time-travel using that. A VM image would also do, and if you have old install media you could presumably build one up again if you are patient.
  • It is easier to use i386 since that's all rustboot emitted. There's some indication in the Makefile of support for multilib-based builds from x86-64 (I honestly don't remember if my desktop was 64 bit at the time) but 32bit is much more straightforward.
  • So: docker pull --platform linux/386 debian/eol:squeeze gets you an environment that works.
  • You'll need to install rust's prerequisites also: g++, make, ocaml, ocaml-native-compilers, python.


rust


The next problem is figuring out the code to build. Not totally trivial but not too hard. The best resource for tracking this period of time in rust's history is actually the rust-dev mailing list archive. There's a copy online at mail-archive.com (and Brian keeps a public backup of the mbox file in case that goes away). Here's the announcement that we hit a fixpoint in April 2011. You kinda have to just know that's what to look for. So that's the rust commit to use: 6daf440037cb10baab332fde2b471712a3a42c76. This commit still exists in the rust-lang/rust repo, no problem getting it (besides having to copy it into the container since the container can't contact github, haha).

LLVM


Unfortunately we only started pinning LLVM to specific versions, using submodules, after bootstrap, closer to the initial "0.1 release". So we have to guess at the LLVM version to use. To add some difficulty: LLVM at the time was developed on subversion, and we were developing rust against a fork of a git mirror of their SVN. Fishing around in that repo at least finds a version that builds -- 45e1a53efd40a594fa8bb59aee75bb0984770d29, which is "the commit that exposed LLVMAddEarlyCSEPass", a symbol used in the rustc LLVM interface. I bootstrapped with that (brson/llvm) commit but subversion also numbers all commits, and they were preserved in the conversion to the modern LLVM repo, so you can see the same svn id 129087 as e4e4e3758097d7967fa6edf4ff878ba430f84f6e over in the official LLVM git repo, in case brson/llvm goes away in the future.

Configuring LLVM for this build is also a little bit subtle. The best bet is to actually read the rust 0.1 configure script -- when it was managing the LLVM build itself -- and work out what it would have done. But I have done that and can now save you the effort: ./configure --enable-targets=x86 --build=i686-unknown-linux-gnu --host=i686-unknown-linux-gnu --target=i686-unknown-linux-gnu --disable-docs --disable-jit --enable-bindings=none --disable-threads --disable-pthreads --enable-optimized

So: configure and build that, stick the resulting bin dir in your path, and configure and make rust, and you're good to go!
root@65b73ba6edcc:/src/rust# sha1sum stage*/rustc
639f3ab8351d839ede644b090dae90ec2245dfff  stage0/rustc
81e8f14fcf155e1946f4b7bf88cefc20dba32bb9  stage1/rustc
81e8f14fcf155e1946f4b7bf88cefc20dba32bb9  stage2/rustc


Observations


On my machine I get: 1m50s to build stage0, 3m40s to build stage1, 2m2s to build stage2. Also stage0/rustc is a 4.4mb binary whereas stage1/rustc and stage2/rustc are (identical) 13mb binaries.

While this is somewhat congruent with my recollections -- rustboot produced code faster, but its code ran slower -- the effect size is actually much less than I remember. I'd convinced myself retroactively that rustboot was produced abysmally worse code than rustc-with-LLVM. But out-of-the-gate LLVM only boosted performance by 2x (and cost of 3x the code size)! Of course I also have a faster machine now. At the time bootstrap cycles took about a half hour each (according to this: 15 minutes for the 2nd stage).

Of course you can still see this as a condemnation of the entire "super slow dynamic polymorphism" model of rust-at-the-time, either way. It may seem funny that this version of rustc bootstraps faster than today's rustc, but this "can barely bootstrap" version was a mere 25kloc. Today's rustc is 600kloc. It's really comparing apples to oranges.

Shelf status

Jun. 11th, 2025 08:32 pm
azurelunatic: Vivid pink Alaskan wild rose. (Default)
[personal profile] azurelunatic
Three shelves (10' length, more or less) have been assembled, put up on the north wall, and filled to great effect. This emptied 1 entire Billy (with slight double stacking). We therefore need bookends.

The empty Billy is now in the living room, with the top few shelves embookinated and various plastic craft-adjacent boxes on the lower shelves. This is making a significant dent in the chaos by my desk.

The shorter bookshelf is currently at the end of the hall, for lack of a better place to put it. I expect that if it stays there long, I will start racking up another set of incredible bruises, and I still don't know where the one on my right arm CAME from. (I remember that I walked into some corner on my sleepy and unstable way to bed and then went "well, THAT'll leave a mark!" but do I remember what that something WAS? No more than I remembered what things I'd rammed into when I was taking Drama in high school, and my legs were forever dotted with black and blue marks.)

Today after work, Belovedest has put up all the standards (upright rails) on the south wall, embracketed them with however many brackets we currently have, and has started to assemble board pieces into full length shelves.

Coincidentally, today I also got a notification from the hardware store that they are shipping the backordered brackets.

There is one free-loving* free-standing bookshelf remaining in the room, where it is cheerfully getting in the way. I suggested a different method of assembly which neither requires turning the boards lengthwise nor doing the assembly behind the Billy, which suggestion was well-received.

Eventually there will be enough Shelf in the media room that some of the things taking up floor space will be able to go on them.

Today I roused in the morning long enough to feel bleugh, then woke up in the afternoon feeling competent to Lounge. Still craving bacon at intervals.


* My high school freshman Biology class had a crucial typo in a sentence about free-living organisms. We reacted about how you'd expect.
terriko: (Default)
[personal profile] terriko
This is crossposted from Curiousity.ca, my personal maker blog. If you want to link to this post, please use the original link since the formatting there is usually better.


Trying two new inks this month, and a new book cover for my journal! Also, if you’ve got tips for using shimmer inks better, one of my pens is already acting a bit clogged and we’re not even two weeks into the month, so I’d be happy to hear any advice!





Journal supplies including fountain pens, ink swatches, stickers, the actual journal and calendar I use, a pouch for holding pens and another for stickers, and a new green cover for my thin softcover journal.  More details in post.




New stuff





I picked up a KOKUYO journal cover for my current softcover journal. I also picked up a KOYUKO campus A5 calendar that will fit in there with it, in preparation for the end of summer when I need a new calendar. I keep an academic year calendar partially due to my own habit (getting a PhD and then doing a postdoc means I spent a lot of years in school) and also because I have a kid in school now so it’s nice to be able to have his whole school year on hand when planning stuff. The cover adds just enough extra rigidity to the setup to make it easier for me to write journal entries when I’m not using a flat surface, which is honestly most of the time for me as I typically write entries on my lap when I think of stuff. I’d previously been using writing boards for this but they tend to slip out so I think it’ll be less hassle overall. The only problem is that it’s just enough bigger that I can’t fit my pen case and journal into the same A5 pouch I’d been using, but that hasn’t annoyed me as much as I thought it would. I don’t think I’ve reached what I consider a *perfect* setup yet, but I definitely feel like the cover is a good addition.





The two KWZ inks are new: Firecracker is another “all that glitters” ink with the very small shimmer particles that make it more like a metallic gel pen than my other inks. I love it so much. BUT I will note that I used another ink from this line in my TWSBI Eco and had a lot of sparkle residue left over in the feed that caused mild problems, so I made sure to use this in a converter pen that should be easier to flush.





Gummiberry is less exciting as far as inks go, just me trying out a slightly brighter purple because I’ve learned that I mostly find darker inks disappointing. I didn’t pick up this hobby to then have writing that I could get with just any pen. I want bright colours, sparkle, drama! But I’ve been having a rough time with shimmer inks lately (possibly because I’m writing more on the computer and less by hand) so I’m trying to enjoy some options that are less of a hazard. This one is nice and I like it.





I picked up a second Kaweco Sport pen with a broad nib (it’s the yellow one) and got a calligraphy nib for my existing blue pen. The broad nib is an utter delight with the Firecracker ink. It feels absurdly smooth and looks beautiful. The 1.1mm calligraphy nib seems to be a bit less forgiving for everyday writing than my existing stub nibs, but it’s kind of fun when I use it right. I suspect, again, that I’m having more trouble with it because of the shimmer ink I’m using — lots of small skipping problems with the ink flow. But I’ve seen a few reviewers comment that the feed has trouble keeping up with the wider calligraphy nibs on this pen so it might not be the ink, I don’t know. I’ll try it on something less sparkly eventually. I like the size of the Kaweco Sport because I’ve got small hands but also because the tiny converter makes it closer to the amount of ink I actually use in a month. Who knew I’d be so into small converters?





Not new but I don’t think I talked about it before: I picked up a Lihit Labs “Compact” pencil case to hold my pens so they wouldn’t get so scratched up (the reason my existing Kaweco hasn’t been in rotation was that it was getting kind of beat up in my previous pencil case). A lot of the pen cases I looked at were very expensive and lots of them were made of leather. I like leather in general, but it’s heavy and seemed likely to get really torn up the way my journal supplies wind up in the bottom of my knitting bag that I then carry around the house all the time. This was reasonably priced and solves the problem, though I likely want to find a thinner eraser-pen thing so it fits in there, because my existing eraser has a bulky little case and honestly I mostly erase tiny calendar stuff so smaller would be fine.





Stickers






  • purple bunnies from TheLatestKate’s patreon




  • bunnies and books from PinkPafu via stickii




  • bunnies and flowers from Dai and Qin via stickii





I think both the stickii ones were from this year’s advent. I’ve been thinking about advents since the yarn ones are starting preorders now, and I think I’d probably do the stickii one again, but I’m less sure about the Diamine ink one because I definitely won’t have made as much of a dent in using the inks as I have the stickers unless I start writing a lot more. But the inks were more fun actually *in* December than the stickers were because I enjoyed all the swatching. It may be all a moot point as work is figuring out layoffs right now so who knows if I’ll even have a job to be spending money on advent stuff, but I find it good to think about these things in advance so I don’t get trigger happy when things come up for pre-order.





Fountain Pens & Inks






  • Kaweco sport <b> – KWZ All That Glitters – Firecracker

    • an orange-red ink with gold shimmer. More like a metallic gel pen than most shimmer inks. The “gimmick” is that it’s suppose to need less agitation and it’s true. I find it a lot easier to use as an everyday writing ink.






  • Kaweco sport <1.1> – Diamine – Pine Needle.

    • Green that honestly isn’t quite like either new or old pine needles, but it’s a nice colour anyhow. Lots of gold/green shimmer. Was an absolute dream to use the day after I put it in the pen, but I think the feed is slowly clogging up with the shimmer because it’s already getting less fun to use. I’ll probably try to use it more for my todo list/craft tracking and see if the problem is mostly that it’s getting used every 4 days instead of more often, but it may just need more agitation before I try writing.






  • Pilot E95S <m> – Pilot Iroshizuku – kon peki

    • A repeat from last month. Still the nicest nib I own and I love using it.






  • Pilot Metropolitan <cm> (not pictured because it was getting cleaned) – KWZ Gummiberry

    • A nice bright purple with a bit of shading. Easy to use.



The Shelves

Jun. 7th, 2025 09:20 pm
azurelunatic: Operation 'This will most likely end badly' is a go. (end badly)
[personal profile] azurelunatic
I got the standards and brackets for that shelf system, and we are currently at Home Depot, after buying what I sincerely hope is the right configuration of board feet for eight shelves. It's secured to the roof and we're using surface streets.

It's too close to bedtime to start on repair plating the 8 foot boards to the 2 foot boards, probably.
jesse_the_k: Head inside a box, with words "Thinking inside the box" scrawled on it. (thinking inside the box)
[personal profile] jesse_the_k

99pi.org/adapt

Kurt Kohlstedt has spent ten years creating audio and print stories for the design podcast, 99% Invisible. He also co-authored the 99% Invisible City book.

Last year, 99pi’s Kurt Kohlstedt suffered a severe injury that incapacitated his right arm and dominant hand. In the aftermath, new everyday challenges led him to research, test, and evolve accessible design solutions. These experiences set the stage for Adapt or Design, a twelve-part project of 99% Invisible in three acts, available at the short link 99pi.org/adapt

The Adapt or Design series includes many groan-worthy puns related to hands; six essays exploring assistive designs for people with one functional hand; three design hacks and mods that helped Kurt manage long-term rehabilitation; and three final essays diving deep into adaptive writing technologies including a free one-handed "mirror keyboard" for Windows PowerToys.

While the first article posted in April, I just heard about it via the 99% Invisible podcast 630, where Kurt and Roman talk about all these things.

altamira16: A sailboat on the water at dawn or dusk (Default)
[personal profile] altamira16
Britney Griner is 6'9". At the beginning of this book, she is rushing with her bags out the door to catch a plane to Russia to play basketball. She forgot some nearly empty vapes in her bag, and that leads to being incarcerated in Russia for nine months. Her passport is confiscated at the airport. She is moved to pretrial detention, and she has to return to court over and over until trial and sentencing.

Because she is such a tall person, nothing fits. Her legs hang off the end of the bed until they make a bed that is the correct size for her. The gulag uniforms don't fit until she has a seamstress who makes her a new one.

After reading this and To Build a Castle by Vladimir Bukovsky, I am pretty sure that to survive your time in a Russian gulag, you are just supposed to take up chain smoking. It is mandatory.

She lost nearly thirty pounds while in the gulag.

Her wife Cherelle, the WNBA, and others advocated for her release, and it was great to see the love of the community shine through. But in Russia, lesbianism seems to be treated like a mental disorder so everyone is incredulous that she has a wife.

Her wife was finishing law school and attempting to pass the bar exam while advocating for Griner's release.

I thought that this book was really well done, and the warmth of Griner and her community balanced out the part about being in a Russian gulag.

Things said to cats

Jun. 4th, 2025 12:21 pm
azurelunatic: Hacker-Kitty (aka Yellface) snuggling with Azz. (Hacker-Kitty)
[personal profile] azurelunatic
Cat: "Me-ow!"
Me: "Me-ow! You-ow! We all ow!"
azurelunatic: Vivid pink Alaskan wild rose. (Default)
[personal profile] azurelunatic
The usual mess of interesting things I've read, most of them quite out of date, in approximate order of my having read them. Brought to you by my browser crashing twice when I tried to start it after my most recent reboot.

As always, I use Export Tabs to wrangle this. And maybe my current 1,625 tab count will decrease some after I close all these?
https://chromewebstore.google.com/detail/export-tabs/odafagokkafdbbeojliiojjmimakacil?hl=en

Some good news from the south:
Woman who went on the lam with untreated TB is now cured | Ars Technica
https://arstechnica.com/science/2024/07/woman-who-went-on-the-lam-with-untreated-tb-is-now-cured/

Mechanical Watch – Bartosz Ciechanowski
https://ciechanow.ski/mechanical-watch/

How a North Korean Fake IT Worker Tried to Infiltrate Us
https://blog.knowbe4.com/how-a-north-korean-fake-it-worker-tried-to-infiltrate-us

How I Got My Laser Eye Injury - Funranium Labs
https://www.funraniumlabs.com/2024/07/how-i-got-my-laser-eye-injury/

Read more... )

Profile

radhardened

January 2022

S M T W T F S
       1
2345678
9101112131415
16171819202122
23242526272829
3031     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 17th, 2025 02:21 am
Powered by Dreamwidth Studios