Skip to content

Link issue on windows using clang-cl as compiler #32

@chanchancl

Description

@chanchancl

Hi, thanks for your great works.

Have you met this scenario that build a project with rapidobj on windows but using llvm compiler.(CMake + ninja + clang-cl)

The compiler shows:

[main] 正在生成文件夹: d:/Program/rapidobj-demo/build 
[main] 缺少包含 CMake 缓存的文件夹。将重新生成缓存。
[main] 正在配置项目: rapidobj-demo 
[proc] 正在执行命令: "C:\Program Files\CMake\bin\cmake.EXE" -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=d:\ProgramTools\llvm\bin\clang-cl.exe -DCMAKE_CXX_COMPILER:FILEPATH=d:\ProgramTools\llvm\bin\clang-cl.exe --no-warn-unused-cli -S D:/Program/rapidobj-demo -B d:/Program/rapidobj-demo/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The CXX compiler identification is Clang 20.1.8 with MSVC-like command-line
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: d:/ProgramTools/llvm/bin/clang-cl.exe - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- RapidObj version 1.1.0
[cmake] -- Configuring done (3.0s)
[cmake] -- Generating done (0.0s)
[cmake] -- Build files have been written to: D:/Program/rapidobj-demo/build
[build] 正在启动生成
[proc] 正在执行命令: "C:\Program Files\CMake\bin\cmake.EXE" --build d:/Program/rapidobj-demo/build --config Debug --target all --
[build] [1/2  50% :: 1.805] Building CXX object CMakeFiles\Demo.dir\main.cpp.obj
[build] [2/2 100% :: 2.112] Linking CXX executable Demo.exe
[build] FAILED: [code=4294967295] Demo.exe 
[build] C:\WINDOWS\system32\cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --msvc-ver=1944 --intdir=CMakeFiles\Demo.dir --rc=D:\ProgramTools\llvm\bin\llvm-rc.exe --mt=D:\ProgramTools\llvm\bin\llvm-mt.exe --manifests  -- D:\ProgramTools\llvm\bin\lld-link.exe /nologo CMakeFiles\Demo.dir\main.cpp.obj  /out:Demo.exe /implib:Demo.lib /pdb:Demo.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
[build] LINK Pass 1: command "D:\ProgramTools\llvm\bin\lld-link.exe /nologo CMakeFiles\Demo.dir\main.cpp.obj /out:Demo.exe /implib:Demo.lib /pdb:Demo.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\Demo.dir/intermediate.manifest CMakeFiles\Demo.dir/manifest.res" failed (exit code 1) with the following output:
[build] lld-link: error: undefined symbol: _mm_loadu_si128
[build] >>> referenced by C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt\wchar.h:418
[build] >>>               CMakeFiles\Demo.dir\main.cpp.obj:(wmemcmp)
[build] >>> referenced by C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt\wchar.h:419
[build] >>>               CMakeFiles\Demo.dir\main.cpp.obj:(wmemcmp)
[build] 
[build] lld-link: error: undefined symbol: _mm_cmpeq_epi16
[build] >>> referenced by C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt\wchar.h:420
[build] >>>               CMakeFiles\Demo.dir\main.cpp.obj:(wmemcmp)
[build] 
[build] lld-link: error: undefined symbol: _mm_movemask_epi8
[build] >>> referenced by C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt\wchar.h:421
[build] >>>               CMakeFiles\Demo.dir\main.cpp.obj:(wmemcmp)
[build] ninja: build stopped: subcommand failed.
[proc] 命令“"C:\Program Files\CMake\bin\cmake.EXE" --build d:/Program/rapidobj-demo/build --config Debug --target all --”已退出,代码为 4294967295
[driver] 生成完毕: 00:00:02.194
[build] 生成已完成,退出代码为 4294967295

There are 3 symbols can't be found : _mm_loadu_si128, _mm_cmpeq_epi16, _mm_movemask_epi8

By the way, it's ok by using MSVC as compiler.

I just want to know what makes this happend.

Here I can provide a demo project for this.

rapidobj-demo.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions