meta data for this page
  •  

parallel make

Compiling file: system_nrf52840.c
Linking target: ../../build_mouse-n_debug_mouse_proto_a0/mouse-n.out
"make" -s --no-print-directory -f "../../3rdParty/nrf5-sdk/components/toolchain/gcc/dump.mk" VARIABLE=CONTENT_TO_DUMP > ../../build_mouse-n_debug_mouse_proto_a0/mouse-n.in
'/builds/glorious/mouse-v3-bare/3rdParty/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-gcc' -mthumb -mabi=aapcs -L../../3rdParty/nrf5-sdk/modules/nrfx/mdk -T../../boards/mouse_proto_a0/nrf52840_mouse_proto_a0.ld -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs   -Wl,--print-memory-usage @../../build_mouse-n_debug_mouse_proto_a0/mouse-n.in -Wl,-Map=../../build_mouse-n_debug_mouse_proto_a0/mouse-n.map -o ../../build_mouse-n_debug_mouse_proto_a0/mouse-n.out
'/builds/glorious/mouse-v3-bare/3rdParty/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-size' ../../build_mouse-n_debug_mouse_proto_a0/mouse-n.out
make[2]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
arm-none-eabi-gcc: error: make[2]:: No such file or directory
arm-none-eabi-gcc: error: Entering: No such file or directory
arm-none-eabi-gcc: error: directory: No such file or directory
arm-none-eabi-gcc: error: make[2]:: No such file or directory
arm-none-eabi-gcc: error: Leaving: No such file or directory
arm-none-eabi-gcc: error: directory: No such file or directory
/builds/glorious/mouse-v3-bare/3rdParty/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-size: '../../build_mouse-n_debug_mouse_proto_a0/mouse-n.out': No such file
make[1]: Leaving directory '/builds/glorious/mouse-v3-bare/apps/mouse-n'
make[1]: *** [../../3rdParty/nrf5-sdk/components/toolchain/gcc/Makefile.common:292: ../../build_mouse-n_debug_mouse_proto_a0/mouse-n.out] Error 1
make: *** [Makefile:54: build-ci] Error 2
Cleaning up project directory and file based variables

NRF5 SDK uses dirty hack to dump list of object to link:

components/toolchain/gcc/Makefile.common
define dump
$(eval CONTENT_TO_DUMP := $(1)) \
"$(MAKE)" -s --no-print-directory \
-f "$(TEMPLATE_PATH)/dump.mk" VARIABLE=CONTENT_TO_DUMP
endef
export CONTENT_TO_DUMP

which is called by

components/toolchain/gcc/Makefile.common
GENERATE_LD_INPUT_FILE = $(call dump, $^ $(LIB_FILES)) > $(@:.out=.in)
LD_INPUT               = @$(@:.out=.in)

to generate e.g. `mouse-n.in` file with list of files to link:

mouse-n.in
../../build_mouse-n_debug_nrf52840dk/mouse-n/nrf_log_frontend.c.o
../../build_mouse-n_debug_nrf52840dk/mouse-n/nrf_log_str_formatter.c.o
</code>    
 
When make is used with parallelism enabled stdout is not
synchronised by default. So some output from previous make target is catched by above
macro which cause linker to show error.
Additional lines looks like:
<file txt mouse-n.in>
make[1]: Entering directory
../../build_mouse-n_debug_nrf52840dk/mouse-n/nrf_log_frontend.c.o
../../build_mouse-n_debug_nrf52840dk/mouse-n/nrf_log_str_formatter.c.o

Solution 1: NRF provides switch PASS_LINKER_INPUT_VIA_FILE to disable generation of intermediate file and let pass list of object to link as arguments. As side effects - long list of file with paths are printed.

Solution 2: Patch NRF SDK and add -O argument to $(MAKE) to enforce output synchronisation. See https://www.gnu.org/software/make/manual/html_node/Parallel-Output.html