Re: Gnu make option to fix parallel multiple ar on a shared archive

2024-08-12 Thread Kaz Kylheku
On 2024-08-11 13:09, Philip Guenther wrote: > On Sun, Aug 11, 2024 at 11:31 AM Kaz Kylheku wrote: >> Idea: fix the code generator so that for each rule that updates >> an archive, it uses a unique name for the archive specific to that >> rule. Perhaps by using numbers: libfoo.001.a, libfoo.002.a

Re: Gnu make option to fix parallel multiple ar on a shared archive

2024-08-12 Thread Paul Smith
On Sun, 2024-08-11 at 11:30 -0700, Kaz Kylheku wrote: > Then, the generator must also emit a new rule like this If you can change the makefile then I don't see why the very simple solution provided in the GNU Make manual wouldn't just be used instead of inventing something complex. You can even d

Re: Gnu make option to fix parallel multiple ar on a shared archive

2024-08-11 Thread Philip Guenther
On Sun, Aug 11, 2024 at 11:31 AM Kaz Kylheku wrote: > > On 2024-08-10 22:37, Philip Guenther wrote: > > I think the correctness concern is that this provides mutual exclusion > > for ar only. Other programs may be reading the .a, including make > > itself. If your system's ar does atomic updates

Re: Gnu make option to fix parallel multiple ar on a shared archive

2024-08-11 Thread Kaz Kylheku
On 2024-08-10 22:37, Philip Guenther wrote: > I think the correctness concern is that this provides mutual exclusion > for ar only. Other programs may be reading the .a, including make > itself. If your system's ar does atomic updates (write new temp file, > rename over existing .a) then the read

Re: Gnu make option to fix parallel multiple ar on a shared archive

2024-08-10 Thread Philip Guenther
On Sat, Aug 10, 2024 at 8:16 PM Navin P wrote: > > On Sun, Aug 11, 2024, 06:29 Kaz Kylheku wrote: > > > Your makefile is broken, or at least not suitable for parallel builds. > > > > You should add .NOTPARALLEL: to it. That's the minimal change that will > > fix it. A makefile with the .NOTPARALL

Re: Gnu make option to fix parallel multiple ar on a shared archive

2024-08-10 Thread Navin P
On Sun, Aug 11, 2024, 06:29 Kaz Kylheku wrote: > Your makefile is broken, or at least not suitable for parallel builds. > > You should add .NOTPARALLEL: to it. That's the minimal change that will > fix it. A makefile with the .NOTPARALLEL: target will not be parallelized > even if -j is requested

Re: Gnu make option to fix parallel multiple ar on a shared archive

2024-08-10 Thread Kaz Kylheku
Your makefile is broken, or at least not suitable for parallel builds. You should add .NOTPARALLEL: to it. That's the minimal change that will fix it. A makefile with the .NOTPARALLEL: target will not be parallelized even if -j is requested on the command line or via the environment. Why it's b

Re: Gnu make option to fix parallel multiple ar on a shared archive

2024-08-10 Thread Dmitry Goncharov
On Sat, Aug 10, 2024 at 8:51 AM Navin P wrote: >I ran multiple instances of ar during a parallel build and they were > updating different object files using ar rv sometimes the same object file > again. https://www.gnu.org/software/make/manual/make.html#Archive-Pitfalls regards, Dmitry

Gnu make option to fix parallel multiple ar on a shared archive

2024-08-10 Thread Navin P
Hi, I ran multiple instances of ar during a parallel build and they were updating different object files using ar rv sometimes the same object file again. When i run make -j1 i find all the object files libx.a but when i do make -j8 i find some missing object files inside libx.a. Then i looke