Re: devel/qt6-tools does not build with LLVM 19

From: Mark Millard <marklmi_at_yahoo.com>
Date: Mon, 07 Oct 2024 01:59:09 UTC
Dimitry Andric <dim_at_FreeBSD.org> wrote on
Date: Sun, 06 Oct 2024 21:23:23 UTC :

> On 6 Oct 2024, at 20:44, Xavier Humbert <xavier@groumpf.org> wrote:
> > 
> > I use
> > DEFAULT_VERSIONS+=llvm=19
> > in my /etc/make.conf.
> > 
> > devel/qt6-tools does not build :
> > 
> > /usr/ports/devel/qt6-tools/work/qttools-everywhere-src-6.7.3/src/linguist/lupdate/clangtoolastreader.cpp:785:73: error: no member named 'getName' in 'clang::FileEntry'
> > 785 | if (!LupdatePrivate::isFileSignificant(fullLocation.getFileEntry()->getName().str()))
> > 
> > Reverting back to
> > DEFAULT_VERSIONS+=llvm=18
> > 
> > makes it compile fine
> > 
> > Read on Chromium forum, same error, reason is :
> > 
> >> commit 1b04e6d4a314cf677b5320b26f2746733b11152c
> >> Author: Hans Wennborg <hans@chromium.org>
> >> Date: Thu Jan 25 13:36:37 2024
> >> 
> >> [clang] Remove use of FileEntry::getName()
> >> 
> >> That method was dropped recently. Instead, we should get the name via
> >> the new FileEntryRef class. That one has existed for a while, so this
> >> code works for both pinned and tip-of-tree Clang.
> 
> It's better to import the upstream fix, obviously. I have been fixing
> llvm 19 related issues such as https://bugs.freebsd.org/281474, but this
> looks a little different. It's a bit strange that this error did not
> come up during the exp-run for https://bugs.freebsd.org/280562 ?

Note the removal of getName :

# diff -u /usr/main-src/contrib/llvm-project/clang/include/clang/Basic/FileEntry.h /usr/local/llvm19/include/clang/Basic/FileEntry.h
--- /usr/main-src/contrib/llvm-project/clang/include/clang/Basic/FileEntry.h    2024-04-07 03:32:58.854825000 +0000
+++ /usr/local/llvm19/include/clang/Basic/FileEntry.h   2024-09-17 11:26:36.000000000 +0000
@@ -317,19 +317,9 @@
     /// The file content, if it is owned by the \p FileEntry.
   std::unique_ptr<llvm::MemoryBuffer> Content;
-
-  // First access name for this FileEntry.
-  //
-  // This is Optional only to allow delayed construction (FileEntryRef has no
-  // default constructor). It should always have a value in practice.
-  //
-  // TODO: remove this once everyone that needs a name uses FileEntryRef.
-  OptionalFileEntryRef LastRef;
   public:
   ~FileEntry();
-  LLVM_DEPRECATED("Use FileEntryRef::getName() instead.", "")
-  StringRef getName() const { return LastRef->getName(); }
     StringRef tryGetRealPathName() const { return RealPathName; }
   off_t getSize() const { return Size; }

In other words:

/usr/local/llvm19/include/clang/Basic/FileEntry.h is based on
llvm19's libc++ and llvm19 instead of being based on the
system's llvm18 based libc++. So the context with devel/llvm19
is an example of where:

/usr/local/llvm19/include/clang/ . . .
vs. the system's:
/usr/include/c++/v1/

are both used for devel/llvm19 but are not independent
and are in fact mismatched in at least some ways at this
point (mixing 19 and 18 library code). devel/llvm19 does
not manage to only update the language handling but leave
the library handling as it is for the system llvm's libc++
and llvm (currently 18 based).

In other words, for how things are handled by FreeBSD: This
is an item for waiting until FreeBSD is itself based on
llvm19, including the libc++ from llvm19!


FYI . . .

I have a somewhat older /usr/ports/ tree and it shows the
problem when I try a poudriere-devel based build:

. . .
port directory: /usr/ports/devel/qt6-tools
package name: qt6-tools-6.7.2_1
building for: FreeBSD amd64optb_ZFS 15.0-CURRENT FreeBSD 15.0-CURRENT amd64
maintained by: kde@FreeBSD.org
port version: 6.7.2
port revision: 1
. . .
===>   Installing existing package /packages/All/llvm19-19.1.0.pkg
[amd64optb_ZFS] Installing llvm19-19.1.0...
[amd64optb_ZFS] `-- Installing libedit-3.1.20240808,1...
[amd64optb_ZFS] `-- Extracting libedit-3.1.20240808,1: .......... done
[amd64optb_ZFS] `-- Installing lua53-5.3.6_1...
[amd64optb_ZFS] `-- Extracting lua53-5.3.6_1: .......... done
[amd64optb_ZFS] `-- Installing perl5-5.36.3_2...
[amd64optb_ZFS] `-- Extracting perl5-5.36.3_2: .......... done
[amd64optb_ZFS] Extracting llvm19-19.1.0: .......... done
. . .
/wrkdirs/usr/ports/devel/qt6-tools/work/qttools-everywhere-src-6.7.2/src/linguist/lupdate/clangtoolastreader.cpp:785:73: error: no member named 'getName' in 'clang::FileEntry'
  785 |     if (!LupdatePrivate::isFileSignificant(fullLocation.getFileEntry()->getName().str()))
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^
1 error generated.
. . .


For reference:

# ~/fbsd-based-on-what-commit.sh -C /usr/ports/
3ec21e417cd5 (HEAD -> main, freebsd/main, freebsd/HEAD) java/eclipse: Remove unnecessary *.so files
Author:     Norbert Grundmann <ngrundmann@gmx.de>
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-09-20 00:14:47 +0000
branch: main
merge-base: 3ec21e417cd5752c96b88587a5a605567ba5cd19
merge-base: CommitDate: 2024-09-20 00:14:47 +0000
n679096 (--first-parent --count for merge-base)

# uname -apKU
FreeBSD 7950X3D-ZFS 15.0-CURRENT FreeBSD 15.0-CURRENT #147 main-n272664-149e1af6ae49-dirty: Sun Oct  6 02:05:51 UTC 2024     root@7950X3D-ZFS:/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/sys/GENERIC-NODBG amd64 amd64 1500024 1500024





===
Mark Millard
marklmi at yahoo.com