eliemichel / WebGPU-distribution

Distributions of WebGPU for native and web development, easy to integrate and interchangeable.
MIT License
159 stars 29 forks source link

Linker errors when using WGPU_STATIC on Windows. #26

Closed jpvanoosten closed 2 months ago

jpvanoosten commented 4 months ago

There seems to be a few missing linker dependencies when building on Windows with Visual Studio (2022):

2>wgpu_native.lib(wgpu_hal-21a2669e9a4b6f3d.wgpu_hal.c844be58bcd8d3b9-cgu.08.rcgu.o) : error LNK2019: unresolved external symbol D3DCompile referenced in function _ZN8wgpu_hal4dx1218shader_compilation11compile_fxc17h94f0681312997f6dE
2>wgpu_native.lib(d3d12-b1866654668b3c45.d3d12.af2eaf182a9b6ae4-cgu.02.rcgu.o) : error LNK2001: unresolved external symbol D3DCompile
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_WSAStartup referenced in function _ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hea0dfd090d9b6559E
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_WSACleanup referenced in function _ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hea0dfd090d9b6559E
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_GetUserProfileDirectoryW referenced in function _ZN3std3env8home_dir17hdf3b75cf9eb95110E
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_freeaddrinfo referenced in function _ZN3std3net11socket_addr19resolve_socket_addr17h0839a289114a234bE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_closesocket referenced in function _ZN3std3net3tcp9TcpStream15connect_timeout17hf2596e873959a9ceE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_shutdown referenced in function _ZN3std3net3tcp9TcpStream8shutdown17h8bc58db5114b1b1dE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_WSAGetLastError referenced in function _ZN3std3net3tcp9TcpStream8shutdown17h8bc58db5114b1b1dE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_setsockopt referenced in function _ZN3std3net3udp9UdpSocket16set_read_timeout17hc548e6b30c5f5731E
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_getsockopt referenced in function _ZN3std3net3udp9UdpSocket12read_timeout17he4231926e606f04dE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_recv referenced in function _ZN3std3net3udp9UdpSocket4peek17h7493cbf0ec3f5ef7E
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_WSARecv referenced in function _ZN58_$LT$std..net..tcp..TcpStream$u20$as$u20$std..io..Read$GT$13read_vectored17heb0af28d554245caE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_WSASend referenced in function _ZN59_$LT$std..net..tcp..TcpStream$u20$as$u20$std..io..Write$GT$14write_vectored17h455dff9d4bf60a6cE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_send referenced in function _ZN63_$LT$$RF$std..net..tcp..TcpStream$u20$as$u20$std..io..Write$GT$5write17hcc4c5a1e9624a27aE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_accept referenced in function _ZN3std3net3tcp11TcpListener6accept17h3c50cc6373db434dE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_ioctlsocket referenced in function _ZN3std3net3udp9UdpSocket15set_nonblocking17h215c9d815ff7033dE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_getpeername referenced in function _ZN3std3net3udp9UdpSocket9peer_addr17h285c43efcdd990d5E
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_WSADuplicateSocketW referenced in function _ZN3std2os7windows2io6socket14BorrowedSocket18try_clone_to_owned17ha9c6f2cb604dca2fE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_WSASocketW referenced in function _ZN3std2os7windows2io6socket14BorrowedSocket18try_clone_to_owned17ha9c6f2cb604dca2fE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_getaddrinfo referenced in function _ZN3std3sys3pal6common14small_c_string24run_with_cstr_allocating17hdf59e8a7e283b178E
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_NtCreateFile referenced in function _ZN3std3sys3pal7windows2fs20open_link_no_reparse17hf2864d8910ff818fE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_RtlNtStatusToDosError referenced in function _ZN3std3sys3pal7windows2fs20open_link_no_reparse17hf2864d8910ff818fE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_NtReadFile referenced in function _ZN3std3sys3pal7windows6handle6Handle16synchronous_read17he0b51a826267a068E
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_NtWriteFile referenced in function _ZN3std3sys3pal7windows6handle6Handle17synchronous_write17hd3de3e3226d626e2E
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_connect referenced in function _ZN3std3sys3pal7windows3net6Socket7connect17h81366a65fbc5cec1E
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_select referenced in function _ZN3std3sys3pal7windows3net6Socket15connect_timeout17h3a6cce3188998d56E
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_recvfrom referenced in function _ZN3std3sys3pal7windows3net6Socket20recv_from_with_flags17h25892c96af5d128bE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_BCryptGenRandom referenced in function _ZN3std3sys3pal7windows4pipe9anon_pipe17hcc3826893a105330E
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_bind referenced in function _ZN3std10sys_common3net11TcpListener4bind17h755146070011b4cfE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_listen referenced in function _ZN3std10sys_common3net11TcpListener4bind17h755146070011b4cfE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_getsockname referenced in function _ZN3std10sys_common3net11TcpListener11socket_addr17h41c84ca5ec58dd5aE
2>wgpu_native.lib(std-7dd4d7539658daae.std.276301afa239de20-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_sendto referenced in function _ZN3std10sys_common3net9UdpSocket7send_to17hfa7a992968fd5d56E
2>wgpu_native.lib(wgpu_hal-21a2669e9a4b6f3d.wgpu_hal.c844be58bcd8d3b9-cgu.11.rcgu.o) : error LNK2019: unresolved external symbol wglGetCurrentContext referenced in function _ZN4core3ptr60drop_in_place$LT$wgpu_hal..gles..wgl..AdapterContextLock$GT$17h2d88ed194bb39975E
2>wgpu_native.lib(wgpu_hal-21a2669e9a4b6f3d.wgpu_hal.c844be58bcd8d3b9-cgu.01.rcgu.o) : error LNK2001: unresolved external symbol wglGetCurrentContext
2>wgpu_native.lib(wgpu_hal-21a2669e9a4b6f3d.wgpu_hal.c844be58bcd8d3b9-cgu.11.rcgu.o) : error LNK2019: unresolved external symbol wglMakeCurrent referenced in function _ZN4core3ptr60drop_in_place$LT$wgpu_hal..gles..wgl..AdapterContextLock$GT$17h2d88ed194bb39975E
2>wgpu_native.lib(wgpu_hal-21a2669e9a4b6f3d.wgpu_hal.c844be58bcd8d3b9-cgu.01.rcgu.o) : error LNK2001: unresolved external symbol wglMakeCurrent
2>wgpu_native.lib(wgpu_hal-21a2669e9a4b6f3d.wgpu_hal.c844be58bcd8d3b9-cgu.11.rcgu.o) : error LNK2019: unresolved external symbol wglDeleteContext referenced in function _ZN73_$LT$wgpu_hal..gles..wgl..WglContext$u20$as$u20$core..ops..drop..Drop$GT$4drop17h4d21bf075805fa49E
2>wgpu_native.lib(wgpu_hal-21a2669e9a4b6f3d.wgpu_hal.c844be58bcd8d3b9-cgu.11.rcgu.o) : error LNK2019: unresolved external symbol wglGetProcAddress referenced in function _ZN8wgpu_hal4gles3wgl12load_gl_func17hec3fcd5dd7944da4E
2>wgpu_native.lib(wgpu_hal-21a2669e9a4b6f3d.wgpu_hal.c844be58bcd8d3b9-cgu.11.rcgu.o) : error LNK2019: unresolved external symbol wglCreateContext referenced in function _ZN95_$LT$wgpu_hal..gles..wgl..Instance$u20$as$u20$wgpu_hal..Instance$LT$wgpu_hal..gles..Api$GT$$GT$4init17he1297493c3201789E

Adding the following libraries manually fixes it:

But it would be nice if these are added to the library dependencies on Windows.

jpvanoosten commented 3 months ago

This issue is fixed in #27