public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Query on GCC command options size limit
@ 2021-08-31  6:42 Luo Xinsheng SGH ADWA4
  2021-08-31  8:03 ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Luo Xinsheng SGH ADWA4 @ 2021-08-31  6:42 UTC (permalink / raw)
  To: gcc-help

Dear sir:

Now I am using GCC to compile a series .c file with a huge directory to search for header files.

I find on GCC command options, there seems to be the size limit on provided options.
From my test on GCC version 4.8.5, the options length which I can provide seems to be limited at 12000 characters.

Can you share the size limit of GCC command options?



Best Regards
----------------------------------------------------
Martin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Query on GCC command options size limit
  2021-08-31  6:42 Query on GCC command options size limit Luo Xinsheng SGH ADWA4
@ 2021-08-31  8:03 ` Jonathan Wakely
  2021-09-01 12:50   ` Luo Xinsheng SGH ADWA4
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2021-08-31  8:03 UTC (permalink / raw)
  To: Luo Xinsheng SGH ADWA4; +Cc: gcc-help

On Tue, 31 Aug 2021, 07:43 Luo Xinsheng SGH ADWA4 via Gcc-help, <
gcc-help@gcc.gnu.org> wrote:

> Dear sir:
>
> Now I am using GCC to compile a series .c file with a huge directory to
> search for header files.
>
> I find on GCC command options, there seems to be the size limit on
> provided options.
> From my test on GCC version 4.8.5, the options length which I can provide
> seems to be limited at 12000 characters.
>
> Can you share the size limit of GCC command options?
>


I think the limit probably comes from the shell, not from GCC.

You can use the @file option to pass extra options to GCC in a file,
instead of on the command line. See the last option in the page at:
https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/Overall-Options.html




>
>
> Best Regards
> ----------------------------------------------------
> Martin
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Query on GCC command options size limit
  2021-08-31  8:03 ` Jonathan Wakely
@ 2021-09-01 12:50   ` Luo Xinsheng SGH ADWA4
  2021-09-01 13:20     ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Luo Xinsheng SGH ADWA4 @ 2021-09-01 12:50 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-help

Hi Jonathan:

Are there some examples for this @file using in GCC command option?

Locally we usually create makefile and call GCC to compile similar as below script:

# Collect GCC options (include dirs, defines etc.)
CC := gcc
CC_OPTS := -c -ggdb3 -std=gnu99 -Winline -w -fgnu89-inline -g -fomit-frame-pointer
CC_OPTS += -include Platformtypes_Stubs.h
CC_OPTS += $(foreach d, $(INCDIRS), -I$d)
CC_OPTS += $(foreach p, $(INCDIRS_PTU), -I$d)
CC_OPTS += $(foreach d, $(DEFINES), -D$d)
# Options for static library build
AR := ar
AR_OPTS := rcs

$(OBJDIR)/%.o: $(OBJDIR)/%.c
      @echo Compiling: $(<F)
      @$(CC) $(CC_OPTS) $< -o $@

Now on above script, we find GCC command option in CC_OPTS content is too huge(About 12000 bytes inside) and it can not be analyzed totally in gcc command.


Regards,

----------------------------------------------
Martin

From: Jonathan Wakely <jwakely.gcc@gmail.com>
Sent: 2021年8月31日 16:03
To: Luo Xinsheng SGH ADWA4 <xinsheng.luo@zf.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Query on GCC command options size limit


On Tue, 31 Aug 2021, 07:43 Luo Xinsheng SGH ADWA4 via Gcc-help, <gcc-help@gcc.gnu.org<mailto:gcc-help@gcc.gnu.org>> wrote:
Dear sir:

Now I am using GCC to compile a series .c file with a huge directory to search for header files.

I find on GCC command options, there seems to be the size limit on provided options.
From my test on GCC version 4.8.5, the options length which I can provide seems to be limited at 12000 characters.

Can you share the size limit of GCC command options?


I think the limit probably comes from the shell, not from GCC.

You can use the @file option to pass extra options to GCC in a file, instead of on the command line. See the last option in the page at:
https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/Overall-Options.html






Best Regards
----------------------------------------------------
Martin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Query on GCC command options size limit
  2021-09-01 12:50   ` Luo Xinsheng SGH ADWA4
@ 2021-09-01 13:20     ` Jonathan Wakely
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2021-09-01 13:20 UTC (permalink / raw)
  To: Luo Xinsheng SGH ADWA4; +Cc: gcc-help

On Wed, 1 Sept 2021 at 13:50, Luo Xinsheng SGH ADWA4
<xinsheng.luo@zf.com> wrote:
>
> Hi Jonathan:
>
>
>
> Are there some examples for this @file using in GCC command option?

Is the documentation not clear?

>
>
>
> Locally we usually create makefile and call GCC to compile similar as below script:
>
>
>
> # Collect GCC options (include dirs, defines etc.)
>
> CC := gcc
>
> CC_OPTS := -c -ggdb3 -std=gnu99 -W0nline -w -fgnu89-inline -g -fomit-frame-pointer
>
> CC_OPTS += -include Platformtypes_Stubs.h
>
> CC_OPTS += $(foreach d, $(INCDIRS), -I$d)
>
> CC_OPTS += $(foreach p, $(INCDIRS_PTU), -I$d)
>
> CC_OPTS += $(foreach d, $(DEFINES), -D$d)
>
> # Options for static library build
>
> AR := ar
>
> AR_OPTS := rcs
>
>
>
> $(OBJDIR)/%.o: $(OBJDIR)/%.c
>
>       @echo Compiling: $(<F)
>
>       @$(CC) $(CC_OPTS) $< -o $@
>
>
>
> Now on above script, we find GCC command option in CC_OPTS content is too huge(About 12000 bytes inside) and it can not be analyzed totally in gcc command.

12000 bytes seems ridiculously large, somebody has let things get out
of control.

Instead of adding all those directories and options to the CC_OPTS
variable, write them to a file and then tell GCC to read them from
that file.

How to update your makefile is out of scope for this mailing list, but
you could add a target to the makefile:

CC := gcc
CC_OPTS := -c -ggdb3 -std=gnu99 -W0nline -w -fgnu89-inline -g
-fomit-frame-pointer
CC_OPTS += -include Platformtypes_Stubs.h
CC_OPTS += @gcc_opts

gcc_opts:
        printf "$(foreach d, $(INCDIRS), -I$d)" > $@
        printf "$(foreach d, $(INCDIRS_PTU), -I$d)" >> $@
        printf "$(foreach d, $(DEFINES), -D$d)" >> $@

Then make that a prerequisite of your object files, so that gcc_opts
gets created before it's needed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-01 13:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-31  6:42 Query on GCC command options size limit Luo Xinsheng SGH ADWA4
2021-08-31  8:03 ` Jonathan Wakely
2021-09-01 12:50   ` Luo Xinsheng SGH ADWA4
2021-09-01 13:20     ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).