rui314 / mold

Mold: A Modern Linker 🦠
MIT License
14.2k stars 468 forks source link

MSYS2/UCRT64: LINKER_TYPE 'MOLD' is unknown or not supported by this toolchain. #1267

Closed Tyler799 closed 4 months ago

Tyler799 commented 4 months ago

GCC Version: 14.1.0 CMAKE Version: 3.29.3 MOLD Version: 2.30.0 (mingw-w64-ucrt-x86_64-mold)

I am attempting to swap in Mold as the linker for an existing cmake project. I'm running cmake using:

-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=mold" -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=mold"

(I have also tried setting CMAKE_LINKER_TYPE instead, same issue)

That causes the following error:

CMake Error in C:/Users/tyler.shellberg/Documents/build/myProject/CMakeFiles/CMakeScratch/TryCompile-4y8fvv/CMakeLists.txt:
  LINKER_TYPE 'MOLD' is unknown or not supported by this toolchain.

The minimum cmake is set to: cmake_minimum_required(VERSION 3.16...3.29) and the error happens the moment it hits the project keyword.

mold is in my path.

rui314 commented 4 months ago

mold supports the ELF file format only; it does not support PE/COFF that is used by Windows. You cannot use mold for MinGW.

Tyler799 commented 4 months ago

mold supports the ELF file format only; it does not support PE/COFF that is used by Windows. You cannot use mold for MinGW.

I'm confused, then why why there a Mold package for MSYS2 at all?

rui314 commented 4 months ago

I can't speak for them, but mold can still be used to cross compile Linux binaries on Windows.

Tyler799 commented 4 months ago

I'll go ahead and close, and look into Sold instead since it's open these days

Alcaro commented 4 months ago

Sold isn't very useful on windows either, it can only create mac binaries

Tyler799 commented 4 months ago

Sold isn't very useful on windows either, it can only create mac binaries

Weird, I thought in original discussions Windows support was a main point.

Damn, so there's nothing out there for Windows binaries?