Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FTBS rhel7 - Needs c99 cflag #481

Closed
knight-of-ni opened this issue Sep 12, 2023 · 3 comments
Closed

FTBS rhel7 - Needs c99 cflag #481

knight-of-ni opened this issue Sep 12, 2023 · 3 comments
Assignees

Comments

@knight-of-ni
Copy link
Contributor

knight-of-ni commented Sep 12, 2023

Netatalk 3.1.16 fails to build on el7 due to missing c99 cflag:

/bin/sh ../../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../..   -I../../include -I../../include -I../..   -D_U_="__attribute__((unused))" -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1  -m64 -mtune=generic -c -o libacl_la-ldap_config.lo `test -f 'ldap_config.c' || echo './'`ldap_config.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I../../include -I../../include -I../.. "-D_U_=__attribute__((unused))" -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -c ldap_config.c  -fPIC -DPIC -o .libs/libacl_la-ldap_config.o
ldap_config.c: In function 'acl_ldap_freeconfig':
ldap_config.c:35:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (int i = 0; ldap_prefs[i].name != NULL; i++) {
     ^
ldap_config.c:35:5: note: use option -std=c99 or -std=gnu99 to compile your code
make[3]: *** [libacl_la-ldap_config.lo] Error 1
make[3]: Leaving directory `/builddir/build/BUILD/netatalk-3.1.16/libatalk/acl'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/builddir/build/BUILD/netatalk-3.1.16/libatalk'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/builddir/build/BUILD/netatalk-3.1.16'
make: *** [all] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.C4y0fy (%build)

I am working around this in EPEL by forcing -gnu99 in the rpm specfile.

Since el7 is such an old distro, I'm not necessarily arguing for an upstream fix. This is more of an FYI, if the maintainers wish to do anything about it.

@rdmark
Copy link
Member

rdmark commented Sep 12, 2023

Thanks for reporting! I'm all for making the code more portable within reason.

ldap_config.c:35:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (int i = 0; ldap_prefs[i].name != NULL; i++) {
     ^

Seems to be as simple as declaring int i; before using it. That's what the subsequent function in this file does. I assume this would make the EL7 compiler happy?

@knight-of-ni
Copy link
Contributor Author

Ah right, that would certainly fix the issue for older compilers. Thanks.

@rdmark
Copy link
Member

rdmark commented Sep 14, 2023

Fixing in #484

For the record, netatalk2 is not affected.

@rdmark rdmark self-assigned this Sep 14, 2023
@dgsga dgsga closed this as completed Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

No branches or pull requests

3 participants