File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -217,6 +217,14 @@ pub struct BpfBuilder {
217217}
218218
219219impl BpfBuilder {
220+ fn skip_clang_version_prefix ( line : & str ) -> & str {
221+ if let Some ( index) = line. find ( "clang version" ) {
222+ & line[ index..]
223+ } else {
224+ line
225+ }
226+ }
227+
220228 fn find_clang ( ) -> Result < ( String , String , String ) > {
221229 let clang = env:: var ( "BPF_CLANG" ) . unwrap_or ( "clang" . into ( ) ) ;
222230 let output = Command :: new ( & clang)
@@ -227,7 +235,10 @@ impl BpfBuilder {
227235 let stdout = String :: from_utf8 ( output. stdout ) ?;
228236 let ( mut ver, mut arch) = ( None , None ) ;
229237 for line in stdout. lines ( ) {
230- if let Ok ( v) = sscanf ! ( line, "clang version {String}" ) {
238+ if let Ok ( v) = sscanf ! (
239+ Self :: skip_clang_version_prefix( line) ,
240+ "clang version {String}"
241+ ) {
231242 // Version could be followed by (URL SHA1). Only take
232243 // the first word.
233244 ver = Some ( v. split_whitespace ( ) . next ( ) . unwrap ( ) . to_string ( ) ) ;
You can’t perform that action at this time.
0 commit comments