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

get_clang_version does not parse the version correctly #84

Closed
NightEule5 opened this issue Sep 21, 2023 · 1 comment
Closed

get_clang_version does not parse the version correctly #84

NightEule5 opened this issue Sep 21, 2023 · 1 comment

Comments

@NightEule5
Copy link

When building ogc-sys, Clang is unable to find system libraries like stdlib.h. I did some probing, and found that get_clang_version outputs 16.0.6 instead of the expected 16, leading to an invalid /usr/lib/clang/.../include path.

The problem is with the regex:

let regex = Regex::new(r"(?m)\d+(\.\d+)+").unwrap();
let result = regex.captures(first_line).unwrap().get(0);

Capture group 0 refers to the whole match, which includes the (\.\d+)+ part. Perhaps you meant:

let regex = Regex::new(r"(?m)(\d+)(\.\d+)+").unwrap();
let result = regex.captures(first_line).unwrap().get(1);

Or, using non-capturing groups:

let regex = Regex::new(r"(?m)\d+(?:\.\d+)+").unwrap();
let result = regex.captures(first_line).unwrap().get(0);
@ProfElements
Copy link
Collaborator

Will try this once i get home. thanks for the input

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

No branches or pull requests

2 participants