LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-22-2009, 10:15 PM   #1
sahil.jammu
Member
 
Registered: Jun 2008
Distribution: Ubuntu
Posts: 83

Rep: Reputation: 15
Argument list too long - Compilation Error


Hi All,

Im facing compilation problem. The compilation gives an error of "too many arguments" since there seem to be an OS limitation of command length in all the new OS versions. Compilation in current environment is kernel dependent and is not compatible with the one I am using 2.6.9-67

I figured out a work around for the same,I have an old machine which has an kernel version(2.4.21), i am using this machine for Compilation.

The process goes like this:-

I have 2 projects which needs to be linked and then I can generate library file (desired output).
Project 1 - > Compiled & build on 2.6.9
Linked with Project 2
Project 2 compilation on same kernel throws execvp: /bin/sh: Argument list too long

Workaround as temporary fix:-
Project 1 -> Compile and build on 2.6.9
Linked with project 2
Project 2 If builds on 2.4.21 – Success -> .a file generates successfully

I don’t want additional dependency on old kernel, and wanted to understand why there is dependency on old machine, compilation doesn’t passes in 2.6.9 and its successful in 2.4.21


execvp: /bin/sh: Argument list too long - This is a common problem which actually signifies limitation of OS, and exists for solaris and other distros also.

Error that comes in all other kernel versions except 2.4.21-40:-
------------
gmake[1]: Entering directory gmake[1]: execvp: /bin/sh: Argument list too long
gmake[1]: *** Error 127
gmake[1]: Leaving directory



I was checking some other links, and came across one suggestion :-

Link for workaround on similar Lines :-
http://kbase.redhat.com/faq/docs/DOC-2504

I don’t have root access and don’t want to change anything at kernel level, what I am really interested in is - > to do something within the project itself -> probably something regarding makefiles that will make the system independent of this additional dependency of kernel 2.4.21

Actual limitation is not on command length, but on command length + environment length.


Also I read somewhere if I clean environmental variables this may solve the problem

I read this as workaround, wanted to understand what this command is doing,

env - PATH=$PATH USER=$USER HOME=$HOME make

But even this had taken me to same error point.


Some programs (like newlib or glibc) generate long argument lists to add object files to archives. The makefile can be edited to covert a single invocation of a program (say, ar) to use xargs.

Kindly post your views and suggestions .
Many thanks in advance.


Cheers
Sahil
 
Old 07-23-2009, 01:59 AM   #2
sahil.jammu
Member
 
Registered: Jun 2008
Distribution: Ubuntu
Posts: 83

Original Poster
Rep: Reputation: 15
I checked /usr/include/linux/limits.h for both kernels :-

2.6.9.21 & 2.4.21
-----------------
#define ARG_MAX 131072 /* # bytes of args + environ for exec() */
#define CHILD_MAX 999 /* no limit :-) */
#define OPEN_MAX 256 /* # open files a process may have */
-----------------
Both the kernel have limit of 131 K.

Limit doesn't seems to be problem anymore, might be some internal change in the makefile is the required to split the compilation in 2 parts..never tried this before.
Any inputs plz........


Regards
Sahil
 
Old 07-23-2009, 04:03 AM   #3
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Should be read better you already tried

env - PATH=$PATH USER=$USER HOME=$HOME make

Last edited by Valery Reznic; 07-23-2009 at 04:06 AM.
 
Old 07-23-2009, 12:24 PM   #4
sahil.jammu
Member
 
Registered: Jun 2008
Distribution: Ubuntu
Posts: 83

Original Poster
Rep: Reputation: 15
Compared Shell output:-


Passing One on 2.4.21

COMPILE multimode_nws_tools/asn4sdt/src/a4stypeu.c [OK]
COMPILE multimode_nws_tools/asn4sdt/src/a4svalug.c [OK]
COMPILE multimode_nws_tools/asn4sdt/src/a4svar.c [OK]
LINK C bin/asn4sdt [OK]
ASN-SCRIPT wcdma_nws/sdl_3g/gun/build/ASN.1.done [common_ies transportchannel_m radiobearer_m userequipment_mcorenetwork_m physicalchannel_m measurement_m cellbroadcast_m ansi41_m intermediate_types_m rrcother_m utranmobility_m rrcmbms_m mac_ies mac_pdus mac_prims mac_hs_ies mac_hs_pdus mac_hs_prims rlc_ies rlc_pdus rlc_prims rlc_router_prims pdcp_prims bmc_prims mbms_prims data_pump_prims mdho_prims l1_prims pdcp_pdus pdcp_ies bmc_pdus rlc_const rrc_mbms_msgs rrc_mbms_pdus ] [CHECK OUTPUT]
STAMP wcdma_nws/sdl_3g/gun/build/common_iescop.c [OK]
COMPILE wcdma_nws/sdl_3g/gun/build/common_iescop.c [WARNINGS: 1]
STAMP wcdma_nws/sdl_3g/gun/build/transportchannel_mcop.c [OK]
COMPILE wcdma_nws/sdl_3g/gun/build/transportchannel_mcop.c [OK]



Failing one on bhswl101:-
COMPILE multimode_nws_tools/asn4sdt/src/a4svar.c [OK]
LINK C bin/asn4sdt [OK]
gmake[1]: execvp: /bin/sh: Argument list too long
gmake[1]: *** [wcdma_nws/sdl_3g/gun/build/ASN.1.done] Error 127
gmake[1]: Leaving directory

--- Thu Jul 23 18:43:52 IST 2009 --- END OF BUILD LOG for target gun


Few lines from Makefile:-
--------------
$(call MultiFileRule,$(CASN_TAG),$(CASN_COBJ) $(CASN_HOBJ),$(CASN_SRCS),\
$(MKPREFIL) $(CASN) $(ASN2C) $(ASN2PER) $(ASN4SDT),$(ASN_CMD),\
"ASN-SCRIPT $(CASN_TAG) [$(ASN1_MODULES_ALL)]")

//in the complete shell output - the casn , asn2c , asn2per , asn4sdt is working fine, problem is coming somewhere asn_cmd........!!

From the Makefile:-
---------------
define ASN_CMD
$(MKPREFIL) -option-file=$(OPT_FILE) $(ASN_PATH) $(ASN1_MODULES_ALL) && \
$(CASN) $(CASN_P_OPTS) $(ASN1_MODULES_ALL) && \
$(ASN2PER) $(ASN2PER_OPTS) $(ASN1_MODULES_ALL) && \
$(CASN) $(CASN_OPTS) $(ASN1_MODULES_ALL) && \
$(ASN2C) $(ASN2C_OPTS) $(ASN1_MODULES_ALL) && \
$(ASN4SDT) $(ASN4S_OPTS_P) $(ASN1_MODULES_P) && \
$(ASN4SDT) $(ASN4S_OPTS_B) $(ASN1_MODULES_B) Endef
---------------

The ASN1-Script output on the top in case of passing shell output suggests is contains 35 odd modules and there is && defined at each step.

(ASN-SCRIPT wcdma_nws/sdl_3g/gun/build/ASN.1.done [common_ies transportchannel_m radiobearer_m userequipment_mcorenetwork_m physicalchannel_m measurement_m cellbroadcast_m ansi41_m intermediate_types_m rrcother_m utranmobility_m rrcmbms_m mac_ies mac_pdus mac_prims mac_hs_ies mac_hs_pdus mac_hs_prims rlc_ies rlc_pdus rlc_prims rlc_router_prims pdcp_prims bmc_prims mbms_prims data_pump_prims mdho_prims l1_prims pdcp_pdus pdcp_ies bmc_pdus rlc_const rrc_mbms_msgs rrc_mbms_pdus ])


Hence this ASN_CMD is internally made of 7 sub commands and calling quite a lot of modules and hence there is a fair chance of crossing limit of 128K defined in limits.h I am thinking of splitting this part of makefile.

Any inputs from your side.........!!

Last edited by sahil.jammu; 07-24-2009 at 02:52 AM.
 
Old 07-24-2009, 01:19 AM   #5
sahil.jammu
Member
 
Registered: Jun 2008
Distribution: Ubuntu
Posts: 83

Original Poster
Rep: Reputation: 15
Any suggestions??
i want to split this one command into many to reduce the Argument list count.

For ex:-
define ASN_CMD1
$(MKPREFIL) -option-file=$(OPT_FILE) $(ASN_PATH) $(ASN1_MODULES_ALL) && \
endef

Like that - >
define ASN_CMD2
define ASN_CMD3........define ASN_CMD7
---------------
define ASN_CMD
$(MKPREFIL) -option-file=$(OPT_FILE) $(ASN_PATH) $(ASN1_MODULES_ALL) && \
$(CASN) $(CASN_P_OPTS) $(ASN1_MODULES_ALL) && \
$(ASN2PER) $(ASN2PER_OPTS) $(ASN1_MODULES_ALL) && \
$(CASN) $(CASN_OPTS) $(ASN1_MODULES_ALL) && \
$(ASN2C) $(ASN2C_OPTS) $(ASN1_MODULES_ALL) && \
$(ASN4SDT) $(ASN4S_OPTS_P) $(ASN1_MODULES_P) && \
$(ASN4SDT) $(ASN4S_OPTS_B) $(ASN1_MODULES_B) Endef
---------------

Few lines from Makefile:-
--------------
$(call MultiFileRule,$(CASN_TAG),$(CASN_COBJ) $(CASN_HOBJ),$(CASN_SRCS),\
$(MKPREFIL) $(CASN) $(ASN2C) $(ASN2PER) $(ASN4SDT),$(ASN_CMD1)$(ASN_CMD2)$(ASN_CMD3)$(ASN_CMD4) $(ASN_CMD5) $(ASN_CMD6) $(ASN_CMD7),\
"ASN-SCRIPT $(CASN_TAG) [$(ASN1_MODULES_ALL)]")


Any suggestion for Syntax...!!
 
Old 07-24-2009, 01:45 AM   #6
sahil.jammu
Member
 
Registered: Jun 2008
Distribution: Ubuntu
Posts: 83

Original Poster
Rep: Reputation: 15
Makefile change:-


define ASN_CMD1
$(MKPREFIL) -option-file=$(OPT_FILE) $(ASN_PATH) $(ASN1_MODULES_ALL)
endef

define ASN_CMD2
$(CASN) $(CASN_P_OPTS) $(ASN1_MODULES_ALL)
endef


define ASN_CMD3
$(ASN2PER) $(ASN2PER_OPTS) $(ASN1_MODULES_ALL)
endef

define ASN_CMD4
$(CASN) $(CASN_OPTS) $(ASN1_MODULES_ALL)
endef


define ASN_CMD5
$(ASN2C) $(ASN2C_OPTS) $(ASN1_MODULES_ALL)
endef

define ASN_CMD6
$(ASN4SDT) $(ASN4S_OPTS_P) $(ASN1_MODULES_P)
endef

define ASN_CMD7
$(ASN4SDT) $(ASN4S_OPTS_B) $(ASN1_MODULES_B)
endef



$(call MultiFileRule,$(CASN_TAG),$(CASN_COBJ) $(CASN_HOBJ),$(CASN_SRCS),\
$(MKPREFIL) $(CASN) $(ASN2C) $(ASN2PER) $(ASN4SDT),$(ASN_CMD1) $(ASN_CMD2) $(ASN_CMD3) $(ASN_CMD4) $(ASN_CMD5) $(ASN_CMD
6) $(ASN_CMD7) ,\
"ASN-SCRIPT $(CASN_TAG) [$(ASN1_MODULES_ALL)]")



After the change also I got same error :-

LINK C bin/asn4sdt [OK]
gmake[1]: execvp: /bin/sh: Argument list too long
gmake[1]: *** [wcdma_nws/sdl_3g/gun/build/ASN.1.done] Error 127
gmake[1]: Leaving directory

I would like to split call Multifile rule also , any inputs on that…
As it’s taking lot of arguments at one time:-

$(call MultiFileRule,$(CASN_TAG),$(CASN_COBJ) $(CASN_HOBJ),$(CASN_SRCS),\
$(MKPREFIL) $(CASN) $(ASN2C) $(ASN2PER) $(ASN4SDT),$(ASN_CMD1) $(ASN_CMD2) $(ASN_CMD3) $(ASN_CMD4) $(ASN_CMD5) $(ASN_CMD
6) $(ASN_CMD7) ,\
"ASN-SCRIPT $(CASN_TAG) [$(ASN1_MODULES_ALL)]")



Any inputs??????????
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
execvp: /bin/sh: Argument list too long - Compilation Error sahil.jammu Linux - Software 7 03-31-2020 08:32 AM
Kernel Specific Compilation - Argument list is too long sahil.jammu Linux - Server 1 05-02-2009 05:28 PM
Argument list too long error on Centos 5.1 xtremeclones Linux - Software 5 09-10-2008 07:46 PM
Combines 16000 files into 1 single file > error tb: /bin/cat: Argument list too long guanyu Linux - General 4 02-09-2007 12:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration