Fails to link: unresolved externals from 'pathcch.h' (Windows)
JasperVanEsveld opened this issue · 10 comments
Tried to build the example and another project but always get this error.
pathcch.h
is part of the win32 library but I should have all the necessary build tools for c++ installed (at least I think so the SDL crate works fine for example)
This is the error:
libopenxr_sys-9008a7c2938b17d8.rlib(filesystem_utils.obj) : error LNK2019: unresolved external symbol __imp_PathCchCanonicalize referenced in function "bool __cdecl FileSysUtilsGetCanonicalPath(class std::basic_string<char,struct std::char_traits<char>,class std::allocaferenced in function "bool __cdecl FileSysUtilsGetCanonicalPath(class std::basic_string<chartor<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?FileSysUtilsGetCanonicalPalocator<char> > &)" (?FileSysUtilsGetCanonicalPath@@YA_NAEBV?$basic_string@DU?$char_traits@Dth@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAV12@@Z)
Is there something I am missing?
This is likely a bug on our end; thanks for the report! OpenXR 1.0.11 added a use of PathCchCanonicalize
and I need to work out what incantation is necessary to make rust link the definition.
Thanks for the quick reply!
But sadly it doesn't seem to work for me, get the same error :(
Can you reproduce it? Might be my setup...
Just checked some older versions and 0.11.0
seems to work, might be because it uses an older OpenXR version
Thought that might be useful to know
Thanks for the quick reply!
But sadly it doesn't seem to work for me, get the same error :(
Can you reproduce it? Might be my setup...
I'm also running into this issue.
Thanks for the report. The call was added in OpenXR 1.0.11, so older versions of openxrs, which use older versions of the OpenXR loader, should work fine; I recommend rolling back to those until I have time to dig into this further, which should be within the week, unless someone else is able to investigate and make a PR.
Got some time to test this on my windows box and, oddly, master works just fine for me:
C:\Users\Ralith\src\openxrs\openxr [master ≡]> cargo run --example vulkan --features static
Finished dev [unoptimized + debuginfo] target(s) in 0.07s
Running `C:\Users\Ralith\src\openxrs\target\debug\examples\vulkan.exe`
loaded OpenXR runtime: SteamVR/OpenXR 0.1.0
What version of MSVC are you using?
Hmm that's interesting...
I am using MSVC v142 (v14.27)
Had an inverted condition in the first draft of the fix; should work fine now. Published openxr-sys 0.8.4 with the fix.
I'm running into issues with building with openxr itself. It appears that the symbol for PathCchCanonicalize
isn't anywhere to be found on builds that are outside of MSVS. It appears you need a compiler that is newer than about 7.1ish with mingw. It apparently is in C:\Windows\System32\api-ms-core-path...dll
, however, 1.) a lot of users are missing this on their systems, 2.) people using other compilers such as mingw64 don't directly have a reference to it yet as it should be something in libstdc++fs
(its experiemental, ack why do you do this) However, you can just piggyback off a lot of windows native dlls because they INCLUDE the reference to it. It is in Pathcch.lib
and its a static library.