Open Zephilinox opened 3 years ago
Duplicate of #950? Try looking at the debug logs for the server. I have a PR to improve the documentation for that.
Duplicate of #950? Try looking at the debug logs for the server. I have a PR to improve the documentation for that.
thanks :) logs show stuff like the following, so doesn't seem to be the same issue
[0m[38;5;8m[[0m2021-02-16T22:57:43Z [0m[34mDEBUG[0m sccache::server[0m[38;5;8m][0m handle_client: compile
[0m[38;5;8m[[0m2021-02-16T22:57:43Z [0m[34mDEBUG[0m sccache::server[0m[38;5;8m][0m check_compiler: Supported compiler
[0m[38;5;8m[[0m2021-02-16T22:57:43Z [0m[34mDEBUG[0m sccache::server[0m[38;5;8m][0m parse_arguments: Ok: ["/nologo", "/TP", "-DFMT_HEADER_ONLY=1", "-DNOMINMAX", "-DWIN32_LEAN_AND_MEAN", "-D_CRT_SECURE_NO_WARNINGS", "-I_deps\\element-src\\libelement\\include", "-I_deps\\element-src\\libelement\\src", "-I_deps\\element-src\\libelement\\dependencies\\memorypool", "-I_deps\\element-src\\libelement\\..\\LMNT\\include", "-I_deps\\element-build\\libelement", "-I_deps\\utfcpp-src\\source", "-I_deps\\ghc_filesystem-src\\include", "-I_deps\\fmt-src\\include", "/DWIN32", "/D_WINDOWS", "/W3", "/GR", "/EHsc", "/Zc:__cplusplus", "/permissive-", "/MDd", "/Zi", "/Ob0", "/Od", "/RTC1", "/MP", "/utf-8", "-std:c++17", "/showIncludes", "/Fo_deps\\element-build\\libelement\\CMakeFiles\\element.dir\\src\\object_model\\intermediaries\\declaration_wrapper.cpp.obj", "/Fd_deps\\element-build\\libelement\\CMakeFiles\\element.dir\\element.pdb", "/FS", "-c", "_deps\\element-src\\libelement\\src\\object_model\\intermediaries\\declaration_wrapper.cpp"]
[0m[38;5;8m[[0m2021-02-16T22:57:43Z [0m[34mDEBUG[0m sccache::compiler::compiler[0m[38;5;8m][0m [declaration_wrapper.cpp.obj]: get_cached_or_compile: ["/nologo", "/TP", "-DFMT_HEADER_ONLY=1", "-DNOMINMAX", "-DWIN32_LEAN_AND_MEAN", "-D_CRT_SECURE_NO_WARNINGS", "-I_deps\\element-src\\libelement\\include", "-I_deps\\element-src\\libelement\\src", "-I_deps\\element-src\\libelement\\dependencies\\memorypool", "-I_deps\\element-src\\libelement\\..\\LMNT\\include", "-I_deps\\element-build\\libelement", "-I_deps\\utfcpp-src\\source", "-I_deps\\ghc_filesystem-src\\include", "-I_deps\\fmt-src\\include", "/DWIN32", "/D_WINDOWS", "/W3", "/GR", "/EHsc", "/Zc:__cplusplus", "/permissive-", "/MDd", "/Zi", "/Ob0", "/Od", "/RTC1", "/MP", "/utf-8", "-std:c++17", "/showIncludes", "/Fo_deps\\element-build\\libelement\\CMakeFiles\\element.dir\\src\\object_model\\intermediaries\\declaration_wrapper.cpp.obj", "/Fd_deps\\element-build\\libelement\\CMakeFiles\\element.dir\\element.pdb", "/FS", "-c", "_deps\\element-src\\libelement\\src\\object_model\\intermediaries\\declaration_wrapper.cpp"]
[0m[38;5;8m[[0m2021-02-16T22:57:43Z [0m[34mDEBUG[0m sccache::compiler::msvc[0m[38;5;8m][0m preprocess: Some("C:\\PROGRA~2\\MICROS~1\\2019\\COMMUN~1\\VC\\Tools\\MSVC\\1427~1.291\\bin\\Hostx64\\x64\\cl.exe" "-EP" "_deps\\element-src\\libelement\\src\\object_model\\intermediaries\\declaration_wrapper.cpp" "-nologo" "-DFMT_HEADER_ONLY=1" "-DNOMINMAX" "-DWIN32_LEAN_AND_MEAN" "-D_CRT_SECURE_NO_WARNINGS" "-I_deps\\element-src\\libelement\\include" "-I_deps\\element-src\\libelement\\src" "-I_deps\\element-src\\libelement\\dependencies\\memorypool" "-I_deps\\element-src\\libelement\\..\\LMNT\\include" "-I_deps\\element-build\\libelement" "-I_deps\\utfcpp-src\\source" "-I_deps\\ghc_filesystem-src\\include" "-I_deps\\fmt-src\\include" "/DWIN32" "/D_WINDOWS" "/showIncludes" "/nologo" "/TP" "/W3" "/GR" "/EHsc" "/Zc:__cplusplus" "/permissive-" "/MDd" "/Zi" "/Ob0" "/Od" "/RTC1" "/utf-8" "-std:c++17" "/Fd_deps\\element-build\\libelement\\CMakeFiles\\element.dir\\element.pdb")
[0m[38;5;8m[[0m2021-02-16T22:57:43Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m adding I/O source: 3615490051
[0m[38;5;8m[[0m2021-02-16T22:57:43Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m adding I/O source: 3619684354
[0m[38;5;8m[[0m2021-02-16T22:57:43Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m dropping I/O source: 3
[0m[38;5;8m[[0m2021-02-16T22:57:43Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m dropping I/O source: 2
[0m[38;5;8m[[0m2021-02-16T22:57:43Z [0m[34mDEBUG[0m sccache::compiler::compiler[0m[38;5;8m][0m [declaration_wrapper.cpp.obj]: generate_hash_key took 0.293 s
[0m[38;5;8m[[0m2021-02-16T22:57:43Z [0m[34mDEBUG[0m sccache::compiler::compiler[0m[38;5;8m][0m [declaration_wrapper.cpp.obj]: Cache miss in 0.000 s
[0m[38;5;8m[[0m2021-02-16T22:57:43Z [0m[34mDEBUG[0m sccache::compiler::compiler[0m[38;5;8m][0m [declaration_wrapper.cpp.obj]: Compiling locally
[0m[38;5;8m[[0m2021-02-16T22:57:43Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m adding I/O source: 3623878658
[0m[38;5;8m[[0m2021-02-16T22:57:43Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m adding I/O source: 3628072963
[0m[38;5;8m[[0m2021-02-16T22:57:44Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m dropping I/O source: 2
[0m[38;5;8m[[0m2021-02-16T22:57:44Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m dropping I/O source: 3
[0m[38;5;8m[[0m2021-02-16T22:57:44Z [0m[34mDEBUG[0m sccache::compiler::compiler[0m[38;5;8m][0m [declaration_wrapper.cpp.obj]: Compiled but not cacheable
but your issue did mention /Zi
and /Z7
which I applied with the following bit of cmake from stackoverflow
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
which gives me the following
[0m[38;5;8m[[0m2021-02-16T23:04:58Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m adding I/O source: 7721713668
[0m[38;5;8m[[0m2021-02-16T23:04:58Z [0m[34mDEBUG[0m sccache::server[0m[38;5;8m][0m handle_client: compile
[0m[38;5;8m[[0m2021-02-16T23:04:58Z [0m[34mDEBUG[0m sccache::server[0m[38;5;8m][0m check_compiler: Supported compiler
[0m[38;5;8m[[0m2021-02-16T23:04:58Z [0m[34mDEBUG[0m sccache::server[0m[38;5;8m][0m parse_arguments: Ok: ["/nologo", "/TP", "-DFMT_HEADER_ONLY=1", "-DNOMINMAX", "-DWIN32_LEAN_AND_MEAN", "-D_CRT_SECURE_NO_WARNINGS", "-I_deps\\element-src\\libelement\\include", "-I_deps\\element-src\\libelement\\src", "-I_deps\\element-src\\libelement\\dependencies\\memorypool", "-I_deps\\element-src\\libelement\\..\\LMNT\\include", "-I_deps\\element-build\\libelement", "-I_deps\\utfcpp-src\\source", "-I_deps\\ghc_filesystem-src\\include", "-I_deps\\fmt-src\\include", "/DWIN32", "/D_WINDOWS", "/W3", "/GR", "/EHsc", "/Zc:__cplusplus", "/permissive-", "/MDd", "/Z7", "/Ob0", "/Od", "/RTC1", "/MP", "/utf-8", "-std:c++17", "/showIncludes", "/Fo_deps\\element-build\\libelement\\CMakeFiles\\element.dir\\src\\object_model\\intermediaries\\declaration_wrapper.cpp.obj", "/Fd_deps\\element-build\\libelement\\CMakeFiles\\element.dir\\element.pdb", "/FS", "-c", "_deps\\element-src\\libelement\\src\\object_model\\intermediaries\\declaration_wrapper.cpp"]
[0m[38;5;8m[[0m2021-02-16T23:04:58Z [0m[34mDEBUG[0m sccache::compiler::compiler[0m[38;5;8m][0m [declaration_wrapper.cpp.obj]: get_cached_or_compile: ["/nologo", "/TP", "-DFMT_HEADER_ONLY=1", "-DNOMINMAX", "-DWIN32_LEAN_AND_MEAN", "-D_CRT_SECURE_NO_WARNINGS", "-I_deps\\element-src\\libelement\\include", "-I_deps\\element-src\\libelement\\src", "-I_deps\\element-src\\libelement\\dependencies\\memorypool", "-I_deps\\element-src\\libelement\\..\\LMNT\\include", "-I_deps\\element-build\\libelement", "-I_deps\\utfcpp-src\\source", "-I_deps\\ghc_filesystem-src\\include", "-I_deps\\fmt-src\\include", "/DWIN32", "/D_WINDOWS", "/W3", "/GR", "/EHsc", "/Zc:__cplusplus", "/permissive-", "/MDd", "/Z7", "/Ob0", "/Od", "/RTC1", "/MP", "/utf-8", "-std:c++17", "/showIncludes", "/Fo_deps\\element-build\\libelement\\CMakeFiles\\element.dir\\src\\object_model\\intermediaries\\declaration_wrapper.cpp.obj", "/Fd_deps\\element-build\\libelement\\CMakeFiles\\element.dir\\element.pdb", "/FS", "-c", "_deps\\element-src\\libelement\\src\\object_model\\intermediaries\\declaration_wrapper.cpp"]
[0m[38;5;8m[[0m2021-02-16T23:04:58Z [0m[34mDEBUG[0m sccache::compiler::msvc[0m[38;5;8m][0m preprocess: Some("C:\\PROGRA~2\\MICROS~1\\2019\\COMMUN~1\\VC\\Tools\\MSVC\\1427~1.291\\bin\\Hostx64\\x64\\cl.exe" "-EP" "_deps\\element-src\\libelement\\src\\object_model\\intermediaries\\declaration_wrapper.cpp" "-nologo" "-DFMT_HEADER_ONLY=1" "-DNOMINMAX" "-DWIN32_LEAN_AND_MEAN" "-D_CRT_SECURE_NO_WARNINGS" "-I_deps\\element-src\\libelement\\include" "-I_deps\\element-src\\libelement\\src" "-I_deps\\element-src\\libelement\\dependencies\\memorypool" "-I_deps\\element-src\\libelement\\..\\LMNT\\include" "-I_deps\\element-build\\libelement" "-I_deps\\utfcpp-src\\source" "-I_deps\\ghc_filesystem-src\\include" "-I_deps\\fmt-src\\include" "/DWIN32" "/D_WINDOWS" "/showIncludes" "/nologo" "/TP" "/W3" "/GR" "/EHsc" "/Zc:__cplusplus" "/permissive-" "/MDd" "/Z7" "/Ob0" "/Od" "/RTC1" "/utf-8" "-std:c++17" "/Fd_deps\\element-build\\libelement\\CMakeFiles\\element.dir\\element.pdb")
[0m[38;5;8m[[0m2021-02-16T23:04:58Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m adding I/O source: 7725907969
[0m[38;5;8m[[0m2021-02-16T23:04:58Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m adding I/O source: 7730102275
[0m[38;5;8m[[0m2021-02-16T23:04:58Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m dropping I/O source: 1
[0m[38;5;8m[[0m2021-02-16T23:04:58Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m dropping I/O source: 3
[0m[38;5;8m[[0m2021-02-16T23:04:58Z [0m[34mDEBUG[0m sccache::compiler::compiler[0m[38;5;8m][0m [declaration_wrapper.cpp.obj]: generate_hash_key took 0.285 s
[0m[38;5;8m[[0m2021-02-16T23:04:58Z [0m[34mDEBUG[0m tokio_reactor::registration[0m[38;5;8m][0m scheduling Read for: 0
[0m[38;5;8m[[0m2021-02-16T23:04:58Z [0m[34mDEBUG[0m sccache::compiler::compiler[0m[38;5;8m][0m [declaration_wrapper.cpp.obj]: Cache miss in 0.000 s
[0m[38;5;8m[[0m2021-02-16T23:04:58Z [0m[34mDEBUG[0m sccache::compiler::compiler[0m[38;5;8m][0m [declaration_wrapper.cpp.obj]: Compiling locally
[0m[38;5;8m[[0m2021-02-16T23:04:58Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m adding I/O source: 7734296579
[0m[38;5;8m[[0m2021-02-16T23:04:58Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m adding I/O source: 7738490881
[0m[38;5;8m[[0m2021-02-16T23:04:59Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m dropping I/O source: 3
[0m[38;5;8m[[0m2021-02-16T23:04:59Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m dropping I/O source: 1
[0m[38;5;8m[[0m2021-02-16T23:04:59Z [0m[34mDEBUG[0m sccache::compiler::compiler[0m[38;5;8m][0m [declaration_wrapper.cpp.obj]: Compiled in 0.996 s, storing in cache
[0m[38;5;8m[[0m2021-02-16T23:04:59Z [0m[34mDEBUG[0m sccache::compiler::compiler[0m[38;5;8m][0m [declaration_wrapper.cpp.obj]: Stored in cache successfully!
[0m[38;5;8m[[0m2021-02-16T23:04:59Z [0m[34mDEBUG[0m sccache::server[0m[38;5;8m][0m [declaration_wrapper.cpp.obj]: Cache write finished in 0.007 s
[0m[38;5;8m[[0m2021-02-16T23:04:59Z [0m[34mDEBUG[0m tokio_reactor[0m[38;5;8m][0m dropping I/O source: 4
and stats show it's caching :)
Compile requests 212
Compile requests executed 212
Cache hits 212
Cache hits (C/C++) 212
Cache misses 0
Cache timeouts 0
Cache read errors 0
Forced recaches 0
Cache write errors 0
Compilation failures 0
Cache errors 0
Non-cacheable compilations 0
Non-cacheable calls 0
Non-compilation calls 0
Unsupported compiler calls 0
Average cache write 0.000 s
Average cache read miss 0.000 s
Average cache read hit 0.000 s
Failed distributed compilations 0
Cache location Local disk: "C:\\Users\\Zeph\\AppData\\Local\\Mozilla\\sccache\\cache"
Cache size 36 MiB
Max cache size 10 GiB
though the PDB limitation is a shame, it's useable, and I was able to build without -j1
restricting me to one thread, so that's good
PDB file lock issues need set /FS to compiler,if you use /Zi you need set /FS, i notice that you replace /Zi with /Z7. This is not a good idea.if you use /Z7 compiler will write .PDB-related content to .obj file.so the compiler do not create .pdb. it causes a lot of problem
PDB file lock issues need set /FS to compiler,if you use /Zi you need set /FS, i notice that you replace /Zi with /Z7. This is not a good idea.if you use /Z7 compiler will write .PDB-related content to .obj file.so the compiler do not create .pdb. it causes a lot of problem
1. .obj is very large 2. The end product is also very large 3. Can not debug coutomer's crash problem.because we need .pdb debug.
I agree but it seems to be a limitation of sccache https://github.com/mozilla/sccache/issues/278#issuecomment-458908310
thank you ,this means that if you use sccache you must stop create PDB.IS that true? That's too bad if that's true.Development and production environments can not be without PDB
thank you ,this means that if you use sccache you must stop create PDB.IS that true? That's too bad if that's true.Development and production environments can not be without PDB
No, you just can't create intermediate pdb files when compiling individual .obj files. You can have the linker generate a pdb file for each exe/dll when the obj files have been compiled with /Z7
. This is what the Firefox build does. Unfortunately due to MSVC's use of mspdbsrv
to marshal writes to pdb files it's impossible for sccache to correctly handle pdb files written alongside obj files.
You can have the linker generate a pdb file for each exe/dll when the obj files have been compiled with /Z7
how would I go about doing that 😁
edit: /Z7
does generate a PDB for executables, but not for static libraries. maybe it does for shared libraries only?
I have documented the requirement to use /Z7
instead of /Zi
in #963.
i use string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") replace /Zi , but error info still exist. do you know why?
@GuBuChang /Z7
is IMO the only sensible approach when building static libs with symbols meant for redistribution. Yes, it's bigger but there is no separate PDB to distribute and link.exe
will happily create you a PDB from the debug info included in the .obj
files.
I used the following command in powershell to import the MSVC environment
I then ran
and
cmake --build . -j1
(one thread, as it seems to complain about PDB file lock issues? maybe related?)I get 3 cache hits per run, same build path each time.
compile_commands.json
shows commands like