Re: git: 75ac7903573c - main - graphics/darktable: Use GCC as the compiler instead of LLVM

From: Dima Panov <fluffy_at_FreeBSD.org>
Date: Sat, 28 Jan 2023 17:10:31 UTC

On 28.01.2023 19:37, Jean-Sébastien Pédron wrote:
> On 28/01/2023 15:51, Matthias Andree wrote:
>> Am 28.01.23 um 14:22 schrieb Dima Panov:
>>> Moin-moin!
>>>
>>>
>>> USES+= llvm:14,build
>>>
>>> with
>>>
>>> USES+= compiler:gcc-c++11-lib
>>> USE_GCC=yes
>>>
>>> at same time?
>>> Please choose only one set, compiler.mk have a higher priority and
>>> conflicting with overriding CC
>>>
>>> BTW, USES=llvm also needs to set USE_CXXSTD='gnu++17', for example
>>
>> Dima,
>>
>> thanks for looking again.
>>
>> I can't judge on the details because that's been Jean-Sébastien's doing,
>> but I know that darktable uses two compilers:
>> - one is for the C++ librawspeed and the C darktable code, and
>> - the other compiler shall be LLVM to compile the OpenCL kernels.  I
>> don't think GCC could do the latter, and certainly darktable expects to
>> use LLVM by way of its build tooling and configuration (cmake-based).
> 
> Indeed, I could have given more explanations in the commit message or in comments in the Makefile.
> 
> We used to compile Darktable entirely with LLVM. Unfortunately, it breaks on a regular basis because GCC is used upstream and Darktable uses a lot of GCC-specific flags and optimizations. I wanted to switch from LLVM 13 we used so far to LLVM 15, the one used by mesa-dri to reduce the number of installed LLVM. But again, Darktable doesn't compile with LLVM 14/15; that's the part I described in the commit message.
> 
> So instead of fighting the expectations of the upstream developers, I preferred to use GCC as the main compiler for Darktable.
> 
> Now, as Matthias said, LLVM is still required for the OpenCL part of Darktable. That's why it is a build dependency, not a runtime one. I agree it's annoying, but that's how Darktable is compiled upstream.

Thanks for explanation!

I'm not against of using both compilers but was fooled by USE_GCC=all which forces to override global CC/CXX variables and masks any other compilers from usage.
But I've missed the part of opencl components sources where CC/CXX was always redetected in favor of LLVM.

BTW, USES+= llvm:14,build can be enchanted by USES+= llvm:min=14,build to allow llvm15 too for opencl part.


-- 
Sincerely,
Dima (fluffy@FreeBSD.org, https://t.me/FluffyBSD)
(desktop, kde, x11, office, ports-secteam)@FreeBSD team