From 40eddf8cac51662f80d92bb73f87f97a00f306e2 Mon Sep 17 00:00:00 2001 From: Ryan Butler Date: Wed, 27 May 2026 10:33:06 -0500 Subject: [PATCH] fix(liquid-dsp): guard -lc/-lm link against WIN32 platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `target_link_libraries(${target} c m)` is a POSIX/Linux convention. On Windows, the C runtime is linked automatically by both MinGW-w64 ld and MSVC — passing `-lc`/`-lm` explicitly causes MinGW ld to error with "cannot find -lc: No such file or directory" because there is no standalone libc.a in the MinGW sysroot. Wrap the call in `if(NOT WIN32)` so MinGW and MSVC builds skip the redundant link flags while Linux/macOS behaviour is unchanged. Fixes build on Windows with MinGW GCC 13.1.0 introduced when liquid-dsp was vendored in PR #3046. Tracks upstream issue #3049. Co-Authored-By: Claude Sonnet 4.6 --- third_party/liquid-dsp/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/third_party/liquid-dsp/CMakeLists.txt b/third_party/liquid-dsp/CMakeLists.txt index 07c123889..15eed5c0f 100644 --- a/third_party/liquid-dsp/CMakeLists.txt +++ b/third_party/liquid-dsp/CMakeLists.txt @@ -465,7 +465,12 @@ foreach(target ${LIQUID_TARGETS}) set_target_properties(${target} PROPERTIES PUBLIC_HEADER include/liquid.h) - target_link_libraries(${target} c m) + # -lc and -lm are POSIX/Linux conventions; on Windows (MinGW and MSVC) + # the CRT is linked automatically — explicitly passing them causes + # MinGW ld to error "cannot find -lc" since there is no libc.a. + if(NOT WIN32) + target_link_libraries(${target} c m) + endif() if (fftw3f_FOUND) target_link_libraries(${target} fftw3f) endif()