Skip to content

Parallel make race for lz4 build #18

@nbuwe

Description

@nbuwe

The lz4 submodule build is defined as:

criu/Makefile

Lines 248 to 253 in daeef8f

LZ4_OBJS = lz4/lib/liblz4.a criu/liblz4io.a
$(LZ4_OBJS) :
git submodule init
git submodule update
$(Q) env -i PATH=$$PATH make CC=$(CC) CFLAGS="$(CFLAGS)" -C lz4 lib lz4
$(Q) $(AR) rcs criu/liblz4io.a lz4/programs/lz4io.o

which is racy if parallel make is used. Since these two targets are independent (as defined), the make considers them to be suitable to run in parallel, so two identical make jobs will simultaneously run in the lz4 directory, stepping on each other toes. The likely result is a cryptic message from the linker in one of the jobs that tries to use an object file (that that job has previously built) while the other jobs starts writing to that same object file and truncates it. (The message is cryptic b/c linker tries to interpret an empty file as a linker script, but by the time you take a look, the other job has done writing out the object file, so it's seemingly back to normal).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions