ARTICLE AD BOX
I am cross-compiling a Windows x64 GUI executable on macOS (Apple Silicon) using LLVM clang targeting the MSVC ABI, with CMake + Conan 2.
The executable itself compiles and links fine until I add a static dependency on SDL3, built via Conan. Linking then fails with an undefined SSE intrinsic coming from SDL.
Id appreciate some guidance on which layer is responsible here (compiler flags, Conan profile, SDL build options, or clang/MSVC ABI interaction), and what the correct way to address this is.
⸻
Host system
macOS (Apple Silicon, arm64) LLVM from Homebrew Cross-compiling to Windows x64⸻
Toolchain
Compiler: clang++ (not clang-cl) Target: x86_64-pc-windows-msvc Linker: lld-link CMake toolchain file: custom windows-llvm.cmake Conan 2 with explicit build/host profiles⸻
Conan invocation
conan install . \ --profile:build=macos \ --profile:host=windows-x86_64-llvm \ --build=missingCMake link command (excerpt)
clang++ --target=x86_64-pc-windows-msvc -nostartfiles -nostdlib -fuse-ld=lld-link -Xlinker /subsystem:windows -Xlinker /entry:WinMainCRTStartup CMakeFiles/hello_gui.dir/win-main.cpp.obj SDL3-static.lib -lkernel32 -luser32 -lgdi32 ...Linker error
lld-link: error: undefined symbol: _mm_setr_epi16 >>> referenced by SDL3-static.lib(SDL_stb.c.obj):(stbi__idct_simd)I've already tried enabling SSE2 explicitly:
add_compile_options(-msse2)Applied globally via the toolchain file so it affects both SDL and my project, then rebuilt both SDL3 and my project.
What I’m trying to understand
Why does _mm_setr_epi16 remain undefined when compiling for x86_64, where SSE2 should be guaranteed? Is this: a missing compiler flag? an SDL build option? a Conan profile issue? a known clang + MSVC ABI quirk when cross-compiling? What is the correct, minimal fix when using: clang --target=x86_64-pc-windows-msvcI'm specifically not using clang-cl, and would like to keep using clang + lld-link if possible.
