Bug 276154 - devel/llvm10: fix build with clang 18
Summary: devel/llvm10: fix build with clang 18
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Brooks Davis
URL:
Keywords:
Depends on:
Blocks: 276104
  Show dependency treegraph
 
Reported: 2024-01-06 17:27 UTC by Dimitry Andric
Modified: 2024-01-12 16:04 UTC (History)
0 users

See Also:
brooks: maintainer-feedback+


Attachments
devel/llvm10: fix build with clang 18 (2.31 KB, patch)
2024-01-06 17:30 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2024-01-06 17:27:53 UTC
Clang 18 as of 2024-01-06 has some trouble with a construct in llvm 10's
Optional.h header, resulting in errors building devel/llvm10:

  In file included from /wrkdirs/usr/ports/devel/llvm10/work/llvm-10.0.1.src/lib/Support/ARMTargetParser.cpp:14:
  In file included from /wrkdirs/usr/ports/devel/llvm10/work/llvm-10.0.1.src/include/llvm/Support/ARMTargetParser.h:17:
  In file included from /wrkdirs/usr/ports/devel/llvm10/work/llvm-10.0.1.src/include/llvm/ADT/StringRef.h:12:
  In file included from /wrkdirs/usr/ports/devel/llvm10/work/llvm-10.0.1.src/include/llvm/ADT/STLExtras.h:19:
  /wrkdirs/usr/ports/devel/llvm10/work/llvm-10.0.1.src/include/llvm/ADT/Optional.h:289:8: error: cannot overload a member function with ref-qualifier '&&' with a member function without a ref-qualifier
    289 |   auto map(const Function &F) &&
        |        ^
  /wrkdirs/usr/ports/devel/llvm10/work/llvm-10.0.1.src/include/llvm/ADT/Optional.h:272:8: note: previous declaration is here
    272 |   auto map(const Function &F) const
        |        ^

A similar issue has been reported to llvm upstream, but it is not clear
yet whether this is a clang regression or an intended behavior. In the
mean time, we can apply
https://github.com/llvm/llvm-project/commit/90cfbb81674ec to make the
port build with clang 18, as a workaround.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2024-01-06 17:30:29 UTC
Created attachment 247489 [details]
devel/llvm10: fix build with clang 18
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2024-01-10 15:55:48 UTC
In the mean time upstream has committed a fix for the "cannot overload a member function with ref-qualifier '&&' with a member function without a ref-qualifier" error, which was also popping up in other ports:

https://github.com/llvm/llvm-project/issues/76358

Once I have merged a newer snapshot of llvm 18 to the llvm-18-update branch, I think this bug is no longer necessary. But I'll have to rebuild my whole ports collection to double-check it, so it might take a while. :)
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2024-01-12 16:04:43 UTC
Upstream fixed this in https://github.com/llvm/llvm-project/commit/69066ab31959968ebcbca71f3872bdedef8fb8cd, and I imported a later revision of llvm 18 in https://github.com/DimitryAndric/freebsd-src/commit/3b076e737af3b4ac1b7dc03bdd2b4cca9a0a9590 . After that, devel/llvm10 builds without the additional patch, so this bug is no longer needed.