Fix the build issue on Mac OS

Here is a revert for b0defc225bf1dab7f1fb1d35198608e8fd1b88ed which apparently did not do any good, and a new fix for the issue.

This one is much simpler. Instead of creating the boot loader as a lambda, it is a separate, top-level, good old routine. If the bug was indeed caused by having a lambda, this should fix it.

@ggutierrez, can you please review this?