[GH-ISSUE #5778] build: error: ‘for’ loop initial declarations are only allowed in C99 mode #3090

Closed
opened 2026-05-05 09:43:49 -06:00 by gitea-mirror · 6 comments
Owner

Originally created by @huanghaiqing1 on GitHub (Apr 4, 2023).
Original GitHub issue: https://github.com/netblue30/firejail/issues/5778

./configure has no warning, but make reports the following error:

[root@singularity firejail]# make
make -C src/lib
make[1]: Entering directory `/root/patch/firejail/src/lib'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/root/patch/firejail/src/lib'
make -C src/man
make[1]: Entering directory `/root/patch/firejail/src/man'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/root/patch/firejail/src/man'
make -C src/zsh_completion
make[1]: Entering directory `/root/patch/firejail/src/zsh_completion'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/root/patch/firejail/src/zsh_completion'
make -C src/bash_completion
make[1]: Entering directory `/root/patch/firejail/src/bash_completion'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/root/patch/firejail/src/bash_completion'
make -C src/firecfg/
make[1]: Entering directory `/root/patch/firejail/src/firecfg'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/root/patch/firejail/src/firecfg'
make -C src/firejail/
make[1]: Entering directory `/root/patch/firejail/src/firejail'
gcc -ggdb  -O2 -DVERSION='"0.9.73"' -fstack-protector-all -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -fPIE -DPREFIX='"/usr/local"' -DSYSCONFDIR='"/usr/local/etc/firejail"' -DLIBDIR='"/usr/local/lib"' -DBINDIR='"/usr/local/bin"' -DVARDIR='"/var/lib/firejail"'   -DHAVE_OUTPUT -DHAVE_X11 -DHAVE_PRIVATE_HOME     -DHAVE_USERTMPFS -DHAVE_DBUSPROXY  -DHAVE_GLOBALCFG -DHAVE_CHROOT -DHAVE_NETWORK -DHAVE_USERNS -DHAVE_FILE_TRANSFER  -DHAVE_SUID   -mindirect-branch=thunk -fstack-clash-protection -fstack-protector-strong -g -O2  -c env.c -o env.o
env.c: In function ‘env_apply_list’:
env.c:282:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
    for (unsigned int i = 0; i < num_items; i++)
    ^
env.c:282:4: note: use option -std=c99 or -std=gnu99 to compile your code
make[1]: *** [env.o] Error 1
make[1]: Leaving directory `/root/patch/firejail/src/firejail'
make: *** [src/firejail/firejail] Error 2
Originally created by @huanghaiqing1 on GitHub (Apr 4, 2023). Original GitHub issue: https://github.com/netblue30/firejail/issues/5778 ./configure has no warning, but make reports the following error: ```console [root@singularity firejail]# make make -C src/lib make[1]: Entering directory `/root/patch/firejail/src/lib' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/root/patch/firejail/src/lib' make -C src/man make[1]: Entering directory `/root/patch/firejail/src/man' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/root/patch/firejail/src/man' make -C src/zsh_completion make[1]: Entering directory `/root/patch/firejail/src/zsh_completion' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/root/patch/firejail/src/zsh_completion' make -C src/bash_completion make[1]: Entering directory `/root/patch/firejail/src/bash_completion' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/root/patch/firejail/src/bash_completion' make -C src/firecfg/ make[1]: Entering directory `/root/patch/firejail/src/firecfg' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/root/patch/firejail/src/firecfg' make -C src/firejail/ make[1]: Entering directory `/root/patch/firejail/src/firejail' gcc -ggdb -O2 -DVERSION='"0.9.73"' -fstack-protector-all -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -fPIE -DPREFIX='"/usr/local"' -DSYSCONFDIR='"/usr/local/etc/firejail"' -DLIBDIR='"/usr/local/lib"' -DBINDIR='"/usr/local/bin"' -DVARDIR='"/var/lib/firejail"' -DHAVE_OUTPUT -DHAVE_X11 -DHAVE_PRIVATE_HOME -DHAVE_USERTMPFS -DHAVE_DBUSPROXY -DHAVE_GLOBALCFG -DHAVE_CHROOT -DHAVE_NETWORK -DHAVE_USERNS -DHAVE_FILE_TRANSFER -DHAVE_SUID -mindirect-branch=thunk -fstack-clash-protection -fstack-protector-strong -g -O2 -c env.c -o env.o env.c: In function ‘env_apply_list’: env.c:282:4: error: ‘for’ loop initial declarations are only allowed in C99 mode for (unsigned int i = 0; i < num_items; i++) ^ env.c:282:4: note: use option -std=c99 or -std=gnu99 to compile your code make[1]: *** [env.o] Error 1 make[1]: Leaving directory `/root/patch/firejail/src/firejail' make: *** [src/firejail/firejail] Error 2 ```
gitea-mirror 2026-05-05 09:43:49 -06:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@kmk3 commented on GitHub (Apr 4, 2023):

(Offtopic)

Please see the following links for how to format code blocks in markdown:

<!-- gh-comment-id:1495801334 --> @kmk3 commented on GitHub (Apr 4, 2023): (Offtopic) Please see the following links for how to format code blocks in markdown: * <https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks> * <https://github.github.com/gfm/#fenced-code-blocks>
Author
Owner

@kmk3 commented on GitHub (Apr 4, 2023):

configure has no warning.

Please post the full output of that, including what arguments were passed to
./configure.

make -C src/firejail/
make[1]: Entering directory `/root/patch/firejail/src/firejail'
gcc -ggdb  -O2 -DVERSION='"0.9.73"' -fstack-protector-all -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -fPIE -DPREFIX='"/usr/local"' -DSYSCONFDIR='"/usr/local/etc/firejail"' -DLIBDIR='"/usr/local/lib"' -DBINDIR='"/usr/local/bin"' -DVARDIR='"/var/lib/firejail"'   -DHAVE_OUTPUT -DHAVE_X11 -DHAVE_PRIVATE_HOME     -DHAVE_USERTMPFS -DHAVE_DBUSPROXY  -DHAVE_GLOBALCFG -DHAVE_CHROOT -DHAVE_NETWORK -DHAVE_USERNS -DHAVE_FILE_TRANSFER  -DHAVE_SUID   -mindirect-branch=thunk -fstack-clash-protection -fstack-protector-strong -g -O2  -c env.c -o env.o
env.c: In function ‘env_apply_list’:
env.c:282:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
    for (unsigned int i = 0; i < num_items; i++)
    ^
env.c:282:4: note: use option -std=c99 or -std=gnu99 to compile your code
make[1]: *** [env.o] Error 1

What is the output of gcc --version?

What is the distro and distro version?

<!-- gh-comment-id:1495801768 --> @kmk3 commented on GitHub (Apr 4, 2023): > configure has no warning. Please post the full output of that, including what arguments were passed to `./configure`. > ``` > make -C src/firejail/ > make[1]: Entering directory `/root/patch/firejail/src/firejail' > gcc -ggdb -O2 -DVERSION='"0.9.73"' -fstack-protector-all -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -fPIE -DPREFIX='"/usr/local"' -DSYSCONFDIR='"/usr/local/etc/firejail"' -DLIBDIR='"/usr/local/lib"' -DBINDIR='"/usr/local/bin"' -DVARDIR='"/var/lib/firejail"' -DHAVE_OUTPUT -DHAVE_X11 -DHAVE_PRIVATE_HOME -DHAVE_USERTMPFS -DHAVE_DBUSPROXY -DHAVE_GLOBALCFG -DHAVE_CHROOT -DHAVE_NETWORK -DHAVE_USERNS -DHAVE_FILE_TRANSFER -DHAVE_SUID -mindirect-branch=thunk -fstack-clash-protection -fstack-protector-strong -g -O2 -c env.c -o env.o > env.c: In function ‘env_apply_list’: > env.c:282:4: error: ‘for’ loop initial declarations are only allowed in C99 mode > for (unsigned int i = 0; i < num_items; i++) > ^ > env.c:282:4: note: use option -std=c99 or -std=gnu99 to compile your code > make[1]: *** [env.o] Error 1 > ``` What is the output of `gcc --version`? What is the distro and distro version?
Author
Owner

@netblue30 commented on GitHub (Apr 6, 2023):

I'll fix them, thanks! I'll try to compile it with all -std=cXX versions.

<!-- gh-comment-id:1499512857 --> @netblue30 commented on GitHub (Apr 6, 2023): I'll fix them, thanks! I'll try to compile it with all -std=cXX versions.
Author
Owner

@netblue30 commented on GitHub (Apr 6, 2023):

Also, what gcc version are you having there?

<!-- gh-comment-id:1499514763 --> @netblue30 commented on GitHub (Apr 6, 2023): Also, what gcc version are you having there?
Author
Owner

@netblue30 commented on GitHub (Apr 6, 2023):

Give it a try, should be fine now.

ba00d135fe

<!-- gh-comment-id:1499543611 --> @netblue30 commented on GitHub (Apr 6, 2023): Give it a try, should be fine now. https://github.com/netblue30/firejail/commit/ba00d135fec31a94f612e88fe027bd24ca7ff0f5
Author
Owner

@kmk3 commented on GitHub (Aug 23, 2024):

I don't see any remaining obvious cases:

$ git grep -I 'for *(int' -- '*.c'
$
$ git grep -I 'for *(unsigned' -- '*.c'
$

So closing as resolved.

<!-- gh-comment-id:2307273698 --> @kmk3 commented on GitHub (Aug 23, 2024): I don't see any remaining obvious cases: ```console $ git grep -I 'for *(int' -- '*.c' $ $ git grep -I 'for *(unsigned' -- '*.c' $ ``` So closing as resolved.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#3090
No description provided.