-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[shortfin] Windows builds failing when compiling compound literals #534
Comments
Thanks. I've half way set up my windows machine for development a few times over the last two weeks but keep getting distracted. This is the sort of thing that is probably an easy fix, but if I'm doing it, I have to put hands on it and fiddle with it to have an insight. |
I'm not good at reading msvc flags, but it looks to me like before iree was being treated as a system include and after normal. So this error was probably always there but being suppressed by the leniency of being a system include? |
Some clues:
|
Found another warning, also pointing to C vs C++:
|
With iree-org/iree#19346, I can build the
If I switch to dynamic linking (as Linux does by default) using
... progress? |
This doesn't look intentional (added in #434) and it contributes to #534: ``` [main] Building folder: d:/dev/projects/shark-ai/shortfin/build [build] Starting build [proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build d:/dev/projects/shark-ai/shortfin/build --config RelWithDebInfo --target shortfin_array_test -- [build] [1/2 0% :: 0.041] Re-checking globbed directories... [build] [1/1 100% :: 0.240] Linking CXX executable src\shortfin\array\shortfin_array_test.exe [build] FAILED: src/shortfin/array/shortfin_array_test.exe src/shortfin/array/shortfin_array_test[1]_tests.cmake D:/dev/projects/shark-ai/shortfin/build/src/shortfin/array/shortfin_array_test[1]_tests.cmake [build] C:\WINDOWS\system32\cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=src\shortfin\array\CMakeFiles\shortfin_array_test.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests -- C:\PROGRA~2\MICROS~1\2022\BUILDT~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\shortfin_array_test.rsp /out:src\shortfin\array\shortfin_array_test.exe /implib:src\shortfin\array\shortfin_array_test.lib /pdb:src\shortfin\array\shortfin_array_test.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console -natvis:D:/dev/projects/iree/runtime/iree.natvis /INCREMENTAL:NO /LTCG && C:\WINDOWS\system32\cmd.exe /C "cd /D D:\dev\projects\shark-ai\shortfin\build\src\shortfin\array && "C:\Program Files\CMake\bin\cmake.exe" -D TEST_TARGET=shortfin_array_test -D TEST_EXECUTABLE=D:/dev/projects/shark-ai/shortfin/build/src/shortfin/array/shortfin_array_test.exe -D TEST_EXECUTOR= -D TEST_WORKING_DIR=D:/dev/projects/shark-ai/shortfin/build -D TEST_EXTRA_ARGS= -D TEST_PROPERTIES= -D TEST_PREFIX= -D TEST_SUFFIX= -D TEST_FILTER= -D NO_PRETTY_TYPES=FALSE -D NO_PRETTY_VALUES=FALSE -D TEST_LIST=shortfin_array_test_TESTS -D CTEST_FILE=D:/dev/projects/shark-ai/shortfin/build/src/shortfin/array/shortfin_array_test[1]_tests.cmake -D TEST_DISCOVERY_TIMEOUT=5 -D TEST_XML_OUTPUT_DIR= -P "C:/Program Files/CMake/share/cmake-3.30/Modules/GoogleTestAddTests.cmake""" [build] LINK: command "C:\PROGRA~2\MICROS~1\2022\BUILDT~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\shortfin_array_test.rsp /out:src\shortfin\array\shortfin_array_test.exe /implib:src\shortfin\array\shortfin_array_test.lib /pdb:src\shortfin\array\shortfin_array_test.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console -natvis:D:/dev/projects/iree/runtime/iree.natvis /INCREMENTAL:NO /LTCG /MANIFEST:EMBED,ID=1" failed (exit code 1120) with the following output: [build] array_test.cc.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class shortfin::local::Worker & __cdecl shortfin::local::System::init_worker(void)" (__imp_?init_worker@System@local@shortfin@@QEAAAEAVWorker@23@XZ) [build] array_test.cc.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::shared_ptr<class shortfin::local::Fiber> __cdecl shortfin::local::System::CreateFiber(class shortfin::local::Worker &,class std::span<class shortfin::local::Device * const,-1>)" (__imp_?CreateFiber@System@local@shortfin@@qeaa?AV?$shared_ptr@VFiber@local@shortfin@@@std@@AEAVWorker@23@V?$span@QEAVDevice@local@shortfin@@$0?0@5@@z) ... [build] src\shortfin\array\shortfin_array_test.exe : fatal error LNK1120: 50 unresolved externals [build] ninja: build stopped: subcommand failed. [proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --build d:/dev/projects/shark-ai/shortfin/build --config RelWithDebInfo --target shortfin_array_test -- exited with code: 1 [driver] Build completed: 00:00:00.301 [build] Build finished with exit code 1 ```
If iree-org/iree#19346 is merged and we get a successful release build tonight, I think we can update shortfin to depend on |
Progress on this downstream build issue: nod-ai/shark-ai#534. I haven't figured out specifically why the downstream build hits errors here while upstream is fine, but these changes aren't that intrusive. --------- Co-authored-by: Ben Vanik <[email protected]>
…#19346) Progress on this downstream build issue: nod-ai/shark-ai#534. I haven't figured out specifically why the downstream build hits errors here while upstream is fine, but these changes aren't that intrusive. --------- Co-authored-by: Ben Vanik <[email protected]> Signed-off-by: Giacomo Serafini <[email protected]>
This doesn't look intentional (added in #434) and it contributes to #534: ``` [main] Building folder: d:/dev/projects/shark-ai/shortfin/build [build] Starting build [proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build d:/dev/projects/shark-ai/shortfin/build --config RelWithDebInfo --target shortfin_array_test -- [build] [1/2 0% :: 0.041] Re-checking globbed directories... [build] [1/1 100% :: 0.240] Linking CXX executable src\shortfin\array\shortfin_array_test.exe [build] FAILED: src/shortfin/array/shortfin_array_test.exe src/shortfin/array/shortfin_array_test[1]_tests.cmake D:/dev/projects/shark-ai/shortfin/build/src/shortfin/array/shortfin_array_test[1]_tests.cmake [build] C:\WINDOWS\system32\cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=src\shortfin\array\CMakeFiles\shortfin_array_test.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests -- C:\PROGRA~2\MICROS~1\2022\BUILDT~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\shortfin_array_test.rsp /out:src\shortfin\array\shortfin_array_test.exe /implib:src\shortfin\array\shortfin_array_test.lib /pdb:src\shortfin\array\shortfin_array_test.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console -natvis:D:/dev/projects/iree/runtime/iree.natvis /INCREMENTAL:NO /LTCG && C:\WINDOWS\system32\cmd.exe /C "cd /D D:\dev\projects\shark-ai\shortfin\build\src\shortfin\array && "C:\Program Files\CMake\bin\cmake.exe" -D TEST_TARGET=shortfin_array_test -D TEST_EXECUTABLE=D:/dev/projects/shark-ai/shortfin/build/src/shortfin/array/shortfin_array_test.exe -D TEST_EXECUTOR= -D TEST_WORKING_DIR=D:/dev/projects/shark-ai/shortfin/build -D TEST_EXTRA_ARGS= -D TEST_PROPERTIES= -D TEST_PREFIX= -D TEST_SUFFIX= -D TEST_FILTER= -D NO_PRETTY_TYPES=FALSE -D NO_PRETTY_VALUES=FALSE -D TEST_LIST=shortfin_array_test_TESTS -D CTEST_FILE=D:/dev/projects/shark-ai/shortfin/build/src/shortfin/array/shortfin_array_test[1]_tests.cmake -D TEST_DISCOVERY_TIMEOUT=5 -D TEST_XML_OUTPUT_DIR= -P "C:/Program Files/CMake/share/cmake-3.30/Modules/GoogleTestAddTests.cmake""" [build] LINK: command "C:\PROGRA~2\MICROS~1\2022\BUILDT~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\shortfin_array_test.rsp /out:src\shortfin\array\shortfin_array_test.exe /implib:src\shortfin\array\shortfin_array_test.lib /pdb:src\shortfin\array\shortfin_array_test.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console -natvis:D:/dev/projects/iree/runtime/iree.natvis /INCREMENTAL:NO /LTCG /MANIFEST:EMBED,ID=1" failed (exit code 1120) with the following output: [build] array_test.cc.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class shortfin::local::Worker & __cdecl shortfin::local::System::init_worker(void)" (__imp_?init_worker@System@local@shortfin@@QEAAAEAVWorker@23@XZ) [build] array_test.cc.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::shared_ptr<class shortfin::local::Fiber> __cdecl shortfin::local::System::CreateFiber(class shortfin::local::Worker &,class std::span<class shortfin::local::Device * const,-1>)" (__imp_?CreateFiber@System@local@shortfin@@qeaa?AV?$shared_ptr@VFiber@local@shortfin@@@std@@AEAVWorker@23@V?$span@QEAVDevice@local@shortfin@@$0?0@5@@z) ... [build] src\shortfin\array\shortfin_array_test.exe : fatal error LNK1120: 50 unresolved externals [build] ninja: build stopped: subcommand failed. [proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --build d:/dev/projects/shark-ai/shortfin/build --config RelWithDebInfo --target shortfin_array_test -- exited with code: 1 [driver] Build completed: 00:00:00.301 [build] Build finished with exit code 1 ```
Diff: iree-org/iree@iree-3.0.0rc20241118...iree-3.1.0rc20241204 Notable changes that could affect shortfin: * iree-org/iree@cd4aa72 "[runtime][python] Fix device array deepcopy when not mappable" * iree-org/iree@ef4ecf3 "[iree.build] Wire up out of process concurrency." * iree-org/iree@516ff10 "[python] Overhaul iree.build console output and error handling." * iree-org/iree@9789438 "[iree.build] Make the fetch_http action more robust." * iree-org/iree@006c5d8 "Avoid compound literal struct init for better C/C++ compat." This update (particularly the last commit there) fixes #534 (the Windows build was broken).
Windows builds of shortfin have been failing since #434
Logs just before: https://github.com/nod-ai/SHARK-Platform/actions/runs/11746567811/job/32726612800
Logs just after: https://github.com/nod-ai/SHARK-Platform/actions/runs/11747537463/job/32729660296
Sample error message:
https://stackoverflow.com/questions/33270731/error-c4576-in-vs2015-enterprise suggests that is trying to compile a C source file as C++ while using non-standard compound literals like
Diffing the
compile_commands.json
locally before and after the culprit commit, I see/GL
(Whole program optimization) flag (https://learn.microsoft.com/en-us/cpp/build/reference/gl-whole-program-optimization?view=msvc-170)-external:ID
for IREE deps-D_SHORTFIN_USING_DYLIB
defineFor example,
shortfin_array_test
before (working):and after (broken):
Diffing those commands, left is original (working), right is after the change that broke the build:
![image](https://private-user-images.githubusercontent.com/4010439/386469295-54b43d1c-4baa-4e7f-89c7-913bf7cf17ef.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzMDYzNTIsIm5iZiI6MTczOTMwNjA1MiwicGF0aCI6Ii80MDEwNDM5LzM4NjQ2OTI5NS01NGI0M2QxYy00YmFhLTRlN2YtODljNy05MTNiZjdjZjE3ZWYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMjAzNDEyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NDAxN2QyZDA2NWM5YmRkM2IxMDg1ZTQ2YTUzNDU1MmNjNWUxMDFkN2VjNzgxY2QzYmY5OGNhNDQzYzgzMTIzMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.PPBooGRcAiDRAWTyYQqqRvhIzx3SIwHwE7zyiVXC_s8)
I also considered the C/C++ standard versions - IREE builds with C++17 while shortfin builds with C++20. Compiling
iree-run-module
upstream with C++20 on MSVC reports no errors, and compiling shortfin with C++17 complains about missing symbols (e.g.std::span
, new in C++20).The text was updated successfully, but these errors were encountered: