JPEG-XL and upgrading MinGW GCC

Alvin Wong alvin at alvinhc.com
Fri Mar 11 07:35:23 GMT 2022


Hi again,

I have experimented with this toolchain setup for a bit and found it to 
be extraordinarily difficult to get working reliably for building our 
3rdparty deps. The reason is that upstream LLVM/Clang Windows releases 
targets MSVC by default. For it to target mingw, one needs to pass 
`--target=x86_64-pc-windows-gnu` to all invocations of LLVM/Clang (or 
you can symlink x86_64-pc-windows-gnu-clang++.exe to clang++.exe and 
etc., which is also annoying to get working). Boost and Qt is 
particularly tricky due to the custom build systems. Surprisingly, OCIO 
also gave me some issues, because it includes its own CMake 
ExternalProject and decides to override some of the C/CXXFLAGS for 
building them. Therefore, I have decided to give up this approach for now.

On the other hand, I was suggested the llvm-mingw toolchain [1] by 
someone working with Clang. This toolchain is interesting because it is 
LLVM-based and uses libc++ and ucrt (but there is an option for msvcrt), 
which resembles the `CLANG64` MSYS2 environment. Not only that, but it 
also includes cross compilers for i686 (x86 / 32-bit Intel) and aarch64 
(arm64). We may be able to adapt our build system to make x86 and arm64 
Windows builds using this toolchain. I am trying to make a build with 
this toolchain as I am writing this message. What do you think of this?

I am ignoring mingw-w64 GCC 11.2 because of a compiler bug. I tried to 
build a more recent version of ANGLE with it earlier, but the resulting 
binary crashes, which led me to discover this codegen issue [2], 
therefore I have decided to put it aside for now. (I think it is 
possible to patch ANGLE to avoid the problematic code. I just think that 
if Clang works better then we don't really need to consider GCC. Though 
it would still be nice to have multiple toolchains working...)

[1]: https://github.com/mstorsjo/llvm-mingw
[2]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104862

Cheers,

Alvin

On 10/3/2022 15:56, Alvin Wong wrote:
> Hi,
>
> I am stubborn so I will continue to try with mingw-builds's mingw-w64 
> toolchain and the official Clang releases [0] without using MSYS. 
> Notably, a GCC 11.2 release has become available not long ago [1].
>
> [0]: https://releases.llvm.org/download.html
> [1]: 
> https://github.com/niXman/mingw-builds-binaries/releases/tag/11.2.0-rt_v9-rev1
>
> Cheers,
>
> Alvin
>
>
> On 25/2/2022 1:55, L. E. Segovia wrote:
>> Hi all,
>>
>> I've been tinkering the past couple of days with JPEG-XL, getting it 
>> in place within 3rdparty. I found that one of the dependencies of 
>> libjxl is Google's Highway library, which requires something newer 
>> than GCC 7.3 due to:
>>
>> - support of AVX512 intrinsics
>> - usage of the __STDC_FORMAT_MACROS
>>
>> Fixing the former is needed for our Windows CI, but it will still 
>> fail on the former item.
>>
>> Questions:
>>
>> - Do you know if the Docker image has been updated?
>>
>> - And what can we do with our Windows build itself, which uses MinGW 
>> GCC 7.3?  Obviously, switching to MSYS does the trick, but I think 
>> Dmitry's been reluctant in the past to just do the jump.
>>
>> Cheers,
>>
>> amyspark.
>>


More information about the kimageshop mailing list