#1466·mold

Build error on windows with clang

Author: solomoncyjCreated May 27, 2025Updated Jan 18, 2026

built on commit b53197300b5bf9f02daccae536f65dda2d1431c5

 cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is Clang 20.1.2 with GNU-like command-line
-- The CXX compiler identification is Clang 20.1.2 with GNU-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/LLVM/bin/clang.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/LLVM/bin/clang++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Deprecation Warning at third-party/blake3/c/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: C:/Program Files/LLVM/bin/clang.exe
-- BLAKE3 SIMD configuration: x64
--
 * AMD64 assembly, The library uses hand written amd64 SIMD assembly.

-- Looking for zstd.h
-- Looking for zstd.h - not found
-- ZSTD VERSION: 1.5.7
-- Performing Test C_FLAG_WALL
-- Performing Test C_FLAG_WALL - Success
-- Performing Test CXX_FLAG_WALL
-- Performing Test CXX_FLAG_WALL - Success
-- Performing Test C_FLAG_WEXTRA
-- Performing Test C_FLAG_WEXTRA - Success
-- Performing Test CXX_FLAG_WEXTRA
-- Performing Test CXX_FLAG_WEXTRA - Success
-- Performing Test C_FLAG_WUNDEF
-- Performing Test C_FLAG_WUNDEF - Success
-- Performing Test CXX_FLAG_WUNDEF
-- Performing Test CXX_FLAG_WUNDEF - Success
-- Performing Test C_FLAG_WSHADOW
-- Performing Test C_FLAG_WSHADOW - Success
-- Performing Test CXX_FLAG_WSHADOW
-- Performing Test CXX_FLAG_WSHADOW - Success
-- Performing Test C_FLAG_WCAST_ALIGN
-- Performing Test C_FLAG_WCAST_ALIGN - Success
-- Performing Test CXX_FLAG_WCAST_ALIGN
-- Performing Test CXX_FLAG_WCAST_ALIGN - Success
-- Performing Test C_FLAG_WCAST_QUAL
-- Performing Test C_FLAG_WCAST_QUAL - Success
-- Performing Test CXX_FLAG_WCAST_QUAL
-- Performing Test CXX_FLAG_WCAST_QUAL - Success
-- Performing Test C_FLAG_WSTRICT_PROTOTYPES
-- Performing Test C_FLAG_WSTRICT_PROTOTYPES - Success
-- Performing Test LD_FLAG_WL_Z_NOEXECSTACK
-- Performing Test LD_FLAG_WL_Z_NOEXECSTACK - Failed
-- Performing Test C_FLAG_QUNUSED_ARGUMENTS
-- Performing Test C_FLAG_QUNUSED_ARGUMENTS - Success
-- Performing Test CXX_FLAG_QUNUSED_ARGUMENTS
-- Performing Test CXX_FLAG_QUNUSED_ARGUMENTS - Success
-- Performing Test C_FLAG_WA_NOEXECSTACK
-- Performing Test C_FLAG_WA_NOEXECSTACK - Success
-- Performing Test CXX_FLAG_WA_NOEXECSTACK
-- Performing Test CXX_FLAG_WA_NOEXECSTACK - Success
-- CMAKE_INSTALL_PREFIX: C:/Program Files (x86)/mold
-- CMAKE_INSTALL_LIBDIR: lib
-- ZSTD_LEGACY_SUPPORT defined!
-- ZSTD_MULTITHREAD_SUPPORT is enabled
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.49.0.windows.1")
--
-- Architecture: x64
-- Override standard malloc (MI_OVERRIDE=ON)
--
-- Library name     : mimalloc
-- Version          : 2.2.2
-- Build type       : release
-- C Compiler       : C:/Program Files/LLVM/bin/clang.exe
-- Compiler flags   : -Wall;-Wextra;-Wpedantic;-Wno-unknown-pragmas;-fvisibility=hidden;-Wstrict-prototypes;-Wno-static-in-inline;-ftls-model=initial-exec;-fno-builtin-malloc
-- Compiler defines : MI_CMAKE_BUILD_TYPE=release
-- Link libraries   : psapi;shell32;user32;advapi32;bcrypt
-- Build targets    : shared;static;object
--
CMake Warning at third-party/tbb/CMakeLists.txt:145 (message):
  You are building oneTBB as a static library.  This is highly discouraged
  and such configuration is not supported.  Consider building a dynamic
  library to avoid unforeseen issues.


-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - no
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
-- Checking for one of the modules 'hwloc'
-- TBBBind build targets are disabled due to unsupported environment
-- Performing Test HAVE_FULL_ATOMIC_SUPPORT
-- Performing Test HAVE_FULL_ATOMIC_SUPPORT - Success
-- Looking for madvise
-- Looking for madvise - not found
-- Looking for uname
-- Looking for uname - not found
-- Configuring done (15.7s)
-- Generating done (0.3s)
-- Build files have been written to: C:/Users/solom/Downloads/mold/build
~\Downloads\mold  main  cd build
~\Downloads\mold\build  main  ninja
[21/604] Building C object third-party/zstd/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/huf_compress.c.obj
C:/Users/solom/Downloads/mold/third-party/zstd/lib/compress/huf_compress.c:544:16: warning: unused function 'HUF_isSorted' [-Wunused-function]
  544 | MEM_STATIC int HUF_isSorted(nodeElt huffNode[], U32 const maxSymbolValue1) {
      |                ^~~~~~~~~~~~
1 warning generated.
[52/604] Building CXX object third-party/tbb/src/tbb/CMakeFiles/tbb.dir/arena.cpp.obj
FAILED: third-party/tbb/src/tbb/CMakeFiles/tbb.dir/arena.cpp.obj
C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -D__TBB_BUILD -D__TBB_DYNAMIC_LOAD_ENABLED=0 -D__TBB_SOURCE_DIRECTLY_INCLUDED=1 -D__TBB_USE_ITT_NOTIFY -IC:/Users/solom/Downloads/mold/third-party/tbb/src/tbb/../../include -O3 -DNDEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -std=c++14 -fvisibility-inlines-hidden -Wall -Wextra -mrtm -mwaitpkg -Wformat -Wformat-security -Werror=format-security -fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2 -ffile-prefix-map=C:\Users\solom\Downloads\mold/= -ffile-prefix-map=..\..\..\/= -MD -MT third-party/tbb/src/tbb/CMakeFiles/tbb.dir/arena.cpp.obj -MF third-party\tbb\src\tbb\CMakeFiles\tbb.dir\arena.cpp.obj.d -o third-party/tbb/src/tbb/CMakeFiles/tbb.dir/arena.cpp.obj -c C:/Users/solom/Downloads/mold/third-party/tbb/src/tbb/arena.cpp
clang++: error: unsupported option '-fPIC' for target 'x86_64-pc-windows-msvc'
[53/604] Building CXX object third-party/tbb/src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.obj
FAILED: third-party/tbb/src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.obj
C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -D__TBB_BUILD -D__TBB_DYNAMIC_LOAD_ENABLED=0 -D__TBB_SOURCE_DIRECTLY_INCLUDED=1 -D__TBB_USE_ITT_NOTIFY -IC:/Users/solom/Downloads/mold/third-party/tbb/src/tbb/../../include -O3 -DNDEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -std=c++14 -fvisibility-inlines-hidden -Wall -Wextra -mrtm -mwaitpkg -Wformat -Wformat-security -Werror=format-security -fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2 -ffile-prefix-map=C:\Users\solom\Downloads\mold/= -ffile-prefix-map=..\..\..\/= -MD -MT third-party/tbb/src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.obj -MF third-party\tbb\src\tbb\CMakeFiles\tbb.dir\address_waiter.cpp.obj.d -o third-party/tbb/src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.obj -c C:/Users/solom/Downloads/mold/third-party/tbb/src/tbb/address_waiter.cpp
clang++: error: unsupported option '-fPIC' for target 'x86_64-pc-windows-msvc'
[54/604] Building CXX object third-party/tbb/src/tbb/CMakeFiles/tbb.dir/arena_slot.cpp.obj
FAILED: third-party/tbb/src/tbb/CMakeFiles/tbb.dir/arena_slot.cpp.obj
C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -D__TBB_BUILD -D__TBB_DYNAMIC_LOAD_ENABLED=0 -D__TBB_SOURCE_DIRECTLY_INCLUDED=1 -D__TBB_USE_ITT_NOTIFY -IC:/Users/solom/Downloads/mold/third-party/tbb/src/tbb/../../include -O3 -DNDEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -std=c++14 -fvisibility-inlines-hidden -Wall -Wextra -mrtm -mwaitpkg -Wformat -Wformat-security -Werror=format-security -fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2 -ffile-prefix-map=C:\Users\solom\Downloads\mold/= -ffile-prefix-map=..\..\..\/= -MD -MT third-party/tbb/src/tbb/CMakeFiles/tbb.dir/arena_slot.cpp.obj -MF third-party\tbb\src\tbb\CMakeFiles\tbb.dir\arena_slot.cpp.obj.d -o third-party/tbb/src/tbb/CMakeFiles/tbb.dir/arena_slot.cpp.obj -c C:/Users/solom/Downloads/mold/third-party/tbb/src/tbb/arena_slot.cpp
clang++: error: unsupported option '-fPIC' for target 'x86_64-pc-windows-msvc'
[55/604] Building CXX object third-party/tbb/src/tbb/CMakeFiles/tbb.dir/allocator.cpp.obj
FAILED: third-party/tbb/src/tbb/CMakeFiles/tbb.dir/allocator.cpp.obj
C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -D__TBB_BUILD -D__TBB_DYNAMIC_LOAD_ENABLED=0 -D__TBB_SOURCE_DIRECTLY_INCLUDED=1 -D__TBB_USE_ITT_NOTIFY -IC:/Users/solom/Downloads/mold/third-party/tbb/src/tbb/../../include -O3 -DNDEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -std=c++14 -fvisibility-inlines-hidden -Wall -Wextra -mrtm -mwaitpkg -Wformat -Wformat-security -Werror=format-security -fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2 -ffile-prefix-map=C:\Users\solom\Downloads\mold/= -ffile-prefix-map=..\..\..\/= -MD -MT third-party/tbb/src/tbb/CMakeFiles/tbb.dir/allocator.cpp.obj -MF third-party\tbb\src\tbb\CMakeFiles\tbb.dir\allocator.cpp.obj.d -o third-party/tbb/src/tbb/CMakeFiles/tbb.dir/allocator.cpp.obj -c C:/Users/solom/Downloads/mold/third-party/tbb/src/tbb/allocator.cpp
clang++: error: unsupported option '-fPIC' for target 'x86_64-pc-windows-msvc'
[56/604] Building CXX object third-party/tbb/src/tbb/CMakeFiles/tbb.dir/concurrent_bounded_queue.cpp.obj
FAILED: third-party/tbb/src/tbb/CMakeFiles/tbb.dir/concurrent_bounded_queue.cpp.obj
C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -D__TBB_BUILD -D__TBB_DYNAMIC_LOAD_ENABLED=0 -D__TBB_SOURCE_DIRECTLY_INCLUDED=1 -D__TBB_USE_ITT_NOTIFY -IC:/Users/solom/Downloads/mold/third-party/tbb/src/tbb/../../include -O3 -DNDEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -std=c++14 -fvisibility-inlines-hidden -Wall -Wextra -mrtm -mwaitpkg -Wformat -Wformat-security -Werror=format-security -fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2 -ffile-prefix-map=C:\Users\solom\Downloads\mold/= -ffile-prefix-map=..\..\..\/= -MD -MT third-party/tbb/src/tbb/CMakeFiles/tbb.dir/concurrent_bounded_queue.cpp.obj -MF third-party\tbb\src\tbb\CMakeFiles\tbb.dir\concurrent_bounded_queue.cpp.obj.d -o third-party/tbb/src/tbb/CMakeFiles/tbb.dir/concurrent_bounded_queue.cpp.obj -c C:/Users/solom/Downloads/mold/third-party/tbb/src/tbb/concurrent_bounded_queue.cpp
clang++: error: unsupported option '-fPIC' for target 'x86_64-pc-windows-msvc'
[57/604] Building CXX object third-party/tbb/src/tbb/CMakeFiles/tbb.dir/dynamic_link.cpp.obj
FAILED: third-party/tbb/src/tbb/CMakeFiles/tbb.dir/dynamic_link.cpp.obj
C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -D__TBB_BUILD -D__TBB_DYNAMIC_LOAD_ENABLED=0 -D__TBB_SOURCE_DIRECTLY_INCLUDED=1 -D__TBB_USE_ITT_NOTIFY -IC:/Users/solom/Downloads/mold/third-party/tbb/src/tbb/../../include -O3 -DNDEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -std=c++14 -fvisibility-inlines-hidden -Wall -Wextra -mrtm -mwaitpkg -Wformat -Wformat-security -Werror=format-security -fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2 -ffile-prefix-map=C:\Users\solom\Downloads\mold/= -ffile-prefix-map=..\..\..\/= -MD -MT third-party/tbb/src/tbb/CMakeFiles/tbb.dir/dynamic_link.cpp.obj -MF third-party\tbb\src\tbb\CMakeFiles\tbb.dir\dynamic_link.cpp.obj.d -o third-party/tbb/src/tbb/CMakeFiles/tbb.dir/dynamic_link.cpp.obj -c C:/Users/solom/Downloads/mold/third-party/tbb/src/tbb/dynamic_link.cpp
clang++: error: unsupported option '-fPIC' for target 'x86_64-pc-windows-msvc'
[60/604] Building CXX object third-party/tbb/src/tbb/CMakeFiles/tbb.dir/exception.cpp.obj
FAILED: third-party/tbb/src/tbb/CMakeFiles/tbb.dir/exception.cpp.obj
C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -D__TBB_BUILD -D__TBB_DYNAMIC_LOAD_ENABLED=0 -D__TBB_SOURCE_DIRECTLY_INCLUDED=1 -D__TBB_USE_ITT_NOTIFY -IC:/Users/solom/Downloads/mold/third-party/tbb/src/tbb/../../include -O3 -DNDEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -std=c++14 -fvisibility-inlines-hidden -Wall -Wextra -mrtm -mwaitpkg -Wformat -Wformat-security -Werror=format-security -fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2 -ffile-prefix-map=C:\Users\solom\Downloads\mold/= -ffile-prefix-map=..\..\..\/= -MD -MT third-party/tbb/src/tbb/CMakeFiles/tbb.dir/exception.cpp.obj -MF third-party\tbb\src\tbb\CMakeFiles\tbb.dir\exception.cpp.obj.d -o third-party/tbb/src/tbb/CMakeFiles/tbb.dir/exception.cpp.obj -c C:/Users/solom/Downloads/mold/third-party/tbb/src/tbb/exception.cpp
clang++: error: unsupported option '-fPIC' for target 'x86_64-pc-windows-msvc'
[61/604] Building C object third-party/mimalloc/CMakeFiles/mimalloc-static.dir/src/alloc.c.obj
C:/Users/solom/Downloads/mold/third-party/mimalloc/src/alloc.c:502:44: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
  502 | static std_new_handler_t mi_get_new_handler() {
      |                                            ^
      |                                             void
1 warning generated.
[62/604] Building CXX object third-party/tbb/src/tbb/CMakeFiles/tbb.dir/governor.cpp.obj
FAILED: third-party/tbb/src/tbb/CMakeFiles/tbb.dir/governor.cpp.obj
C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -D__TBB_BUILD -D__TBB_DYNAMIC_LOAD_ENABLED=0 -D__TBB_SOURCE_DIRECTLY_INCLUDED=1 -D__TBB_USE_ITT_NOTIFY -IC:/Users/solom/Downloads/mold/third-party/tbb/src/tbb/../../include -O3 -DNDEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -std=c++14 -fvisibility-inlines-hidden -Wall -Wextra -mrtm -mwaitpkg -Wformat -Wformat-security -Werror=format-security -fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2 -ffile-prefix-map=C:\Users\solom\Downloads\mold/= -ffile-prefix-map=..\..\..\/= -MD -MT third-party/tbb/src/tbb/CMakeFiles/tbb.dir/governor.cpp.obj -MF third-party\tbb\src\tbb\CMakeFiles\tbb.dir\governor.cpp.obj.d -o third-party/tbb/src/tbb/CMakeFiles/tbb.dir/governor.cpp.obj -c C:/Users/solom/Downloads/mold/third-party/tbb/src/tbb/governor.cpp
clang++: error: unsupported option '-fPIC' for target 'x86_64-pc-windows-msvc'
[69/604] Building C object third-party/zstd/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_lazy.c.obj
C:/Users/solom/Downloads/mold/third-party/zstd/lib/compress/zstd_lazy.c:808:16: warning: unused function 'ZSTD_isAligned' [-Wunused-function]
  808 | MEM_STATIC int ZSTD_isAligned(void const* ptr, size_t align) {
      |                ^~~~~~~~~~~~~~
1 warning generated.
ninja: build stopped: subcommand failed.