Tries to open nonexistent .d file in LLVM ASM build
tru opened this issue · comments
Hi,
Another weird one (sorry!). After #78 was fixed I was able to build .cpp files from the LLVM repo on Windows, but I run into problems with ASM files, here is the error:
read lib\Support\BLAKE3\CMakeFiles\LLVMSupportBlake3.dir\blake3_avx2_x86-64_windows_msvc.asm.obj.d: The system cannot find the file specified. (os error 2)
Here is the command invocation:
C:\PROGRA~1\MIB055~1\2022\PROFES~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\ml64.exe -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -IC:\code\llvm\llvm-project\out\debug\lib\Support\BLAKE3 -IC:\code\llvm\llvm-project\llvm\lib\Support\BLAKE3 -IC:\code\llvm\llvm-project\out\debug\include -IC:\code\llvm\llvm-project\llvm\include -c -Fo lib\Support\BLAKE3\CMakeFiles\LLVMSupportBlake3.dir\blake3_avx2_x86-64_windows_msvc.asm.obj C:\code\llvm\llvm-project\llvm\lib\Support\BLAKE3\blake3_avx2_x86-64_windows_msvc.asm
failed: Building ASM_MASM object lib\Support\BLAKE3\CMakeFiles\LLVMSupportBlake3.dir\blake3_avx2_x86-64_windows_msvc.asm.obj
I am guessing that n2 tries to find the dependency file for the .asm file, but ml64 doesn't output (maybe no assemblers do?). Hopefully an easy fix.
Any thoughts on this one @evmar ?
Sorry for not responding! Can you find the relevant snippet of the build.ninja
file that runs that command? n2 is only supposed to look for that .d
file if the build.ninja
mentions a depfile
attribute, maybe something is going wrong in how n2 is parsing the file?
(Alternatively, you could attach your entire build.ninja file and I could take a look)
Ping @tru :)
I'll wait for someone else to repro, no prob.
Hi! So sorry I didn't reply, it's been busy days for me. But I pulled latest from the n2 repo and reproduced it with llvm-project
- n2.exe installed as
ninja.exe
- ran
ninja LLVMSupportBlake3
C:\PROGRA~1\MIB055~1\2022\PROFES~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\ml64.exe -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_GLIBCXX_ASSERTIONS -D_HAS_EXCEPTIONS=0 -D_LIBCPP_ENABLE_HARDENED_MODE -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -IC:/code/llvm/llvm-project/out/debug/lib/Support/BLAKE3 -IC:/code/llvm/llvm-project/llvm/lib/Support/BLAKE3 -IC:/code/llvm/llvm-project/out/debug/include -IC:/code/llvm/llvm-project/llvm/include -c -Fo lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_sse41_x86-64_windows_msvc.asm.obj C:/code/llvm/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_windows_msvc.asm
failed: Building ASM_MASM object lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_sse2_x86-64_windows_msvc.asm.obj
Attached is the build.ninja file.
@evmar did you see my reply on this one? I just retried it today and it still have the same problem. I can provide new files if you want.
I didn’t, thanks for pinging oops!
It looks like the relevant snippet is
build lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_sse2_x86-64_windows_msvc.asm.obj: ASM_MASM_COMPILER__LLVMSupportBlake3_unscanned_Debug C$:/code/llvm/llvm-project/llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_windows_msvc.asm || cmake_object_order_depends_target_LLVMSupportBlake3
DEFINES = -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_GLIBCXX_ASSERTIONS -D_HAS_EXCEPTIONS=0 -D_LIBCPP_ENABLE_HARDENED_MODE -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
DEP_FILE = lib\Support\BLAKE3\CMakeFiles\LLVMSupportBlake3.dir\blake3_sse2_x86-64_windows_msvc.asm.obj.d
INCLUDES = -IC:/code/llvm/llvm-project/out/debug/lib/Support/BLAKE3 -IC:/code/llvm/llvm-project/llvm/lib/Support/BLAKE3 -IC:/code/llvm/llvm-project/out/debug/include -IC:/code/llvm/llvm-project/llvm/include
OBJECT_DIR = lib\Support\BLAKE3\CMakeFiles\LLVMSupportBlake3.dir
OBJECT_FILE_DIR = lib\Support\BLAKE3\CMakeFiles\LLVMSupportBlake3.dir
TARGET_COMPILE_PDB = lib\Support\BLAKE3\CMakeFiles\LLVMSupportBlake3.dir\
TARGET_PDB = ""
but I don't see the definition of ASM_MASM_COMPILER__LLVMSupportBlake3_unscanned_Debug
here, I think it might be in one of the adjacent .ninja files CMake generates?
@evmar i don't have access to a computer right now, but it just does depfile = $DEP_FILE for rule definition. I then compared how ninja handled this and stepped through it in the debugger and noticed that it just ignored the not found error. So I think this is the "right" fix.
Some notes from random digging:
- it seems like the ASM_MASM related logic is part of CMake, not LLVM specific
- some discussion of depfiles with assembly here https://gitlab.kitware.com/cmake/cmake/-/issues/20426
- as best as I can gather, cmake basically unconditionally sets DEP_FILE, while masm is the MS assembler that doesn't support writing depfiles
So I conclude treating missing files as empty is more or less right.