make[3]: execvp: /bin/sh: Argument list too long --Compilation Error
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
That is a bit confusing: the command you posted is not long [enough], that cannot produce the error message you posted.
Either that is not the full command line or that was another command (which produced that error) or it is about something completely different.
DEBUG: SITE files ['endian-little', 'bit-64', 'arm-common', 'arm-64', 'common-linux', 'common-glibc', 'aarch64-linux', 'common']
DEBUG: Executing shell function do_compile
NOTE: make -j 16 KERNEL_SRC=/home/feng/q/apps_proc/poky/build/tmp-glibc/work-shared/vt-64/kernel-source CONFIG_CNSS=n CONFIG_CLD_HL_SDIO_CORE=n CONFIG_CNSS_SDIO=n CONFIG_QCA_CLD_WLAN_PROFILE=default MODNAME=wlan_debug KERNEL_BUILD=y KERNEL_PATH=/home/feng/q/apps_proc/poky/build/tmp-glibc/work-shared/vt-64/kernel-source KERNEL_VERSION=4.14.117-perf CC=aarch64-oe-linux-gcc -fuse-ld=bfd -fdebug-prefix-map=/home/feng/q/apps_proc/poky/build/tmp-glibc/work/vt_64-oe-linux/qcacld32-ll-nf-debug/git-r8_qsap_perf_perf=/usr/src/debug/qcacld32-ll-nf-debug/git-r8_qsap_perf_perf -fdebug-prefix-map=/home/feng/q/apps_proc/poky/build/tmp-glibc/work/vt_64-oe-linux/qcacld32-ll-nf-debug/git-r8_qsap_perf_perf/recipe-sysroot= -fdebug-prefix-map=/home/feng/q/apps_proc/poky/build/tmp-glibc/work/vt_64-oe-linux/qcacld32-ll-nf-debug/git-r8_qsap_perf_perf/recipe-sysroot-native= -fdebug-prefix-map=/home/feng/q/apps_proc/poky/build/tmp-glibc/work-shared/vt-64/kernel-source=/usr/src/kernel LD=aarch64-oe-linux-ld.bfd AR=aarch64-oe-linux-ar O=/home/feng/q/apps_proc/poky/build/tmp-glibc/work-shared/vt-64/kernel-build-artifacts KBUILD_EXTRA_SYMBOLS=
make -C /home/feng/q/apps_proc/poky/build/tmp-glibc/work-shared/vt-64/kernel-source M=/home/feng/q/apps_proc/poky/build/tmp-glibc/work/vt_64-oe-linux/qcacld32-ll-nf-debug/git-r8_qsap_perf_perf/wlan/qcacld-3.0 modules WLAN_ROOT=/home/feng/q/apps_proc/poky/build/tmp-glibc/work/vt_64-oe-linux/qcacld32-ll-nf-debug/git-r8_qsap_perf_perf/wlan/qcacld-3.0 MODNAME?=wlan CONFIG_QCA_WIFI_ISOC=0 CONFIG_QCA_WIFI_2_0=1 CONFIG_QCA_CLD_WLAN=m
make[1]: Entering directory `/home/feng/q/apps_proc/poky/build/tmp-glibc/work-shared/vt-64/kernel-source'
make[2]: Entering directory `/home/feng/q/apps_proc/poky/build/tmp-glibc/work-shared/vt-64/kernel-build-artifacts'
/bin/sh: paste: command not found
fatal: ambiguous argument '~..HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
/bin/sh: paste: command not found
fatal: ambiguous argument '~..HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
/bin/sh: paste: command not found
fatal: ambiguous argument '~..HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
/bin/sh: paste: command not found
fatal: ambiguous argument '~..HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
/bin/sh: paste: command not found
fatal: ambiguous argument '~..HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
/bin/sh: paste: command not found
fatal: ambiguous argument '~..HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
/bin/sh: paste: command not found
fatal: ambiguous argument '~..HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
/bin/sh: paste: command not found
fatal: ambiguous argument '~..HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
CC [M] /home/feng/q/apps_proc/poky/build/tmp-glibc/work/vt_64-oe-linux/qcacld32-ll-nf-debug/git-r8_qsap_perf_perf/wlan/qcacld-3.0/core/hdd/src/wlan_hdd_main.o
make[3]: execvp: /bin/sh: Argument list too long
make[3]: *** [/home/feng/q/apps_proc/poky/build/tmp-glibc/work/vt_64-oe-linux/qcacld32-ll-nf-debug/git-r8_qsap_perf_perf/wlan/qcacld-3.0/wlan_debug.o] Error 127
make[2]: *** [_module_/home/feng/q/apps_proc/poky/build/tmp-glibc/work/vt_64-oe-linux/qcacld32-ll-nf-debug/git-r8_qsap_perf_perf/wlan/qcacld-3.0] Error 2
make[2]: Leaving directory `/home/feng/q/apps_proc/poky/build/tmp-glibc/work-shared/vt-64/kernel-build-artifacts'
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory `/home/feng/q/apps_proc/poky/build/tmp-glibc/work-shared/vt-64/kernel-source'
make: *** [all] Error 2
ERROR: oe_runmake failed
WARNING: /home/feng/q/apps_proc/poky/build/tmp-glibc/work/vt_64-oe-linux/qcacld32-ll-nf-debug/git-r8_qsap_perf_perf/temp/run.do_compile.2985:1 exit 1 from 'exit 1'
ERROR: Function failed: do_compile (log file is located at /home/feng/q/apps_proc/poky/build/tmp-glibc/work/vt_64-oe-linux/qcacld32-ll-nf-debug/git-r8_qsap_perf_perf/temp/log.do_compile.2985)
That is a bit confusing: the command you posted is not long [enough], that cannot produce the error message you posted.
Either that is not the full command line or that was another command (which produced that error) or it is about something completely different.
And now, if I delete half of the build OBJS,the building will be complete.
That's inexplicable!
The command caused the error is : "make -C /home/feng/q/apps_proc/poky/build/tmp-glibc/work-shared/vt-64/kernel-source M=/home/feng/q/apps_proc/poky/build/tmp-glibc/work/vt_64-oe-linux/qcacld32-ll-nf-debug/git-r8_qsap_perf_perf/wlan/qcacld-3.0 modules WLAN_ROOT=/home/feng/q/apps_proc/poky/build/tmp-glibc/work/vt_64-oe-linux/qcacld32-ll-nf-debug/git-r8_qsap_perf_perf/wlan/qcacld-3.0 MODNAME?=wlan CONFIG_QCA_WIFI_ISOC=0 CONFIG_QCA_WIFI_2_0=1 CONFIG_QCA_CLD_WLAN=m"
This is the command you entered, but it is NOT the command which got the error.
Make executes a number of commands. One of them had a long command line and generated the error. You need to address that error. You can add the "-d" option to have make generate debugging logs which will show all commands executed. Make will generate a lot of debug info. Capture it to a file (maybe use script) and look for the command with the error.
I've got this same problem with the same software. No fix yet, but I do know what is going on.
Quote:
Originally Posted by eager
This is the command you entered, but it is NOT the command which got the error.
Indeed this is the case. The actual problem command is buried inside the kernel's build system and is quite hard to find. But the reason it is too long is because the $(c_flags) variable is huge. This is huge because qualcomm's wifi driver has a poor design for its headers. They have 104 header directories in their source tree and they every single one of them is added to cflags with a -I option. It would have been better to put the path to a header in the #include line so they could just add a root dir. Or different design for their code that didn't involve every single file needing to search in 104 directories for headers.
Stick in 104 long absolute paths and it gets to be a big command. Then the kernel build rules, specifically rule_cc_o_c, will expand to a short script that includes the compilation flags more than once. Think something like
Code:
[ $old_c_flags != $c_flags ] && cc $c_flags
It gets to be HUGE.
Quote:
Originally Posted by eager
Fix this problem.
The git and paste errors are from the build system trying to compile in version info from git when it's not building from a git repo. They are unrelated.
diff --git a/Makefile b/Makefile
index fb78b03460..8fb24a3c84 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,23 @@ KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
# variable $(M). Allowing a relative path for $(M) enables us to have the build
# system put output/object files (.o, .ko.) into a directory different from the
# module source directory.
-M ?= $(shell pwd)
+ifeq ($(M),)
+AM = $(shell pwd)
+# Create CLD link to the directory above KERNEL_SRC to shorten object file
+# paths used in LD and CLEAN stage to avoid shell command "Argument list
+# too long" issue. If the link is created successfully, set M to link path,
+# else set M to the relative path from KERNEL_SRC to CLD path.
+CLD_LINK = $(KERNEL_SRC)/../qcacld-3.0
+MKLINK_RET = $(shell ln -nsf $(AM) $(CLD_LINK); echo $$?)
+
+ifeq ($(MKLINK_RET), 0)
+M = $(shell python -c "import os.path; print(os.path.relpath('$(CLD_LINK)',\
+ '$(KERNEL_SRC)'))")
+else
+M = $(shell python -c "import os.path; print(os.path.relpath('$(AM)',\
+ '$(KERNEL_SRC)'))")
+endif
+endif
# WLAN_ROOT must contain an absolute path (i.e. not a relative path)
KBUILD_OPTIONS := WLAN_ROOT=$(shell cd $(KERNEL_SRC); readlink -e $(M))
That's clever if you can write to the directory above the kernel source. realpath has a --relative-to=DIR option if it's new enough that could avoid the python script.
I ended up modifying to Kbuild file to place all the -I options into a file, "cat $(INCS) > $(obj)/includes", then used "@$(obj)/includes" in the cflags to have gcc pull them in from the file.
Similar problem trying to link 500+ object files into a single kernel module. I split it into three objects with about 200 files each, "$(wordlist 1,200,$(OBJS))", and then linked those into wlan.ko.
"shell realpath --relative-to" works for LE compilations, but not for Android build system, it's using toybox.
The problem here is while linking ~500 objects to wlan.ko, the single argv passed to syscall "execvp()" exceed MAX_ARG_STRLEN which normally equals to 128 KB in kernel fs/exec.c
Same issue while doing CLEAN stage, which arguments for "rm" command is bigger than LD, which has *.o and *.cmd files to remove.
The final fix should be in target kernel(msm-4.14) Makefile, use nested command arguments.
I'm having the same problem when building yocto project. The patch wlan/qcacld-3.0 doesn't work, still showing the same "argument list too long" error. Any idea how to solve it?
@xyzzy42, do you have a patch? It doesn't seem have the -l option in the Kbuild.
Well, I've run into same error while compiling one of the projects.
make: execvp: Argument list too long
The actual make/bash command I was able to retrieve by invoking 'dry run' for make: make -n V=s
After that I've got a command with a huge list of arguments like 700+ of them.
And actually the command could be run manually without any problems from the shell.
The case is that make do run commands passing it as a single enquoted argument like this: sh -ce '$(cmd)'
and that's where it fails (!)
According to execvp man page there is a limit for a length of a single argument defined as MAX_ARG_STRLEN and having maximum size of 128 kB.
So in my case the total length of a single argument provided by make was somewhat 138k (!)
Mostly because of quite long directory path for a project repeating seven hundred times.
After an attempt to shorten the project path (like making hard-link to it right from /home dir) I was able to shorten that huge argument in a half, and finally was able to build the project.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.