MLA icon indicating copy to clipboard operation
MLA copied to clipboard

CI: restore latest toolchain for Windows' bindings tests

Open commial opened this issue 2 years ago • 1 comments

Track the temporary fix introduced in #172

commial avatar Aug 11 '23 20:08 commial

UPDATE Bug still happens with the most recent toolchain (1.79, 06/2024)

Here is the error obtained in the CI, using a 1.70 toolchain:

ClCompile:
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\CL.exe /c /I"D:\a\MLA\MLA\bindings\C\tests\windows-msvc\\..\..\\" /Zi /nologo /W3 /WX- /diagnostics:column /sdl /O2 /Oi /GL /D NDEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /permissive- /Fo"x64\Release-cpp\\" /Fd"x64\Release-cpp\vc143.pdb" /external:W3 /Gd /TP /FC /errorReport:queue src\read.c src\main.c src\write.c
  read.c
  main.c
  write.c
Link:
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\link.exe /ERRORREPORT:QUEUE /OUT:"D:\a\MLA\MLA\bindings\C\tests\windows-msvc\x64\Release-cpp\mla-bindings-test.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"D:\a\MLA\MLA\bindings\C\tests\windows-msvc\\..\..\..\..\target\x86_64-pc-windows-msvc\release" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Bcrypt.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"D:\a\MLA\MLA\bindings\C\tests\windows-msvc\x64\Release-cpp\mla-bindings-test.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG:incremental /LTCGOUT:"x64\Release-cpp\mla-bindings-test.iobj" /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"D:\a\MLA\MLA\bindings\C\tests\windows-msvc\x64\Release-cpp\mla-bindings-test.lib" /MACHINE:X64 "x64\Release-cpp\read.obj"
  "x64\Release-cpp\main.obj"
  "x64\Release-cpp\write.obj"
mla.lib(mla.mla.466e2007-cgu.11.rcgu.o) : error LNK2001: unresolved external symbol __imp_NtWriteFile [D:\a\MLA\MLA\bindings\C\tests\windows-msvc\mla-bindings-test.vcxproj]
mla.lib(mla.mla.466e2007-cgu.11.rcgu.o) : error LNK2001: unresolved external symbol __imp_RtlNtStatusToDosError [D:\a\MLA\MLA\bindings\C\tests\windows-msvc\mla-bindings-test.vcxproj]
D:\a\MLA\MLA\bindings\C\tests\windows-msvc\x64\Release-cpp\mla-bindings-test.exe : fatal error LNK1120: 2 unresolved externals [D:\a\MLA\MLA\bindings\C\tests\windows-msvc\mla-bindings-test.vcxproj]
Done Building Project "D:\a\MLA\MLA\bindings\C\tests\windows-msvc\mla-bindings-test.vcxproj" (default targets) -- FAILED.
Done Building Project "D:\a\MLA\MLA\bindings\C\tests\windows-msvc\mla-bindings-test.sln" (default targets) -- FAILED.

Build FAILED.

commial avatar Aug 11 '23 20:08 commial

From what I understand, since Cargo 1.70 ntdll.lib might have to be added to the dependency list at link time.

This is what rustc indicates:

# Tested on bindings/C 
$ cargo rustc -- --print=native-static-libs
...
note: Link against the following native artifacts when linking against this static library. The order and any duplication can be significant on some platforms.

note: native-static-libs: bcrypt.lib advapi32.lib kernel32.lib advapi32.lib kernel32.lib ntdll.lib userenv.lib ws2_32.lib kernel32.lib ws2_32.lib kernel32.lib msvcrt.lib /defaultlib:msvcrt

As a result, from what I understand, this is not a bug in MLA but more a lack of configuration on the user's side.

In MLA C bindings, adding this dependency (as asked by rustc) indeed fixed the problem (see #203).

Feel free to re-open this issue if I'm missing something

commial avatar Jun 17 '24 09:06 commial