-
Notifications
You must be signed in to change notification settings - Fork 144
[make] Fix parallel builds (by only building libc in parallel, for now) #2480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[make] Fix parallel builds (by only building libc in parallel, for now) #2480
Conversation
1e8ef0c to
5302cd8
Compare
5302cd8 to
cc6bb7c
Compare
|
I'm in agreement with you that I don't want to trust elkscmd/ makes to work in parallel, and the kernel doesn't either. IIRC, this was last changed with a contribution by @hexadec1mal, but I don't actually run parallel makes on macOS so I wasn't able to test it. Isn't there another (better) way of doing this rather than having to change so many Makefiles to use |
|
Change the make in libc/Makefile to what? It's the user who passes the number of concurrent jobs, typically in the environment variable Unfortunate as it may be, I think passing |
I'm not sure - I haven't looked at it much lately, and it's kinda complicated. You may know that I was thinking of something simpler than -j1 everywhere... how about perhaps storing the -j1 in the $(MAKE) variable, so that for almost everywhere it automatically defaults to -j1, and then (somehow) overriding MAKE= in libc/ only. It seems that in elks-root/, elks/ and elkscmd/, MAKE could/should be set to -j1 (as part of Makefile-rules?) and then change it all later when we finally get parallel makes working. (Or the reverse, assume non-parallel everywhere except libc).
How much faster does this actually make libc and/or other parts of the build that actually use parallel? I'm not against speeding things up, just trying to find/engineer something that isn't so ugly, and doesn't default all make's everywhere to have a -j1 added. If the speedups aren't significant, perhaps better to just fix the parallel make "problem" by undoing it. I'm not even sure libc parallel make is proven correct, TBH. |
This is with just libc parallelized; it really does take up a lot of time to build all its variants, and because each variant's code is self-contained in its own build directory, I expect it to not cause too many issues. (Of course, more testing is welcome)
I suppose one could |
|
After reading all this three times, I still can't figure out what the problem is at all. It compiles fine no matter the order and amount of parallel processes. Maybe that's a problem with a particular config? May you post the config here? |
|
Try Sometimes, I would instead get errors about |
No ideas why this was here. kernel/kernel.a target will create compiler-generated.h and then tools target compiling in parallel thread will delete it and version.c won't compile with error romfs.bin is generated by romfs target Also, why copy with cat command |
Yes, that file as well as asm-offsets.h are prone to races since they're generated anew every build. I'm not a big fan of it. And elks/tools needs to be built before everything else, but might be easily parallelized.
Perhaps we should adjust the kernel build for parallel operation now, in order to move this PR forward? The C library takes the longest to build by quite a bit - I almost never rebuild it and use As you mention, elkscmd/ is risky since someone's got to look though each of the app Makefiles. That should be fairly straightforward to cleanup using a few -j1's, with a quick look at some of the more complex Makefiles. (Ash comes to mind). Agreed that something needs to be done so that the Swan build actually works without error.
I like that direction rather than using -j1 everywhere. If the parallel problems are cleaned up, then perhaps we don't need many -j1's after all. |
I like using the cores of my laptop's processor. Unfortunately, the kernel Makefiles are not parallel-safe, and I don't trust
elkscmd/Makefileto parallelize well in all situations.This patch makes ELKS build correctly with
export MAKEFLAGS="-jN"forN > 1. It also allows building the libcs in parallel, which already speeds up the build a little for multi-core CPU users, and will translate to slight speed ups for GitHub CI, as well.Future work would include validating
elkscmd/Makefilefor proper parallel operation and patching the kernel Makefiles for the same.