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

error: failed to run custom build command for pcre2-sys v0.2.6 on the centos7 platform #33

Open
Peefy opened this issue Jul 26, 2023 · 7 comments

Comments

@Peefy
Copy link

Peefy commented Jul 26, 2023

Description

I have failed to run custom build command for pcre2-sys v0.2.6 on the centos7 platform.

The error message is

warning: upstream/src/pcre2_script_run.c: In function '_pcre2_script_run_8':
warning: upstream/src/pcre2_script_run.c:109:1: error: 'for' loop initial declarations are only allowed in C99 mode
warning:  for (int i = 0; i < FULL_MAPSIZE; i++) require_map[i] = 0;
warning:  ^
warning: upstream/src/pcre2_script_run.c:109:1: note: use option -std=c99 or -std=gnu99 to compile your code
warning: upstream/src/pcre2_script_run.c:248:7: error: 'for' loop initial declarations are only allowed in C99 mode
warning:        for (int i = 0; i < FULL_MAPSIZE; i++)
warning:        ^
warning: upstream/src/pcre2_script_run.c:285:9: error: 'for' loop initial declarations are only allowed in C99 mode
warning:          for (int i = 0; i < FULL_MAPSIZE; i++) require_map[i] &= map[i];
warning:          ^

error: failed to run custom build command for `pcre2-sys v0.2.6`
@Peefy
Copy link
Author

Peefy commented Jul 26, 2023

If possible, I can fix it

@Peefy
Copy link
Author

Peefy commented Jul 26, 2023

To walk-around it, I enabled export CC=c99

@BurntSushi
Copy link
Owner

It's unclear to me why this is failing on CentOS but not anywhere else. I don't have a CentOS 7 system I can easily test on, so I think this will probably a require someone other than me to submit a patch.

@Peefy
Copy link
Author

Peefy commented Jul 26, 2023

I guess it's caused by a lower version of gcc. Could I open a PR to set 'cc' crate with c99 mode by default?

@BurntSushi
Copy link
Owner

The lower version might indeed be the culprit, although I still find that curious. Does that imply more recent versions of gcc default to at least c99? And the CentOS version of gcc does not? That feels like a question with a definite answer to me.

But either way, yes, I think setting C99 mode explicitly in the build script is fine as long as CI passes.

@Peefy
Copy link
Author

Peefy commented Jul 26, 2023

The lower version might indeed be the culprit, although I still find that curious. Does that imply more recent versions of gcc default to at least c99? And the CentOS version of gcc does not? That feels like a question with a definite answer to me.

But either way, yes, I think setting C99 mode explicitly in the build script is fine as long as CI passes.

Ok I will Open a PR to set C99 mode later

Peefy added a commit to Peefy/rust-pcre2 that referenced this issue Jul 27, 2023
Peefy added a commit to Peefy/rust-pcre2 that referenced this issue Jul 27, 2023
@cuviper
Copy link

cuviper commented Aug 2, 2024

The lower version might indeed be the culprit, although I still find that curious. Does that imply more recent versions of gcc default to at least c99? And the CentOS version of gcc does not? That feels like a question with a definite answer to me.

Yes, CentOS 7's gcc is 4.8.5, where:

The default, if no C language dialect options are given, is -std=gnu90; this will change to -std=gnu99 or -std=gnu11 in some future release when the C99 or C11 support is complete.

And indeed 5.1.0 changed to -std=gnu11. Then 11.1.0 stepped up to -std=gnu17, where it remains today.

(CentOS 7 has passed EOL, but RHEL 7 ELS remains until 2028.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants