intermezzOS / kernel

A hobby operating system, in Rust
http://intermezzos.github.io/
Apache License 2.0
1.39k stars 91 forks source link

Install all dependencies on macOS using Homebrew #101

Closed hawkw closed 6 years ago

hawkw commented 7 years ago

Closes #53.

This PR adds a Brewfile which, when used with Homebrew's brew bundle command, will install all the tools needed to build intermezzOS. I've also updated the documentation to match.

hawkw commented 7 years ago

I can also open a similar PR for intermezzOS/bare-bones, if you'd like?

hawkw commented 7 years ago

Well, the build broke, but I don't think it has anything to do with the changes in this PR – my Rust OS project's build broke on Travis with the same error. Looks like something changed upstream, maybe in xargo?

steveklabnik commented 7 years ago

Nice! @ashleygwilliams , maybe give this a try on your mac later to double check?

@hawkw I agree the failures seem strange; I'll try to investigate soon.

steveklabnik commented 7 years ago

oh look https://users.rust-lang.org/t/compile-failures-with-1-15-0-nightly-2016-11-14/8032

TL;DR: https://github.com/rust-lang/rust/issues/37786 will fix the build with the next nightly.

ashleygwilliams commented 7 years ago

cool- will take a look in a second!

hawkw commented 7 years ago

@ashleygwilliams thanks! I've got everything working on my machine, but of course that doesn't mean that it'll work everywhere – I'm eager to hear if it'll work for you, too.

N.B. that if you're not installing from the Brewfile, you need to pass the flags --with-x86_64-pc-elf --HEAD to brew install grub; the formula isn't 100% complete and won't install successfully unless you're on HEAD.

steveklabnik commented 7 years ago

Hey @hawkw , thanks again for this! Hoping to have some time for intermezzOS soon; it's been a busy few months.

hawkw commented 7 years ago

@steveklabnik, you're quote welcome! Do let me know if you hit any trouble.

ashleygwilliams commented 7 years ago

hey! just ran this on my mac, running 10.11.6 is full xcode a dependency of this brew script? previously it did not require full xcode. lemme know! thanks! and sorry the review has taken so long

Tapping hawkw/grub
Installing grub formula. It is not currently installed.
==> Installing grub from hawkw/grub
grub: A full installation of Xcode.app is required to compile this software.
Installing just the Command Line Tools is not sufficient.
Xcode can be installed from the App Store.
Error: An unsatisfied requirement failed this build.
Installing grub has failed!
Homebrew Bundle failed! 1 Brewfile dependencies failed to install.
Kernel.exit
Error: Kernel.exit
Ashleys-MacBook-Pro:kernel ag_dubs$
hawkw commented 7 years ago

@ashleygwilliams: there is a CI build set up for the x86-64-pc-elf-binutils tap: https://travis-ci.org/hawkw/homebrew-x86_64-pc-elf; I'll see about setting one up for grub as well.

steveklabnik commented 7 years ago

https://docs.travis-ci.com/user/multi-os/#Example-Multi-OS-Build-Matrix is probably a better link; @hawkw , we were thinking about the intermezzOS build itself, not just the sub-components. We don't have any testing so far, so in my opinion, doing that here isn't required, but it'd be a good thing to have.

I tried looking at your brew scripts and it wasn't obvious to me why it required the full XCode Tools...

hawkw commented 7 years ago

Oh, okay; I think I misunderstood what @ashleygwilliams meant. I'll see about adding an OS X build to the PR.

As for the XCode requirement, if I recall correctly, it was about the only way I could get Homebrew to use a version of gcc that could actually compile Grub. There might be a better way, but I believe this was the only way I could get it to work. On Sun, Jan 1, 2017 at 4:19 PM Steve Klabnik notifications@github.com wrote:

https://docs.travis-ci.com/user/multi-os/#Example-Multi-OS-Build-Matrix is probably a better link; @hawkw https://github.com/hawkw , we were thinking about the intermezzOS build itself, not just the sub-components. We don't have any testing so far, so in my opinion, doing that here isn't required, but it'd be a good thing to have.

I tried looking at your brew scripts and it wasn't obvious to me why it required the full XCode Tools...

hawkw commented 7 years ago

Okay, 02901a02874a710928c3f09269d1e4054a45c295 adds a macOS build to your .travis.yml.

The first macOS build will take within sigma of forever - building gcc is slow – but I've set it up to cache the Homebrew package directories so future builds shouldn't take quite so long.

steveklabnik commented 7 years ago

Ahhh this is great, thanks!

As for the XCode requirement, if I recall correctly, it was about the only way I could get Homebrew to use a version of gcc that could actually compile Grub.

Ahh interesting, so I wonder if the issue here is that when we build our own gcc, we can build grub, but when we use homebrew's gcc, we can't. I wonder if there's someone we can ask about this....

hawkw commented 7 years ago

@steveklabnik I suspect there might be another way to make Homebrew use a gcc that Grub's makefile doesn't balk at, but I don't know enough about Homebrew to make it work. Using Xcode's gcc is definitely not ideal, but it works for now...

steveklabnik commented 7 years ago

Two different people on twitter (one private) told me that setting HOMEBREW_CC= might be the answer

steveklabnik commented 7 years ago

So https://github.com/hawkw/homebrew-grub/blob/master/Formula/grub.rb#L25 is the line that requires it.

You had said that

it was about the only way I could get Homebrew to use a version of gcc that could actually compile Grub.

Do you remember the errors you got? Maybe we can fix them...

hawkw commented 7 years ago

@steveklabnik hmm, it was a while ago...there were a couple of checks in the configure script that were going wrong, depending on which CC it was getting - I don't remember precisely, sorry.

hawkw commented 7 years ago

The problem, as I remember it, is that "gcc" on the Mac is not unlike a box of chocolates...you never really know what you're gonna get. Stuff will claim to be gcc and actually be symlinked to clang, and so on, and Homebrew has a big wad of shims it injects into the build environment that just confuses this.

Tomorrow, I'll see if I can extract anything useful from the formula's commit history?

hawkw commented 7 years ago

hawkw/homebrew-grub@c9c0cc2cc4d43ad01abb661f801b73b18586fead removes the Xcode requirement to build grub – I tested it on my machine and it seems to work fine.

steveklabnik commented 6 years ago

guh. sorry that i am the worst and let this sit for over a year. I feel terrible. I'm trying to get back to a clean slate here, so sadly, i need to close this. I hope you got something out of this, sorry for failing you :(

hawkw commented 6 years ago

That's fine, don't worry about it --- I'm in more or less the same place with my hobby OS project. I think the homebrew taps are out of date anyway, but if you try using them again and have any issues, please let me know!