Hi,
We are trying to build The-Forge, a graphics/rendering library, using Zig instead of via invoking cl.exe. We are targeting the MSVC ABI and am reaching the final linking issues (I hope!).
The problem I have now is that it’s not finding some sse intrinsics:
error: lld-link: undefined symbol: _mm_setzero_si128
note: referenced by C:\Projects\elvengroin-legacy\external\ze-forge\external\The-Forge\Common_3\Graphics\ThirdParty\OpenSource\winpixeventruntime\Include\WinPixEventRuntime\PIXEventsCommon.h:357
note: ze_forge_c_cpp.lib(Direct3D12_cxx.obj):(void __cdecl PIXCopyEventArgument<char const *>(unsigned __int64 *&, unsigned __int64 const *, char const *))
I’ve tried adding #include <emmintrin.h>
to no avail. I added “-msse2” to my cflags like so:
const cflags = &.{
"-DTIDES",
"-DD3D12_AGILITY_SDK=1",
"-DD3D12_AGILITY_SDK_VERSION=715",
"-msse2",
};
ze_forge_c_cpp.addIncludePath(b.path("../../tools/external/msvc/Windows Kits/10/Include/10.0.22621.0/shared"));
ze_forge_c_cpp.addIncludePath(b.path("../../tools/external/msvc/Windows Kits/10/Include/10.0.22621.0/ucrt"));
ze_forge_c_cpp.addIncludePath(b.path("../../tools/external/msvc/Windows Kits/10/Include/10.0.22621.0/um"));
ze_forge_c_cpp.addIncludePath(b.path("../../tools/external/msvc_BuildTools/VC/Tools/MSVC/14.39.33519/include"));
ze_forge_c_cpp.addCSourceFiles(.{
.files = &.{
// Single header libraries
"src/single_header_wrapper.cpp",
// The-forge graphics
"external/The-Forge/Common_3/Graphics/GraphicsConfig.cpp",
"external/The-Forge/Common_3/Graphics/Direct3D12/Direct3D12_cxx.cpp",
"external/The-Forge/Common_3/Graphics/Direct3D12/Direct3D12.c",
"external/The-Forge/Common_3/Graphics/Direct3D12/Direct3D12Hooks.c",
"external/The-Forge/Common_3/Graphics/Direct3D12/Direct3D12Raytracing.c",
"external/The-Forge/Common_3/Utilities/ThirdParty/OpenSource/bstrlib/bstrlib.c",
// Glue
"external/The-Forge/Common_3/Graphics/Interfaces/IGraphics_glue.cpp",
"external/The-Forge/Common_3/Graphics/Interfaces/IRay_glue.cpp",
// TIDES Graphics
"external/The-Forge/Common_3/Graphics/GraphicsTides.c",
"external/The-Forge/Common_3/Graphics/Interfaces/IGraphicsTides_glue.cpp",
// TIDES
"external/The-Forge/Common_3/Tides/WindowsFileSystem.c",
"external/The-Forge/Common_3/Tides/WindowsLog.c",
"external/The-Forge/Common_3/Tides/WindowsMemory.c",
"external/The-Forge/Common_3/Tides/WindowsThread.c",
},
.flags = cflags,
});
Building with this command line:
"command": "zig build -Dtarget=native-native-msvc --verbose",
Would appreciate any help!