Clang update for macosxbootloader

I blogged about the new clang branch for the macosxbootloader three weeks ago and a couple days later I located a problem in the makefiles (missing -target argument) and Andy came up with a quick and dirty workaround. Now we can compile 32-bit targets and things are looking promising, but we need you – Mac Pro 1/2 folks – to confirm that this workaround, and our other changes, are working.

By the way. You don’t have to patch/compile clang yourself. You can, of course, but a patched version of clang is now also available from the tools directory. Called from the new makefiles so all you really have to do is enter make (and press enter) in a terminal window. That should do the trick i.e. compile boot.efi for you. After that you copy/bless boot.efi like before, but you should first use boot.efi on a bootable USB flash drive!

Let me know how it goes… and thanks for testing!

Edit: I updated the makefiles, twice already, to fix some issues but if there is anything else that is failing for you then please don’t hesitate and let me know.

I also fixed all clang analyser warnings in my local tree, for a next update, but I am still waiting for a confirmation – that the current clang branch works. Or not of course.

34 thoughts on “Clang update for macosxbootloader

    • Hi Geoff,

      That is pretty simple to explain: The master branch was setup for MS Windows and the new clang branch for OS X. The latter will also be the (my) main focus of current/future development.

  1. Hi Piker,

    just discovered two issues, when trying this on my MacPro 1,1, currently running 10.9.5 with tiamo’s boot loader:
    1. Paths to repository cannot contain “spaces” (my hard drive was ‘Mac HD’)
    2. I don´t have the standard include-files in ‘/usr/include/’ but within

    I am not sure, if I should link /usr/include to the Xcode path or am I missing something else ?

    • Hi,

      1.) The path errors caused by space characters should now be fixed. Thank you for mentioning this here!

      2.) What version of Xcode are you using? Did you copy the includes files yourself? I mean. I checked a 10.9.5 installation and fail to locate the include files there (with Xcode 6). What is the path of the include files? You can of course change the path (/usr/include) to see if that works.

      • I just installed Xcode 6.1.1 freshly from the App store, it included the command line tools in the package already. There is no ‘/usr/include’ on my System SSD, also not on the HD, where I have the user directories. This is the path within Xcode:
        There is another path for iPhoneOS and OSX10.10 (just replace OSX10.9 in above)
        Linking ‘/usr/include’ to the path above requires sudo, that´s why I am a little reluctant to do it until I fully understand the setup.
        Paths with spaces do work now, thanks for that quick fix 🙂

      • Oops. You are right. I searched for MacOSX10.10.sdk and did not find it, but the MacOSX10.9.sdk directory is there alright. Same path. My mistake. Thanks for this.

        p.s. Don’t forget the my master/clang branches are for Yosemite i.e. you should use the 10.10 SDK.

        Edit: The usr/include directory should now be fixed (selected by the main Makefile).

  2. Just went ahead and linked ‘/usr/include’ to ‘/Applications/’
    ‘Make’ created ‘bin/x86/Debug/boot.efi’ in the repository, size is 452612.
    Now I have to create my USB stick with Yosemite — could take a while as I don´t have an 8GB or bigger stick handy right now.

  3. I’ve been away for several weeks and I find this new CLANG branch. I’ve read some of the contributions made by several people, but I may have missed something important. Am I right in interpreting that the only thing needed is, apart from the source code of the project, to install the latest version of Xcode and then run “make” from a Terminal prompt? Am I missing something here? Is there any advantage right now in using the newly compiled CLANG branch over the old “Windows” master branch? Something like more speed, FileVault GUI or the like? Thanks.

    • Hi Peter,

      Yes. You should only need Xcode and run make from a terminal window. At least as far as I know now. The Clang branch is a first step, and may trigger more contributions from other developers. Like Andy, who already did some work to speed up the boot process and implemented a later revision of the Rijndael library, but neither of us has a 32-bit only EFI Mac to play with so we don’t have a clue about how far Clang compatibility goes. It compiles fine here, but that is as far as we can go with testing right now.

      Also. If the Clang branch doesn’t work for you, which I am going to assume until someone say it does, then Andy’s fork of my master branch may work.

      There is nothing new right now. No GUI for FileVault or anything, but we have to start somewhere for future development.

  4. I’ve just installed Xcode 6.1.1. I’ve also successfully built (via “make”) the CLANG project (not Andy’s). Curiously, the end result (boot.efi) has a size of 452,612 bytes, whereas my “own” “Win32 compiled version has a size of 313,344 bytes. Unfortunately, I don’t think I’ll be able to attempt booting with the newer (and larger) boot.efi until the weekend. I’ll report back with the results in a few days.

  5. If I build boot.efi on a Yosemite-capable Mac, and then install it in the appropriate places in my Mac Pro 1,1 should it work? I built the 32-bit version on my MBP running 10.10.2 and tried to boot my Mac Pro 1,1 with it and it hangs at boot. I normally use the “boot-grey” from the zip file that’s available on MacRumors, and it happily boots Yosemite for me, so I must be doing something wrong. I get a clean build.

    • I was kind of expecting this, sorry to say, but compiling the source code with Clang and converting it with mtoc can be very tricky. I’m sure that you didn’t do anything wrong, but that I missed something.

      Please try Andy’s fork of my master branch and see if that works. Thanks for testing!

      • The fork can be found here and all you need is the modified version of Clang, which you can copy from my Clang branch (see tools directory). Copy it into prebuilt and then you point CC (line 100) and CXX (line 101) in the Makefile to it (see line 106 for an example).

      • Sorry about that last (about Windows). I found it. It builds nicely — I’ll have some breakfast and then try to boot from it. Thanks for all your hard work!

      • Thanks. You guys are doing great work here, considering the age of the Mac Pro’s in question, and the limited number of people who’ll use your software. Thanks again.

  6. OK, not that I have much to report regarding how the new “clang” branch boot.efi works, but here’s what I’ve seen. The compilation was fine. Today I replaced the main branch of boot.efi of the Recovery Yosemite partition with the newer “clang” version (I didn’t want to mess up my normal Yosemite partition). Unfortunately, when I press Cmd-R, the Recovery partition no longer boots. The Mac Pro 1,1->2,1 just displays a grey background. No logo, no messages, no errors, no nothing.

  7. The newer build (1fdcfa6f2afa1e91e3abfdba4f8f8be66b8574db) has compiled fine. I might be able to test booting the computer with it by the end of the day or, in the worst-case scenario, by next Sunday. I’m sorry I can’t test this any sooner, but my only old Mac Pro is a production machine (reboots are necessarily infrequent). In case someone is able to promptly test drive the compiled boot.efi on one of these old computers, simply say so and I’ll upload the debug boot.efi to a public repository so you can report the results.

  8. I’ve just tried booting the Yosemite Recovery partition using the latest build of boot.efi, but no joy. Only a grey background appears. No messages, no progress bar, no logo. Nothing. Might I be doing something wrong?

  9. Hi, just wanted to confirm that current clang-branch build (default “make”, resulting in boot.efi with md5 “5000…aa8”) does not boot on MP1,1 / Mac-F4208DC8 / MP11.005C.B08.

    Also, I did not succeed in “make” without debug: replaced “DEBUG = 1” with “DEBUG = 0” in Makefile, results in

    [strip] boot.sys
    [mtoc] temp/x86/Release/boot.sys bin/x86/Release/boot.efi
    /Users/foo/Documents/pets/macosxbootloader/tools/mtoc: symbol table and string table not at the end of the file (can’t be processed) in file: /Users/foo/Documents/pets/macosxbootloader/temp/x86/Release/boot/boot.sys
    make[1]: *** [boot.sys] Error 1
    make: *** [boot] Error 2

    If there is any help/output I can provide, let me know!

  10. Dear MacPro1,1 macosxbootloader community,

    Is there any update on the working (or not) of the clang branch to boot 10.11 El Capitan on a MacPro1,1? I compiled the 452612 byte debug version on the current branch… It compiles fine, but also does not boot (no messages, just hangs on plain screen).

    pikeralpha, do you already have any ideas in which part of the code (or compiler patching) the process might fail? I tried Andy’s current version too, without success, but that one is a fat binary anyway.

    Many thanks for your great work, much appreciated!

    • Hi,

      Clang support is (still) broken. You need to use the master branch. Reported to work with El Capitan, but an update will be available before the GM is released.

  11. just a note to self> El Capitan DP4–6 booting on MacPro1,1 with the most recent master (not clang) boot.efi build (Release Win32) works fine on a normal volume, but not on a CoreStorage, CoreStorage Fusion, or ex FileVault volume (even if decrypted, resulting in a “Sparse,Fusion” CoreStorage volume) …

    Debug version of Master branch does not work (hangs).

    Release version used to work on CoreStorage encrypted Fusion Drive … Something must have happened since El Capitan DP >1

    Symptoms are the same: either hung on single cursor screen without booting, or showing Apple Logo, then flashing/intermittent “broken folder symbol”, followed by hung efi boot ….

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s