FreeBSD Bugzilla – Attachment 248140 Details for
Bug 276785
devel/build2: fix build with clang 18 rc1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
devel/build2: fix build with clang 18 rc1
devel__build2-fix-clang18rc1-build-1.diff (text/plain), 3.78 KB, created by
Dimitry Andric
on 2024-02-02 16:51:59 UTC
(
hide
)
Description:
devel/build2: fix build with clang 18 rc1
Filename:
MIME Type:
Creator:
Dimitry Andric
Created:
2024-02-02 16:51:59 UTC
Size:
3.78 KB
patch
obsolete
>commit 6e2be46601d17f774560752b0ec81ff897f0bceb >Author: Dimitry Andric <dim@FreeBSD.org> >Date: 2024-02-02T17:50:59+01:00 > > devel/build2: fix build with clang 18 rc1 > > As of rc1, clang 18 has a version id formatted as "18.1.0rc". Similarly, > builds from the upstream main branch typically have a version id looking > like "19.0.0git". Due to the way it parses version strings, devel/build2 > cannot handle this format, and fails with: > > LC_ALL=C c++ -v > error: unable to extract Clang minor version from '18' > info: use config.cxx.version to override > > I submitted https://github.com/build2/build2/issues/360 upstream, and > they committed a fix: https://github.com/build2/build2/commit/0e1b73e3, > which should eventually end up in 0.17.0. > > The fix applies without issues on 0.16.0, so add it as a patch. > > PR: 276785 > MFH: 2024Q1 > >diff --git a/devel/build2/files/patch-build2_libbuild2_cc_guess.cxx b/devel/build2/files/patch-build2_libbuild2_cc_guess.cxx >new file mode 100644 >index 000000000000..6721fdcbc86d >--- /dev/null >+++ b/devel/build2/files/patch-build2_libbuild2_cc_guess.cxx >@@ -0,0 +1,79 @@ >+commit 0e1b73e3b43bca7c1d77ed669b364819ad211da9 >+Author: Boris Kolpackov <boris@codesynthesis.com> >+Date: 2024-02-02T11:41:33+02:00 >+ >+ Handle unseparated `rc` and `git` suffixes in Clang version (GH issue #360) >+ >+--- build2/libbuild2/cc/guess.cxx.orig 2023-06-19 05:26:33 UTC >++++ build2/libbuild2/cc/guess.cxx >+@@ -2421,6 +2421,12 @@ namespace build2 >+ // >+ // emcc (...) 2.0.8 >+ // >++ // Pre-releases of the vanilla Clang append `rc` or `git` to the >++ // version, unfortunately without a separator. So we will handle these >++ // ad hoc. For example: >++ // >++ // FreeBSD clang version 18.1.0rc (https://github.com/llvm/llvm-project.git llvmorg-18-init-18361-g22683463740e) >++ // >+ auto extract_version = [] (const string& s, bool patch, const char* what) >+ -> compiler_version >+ { >+@@ -2435,8 +2441,28 @@ namespace build2 >+ // end of the word position (first space). In fact, we can just >+ // check if it is >= e. >+ // >+- if (s.find_first_not_of ("1234567890.", b, 11) >= e) >++ size_t p (s.find_first_not_of ("1234567890.", b, 11)); >++ if (p >= e) >+ break; >++ >++ // Handle the unseparated `rc` and `git` suffixes. >++ // >++ if (p != string::npos) >++ { >++ if (p + 2 == e && (e - b) > 2 && >++ s[p] == 'r' && s[p + 1] == 'c') >++ { >++ e -= 2; >++ break; >++ } >++ >++ if (p + 3 == e && (e - b) > 3 && >++ s[p] == 'g' && s[p + 1] == 'i' && s[p + 2] == 't') >++ { >++ e -= 3; >++ break; >++ } >++ } >+ } >+ >+ if (b == e) >+@@ -2472,8 +2498,15 @@ namespace build2 >+ ver.patch = next ("patch", patch); >+ >+ if (e != s.size ()) >+- ver.build.assign (s, e + 1, string::npos); >++ { >++ // Skip the separator (it could also be unseparated `rc` or `git`). >++ // >++ if (s[e] == ' ' || s[e] == '-') >++ e++; >+ >++ ver.build.assign (s, e, string::npos); >++ } >++ >+ return ver; >+ }; >+ >+@@ -2496,7 +2529,10 @@ namespace build2 >+ >+ // Some overrides for testing. >+ // >++ //string s (xv != nullptr ? *xv : ""); >++ // >+ //s = "clang version 3.7.0 (tags/RELEASE_370/final)"; >++ //s = "FreeBSD clang version 18.1.0rc (https://github.com/llvm/llvm-project.git llvmorg-18-init-18361-g22683463740e)"; >+ // >+ //gr.id.variant = "apple"; >+ //s = "Apple LLVM version 7.3.0 (clang-703.0.16.1)";
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
fuz
:
maintainer-approval+
Actions:
View
|
Diff
Attachments on
bug 276785
: 248140