Why do I get permission denied when using make with j flag on Apple Silicon?

52 Views Asked by At

I have a simple make file that compiles a bunch of c files using /opt/homebrew/opt/llvm/bin/clang. I have two machines (an Intel Mac and and Apple M1 Max) both running macOS 12.7.3.

On the Intel Mac: Both make and "make -j8" compile all the files without issue and as expected.

On the Apple M1 Max: When I run make without any flags, it compiles all the files without problem. However, if run "make -j8", I get: make: /opt/homebrew/opt/llvm/bin/clang: Permission denied. If I run "sudo make -j8", then I do not get permission denied.

Why does running make with multiple threads give permission denied on Apple M1 Max but not Intel Macs even though both are running macOS 12.7.3 and both are using the same version of clang (17.0.6)?

I tried changing the owner and permissions on /opt/homebrew/opt/llvm/bin/clang. I tried many different make files (all have the same issue). I tried changing the number of threads. "-j1" works, but "-j2" and higher fail. I was expecting that the using the -j8 on the Apple M1 Max would simply use multiple threads to compile all the files more quickly. Could there be some security feature in the Apple M1 Max chips that prevents users from running multi-threaded jobs in the terminal? My account has admin privileges.

1

There are 1 best solutions below

0
tripleee On

Editor's note: I have moved this from the question into an answer, and marked the answer as Community-owned. OP, if you would rather post this as an answer of your own, leave a comment and ask me to delete this so it won't complete with your own answer.

Using gmake probably entails first installing it from Homebrew or etc.


On both systems:

zsh% type -a make
make is /usr/bin/make

zsh% make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0

When I switch to gmake, everything works properly on both machines. So the culprit is Apple's ancient make. Thanks to John Bolinger and MadScientist for pointing me in the right direction!