-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[package] Many packages missing pdbs...strategy? #1982
Comments
I am in favor of having PDBs in the debug Windows packages. That would put them on par with the Linux packages. Our developers expect debug packages to have symbols. |
Ouch - that seems fairly problematic. I would really like to see then a move towards using a 'with-pdbs' option which defaults to false as standard practice so you can build them locally with the same recipe. |
Maybe consider adding the |
At way level are you suggesting to use Z7? For the packages it would be ok for debug builds, but no good for relwithdebinfo. At that point maybe it’s better to be consistent. |
What The/a difference between |
Well I think you want debug information for your delivered binaries, so when your customers give you a crash dump you can get symbols. So this is RelWithDebInfo, but you want this as pdbs because you don’t want the bigger binary sizes (nor deliver your symbols to the customer generally). |
Indeed. |
If there's a need for some to not deliver symbols to an external customer (ours are internal) then it seems like an option to generate PDBs (or |
Did you mean Zi? I’m not sure the exact point you’re making. My current idea is not to fork, but to have a “with-pdb” option on windows that you could specify but which would default to false so that the cci rules are still followed. Although I think it might be desirable to use Z7 for static libraries...I’ve had issues with pdbs being located when using Zi with static libraries...but IIRC I had trouble reproducing it in a simple config so 🤷. |
An additional problem here is that even apart from the pdb source location not being valid, generally a package will not include the source. This should be equally true on all platforms. OTTOMH I’m not sure if there’s an easy way to ensure you have the sources for all requirements...if not that’s something to consider as well. |
It would be nice to use the cci recipes to build your program in I feel this issue touches a similar problem as #1783 . We should separate two things here: what we want the recipe to provide and what we want to/can provide on bintray. The recipe should be as general as possible. This means providing pdb's for all libraries/executables. This would require (at least) the following actions:
if self.settings.compiler != "Visual Studio":
del self.options.with_pdb
# question: Should this options also be available when self.settings.build_type == "Release"?
Opinions? |
I'm assuming the developer would get the source from Github or wherever it came from - though it sounds like there may be an issue with the VS debugger mapping the source references in the PDB to the downloaded source (easy to do with gcc)? Actually for our developers just having the symbols + file names + line numbers would be enough to let them follow the source in the Github web UI. |
@sourcedelica IMO that’s way too manual and giving up a lot. Normally you can move around the callstack and jump to the corresponding source locations, inspect variables etc. You wouldn’t want to give that up. |
@madebr i need to think about it more thoroughly but I think you have hit most of the main points. A few thoughts:
|
This should be investigated. I think the
This is fine, but only when |
@rconde Definitely but that's what they are doing right now :). The other options are mapping source from the PDB to a cloned Git repo or building the recipe from source. |
What is the point of having VS debug binaries on Bintray without debug symbols? I would prefer that recipes give me debug symbols by default when I build it locally. |
It's a good question. I think at the least it will be linked to a consistent runtime. Of course, I think we would all prefer symbols by default, but we also understand there are space constraints on conan-center. I guess an alternative is with-pdb = true by default, and disable it for all cci packages. |
@memsharded I would be good to get some thoughts from the conan team on this. Any ideas on how this could move forward? |
@rconde01 Conan team will discuss it during this week, please, be patient. |
I apologize, I just didn't know if it "scrolled off the feed" as the discussion happened over the weekend. |
np, PDB has been requested many times, but as described in the wiki, Conan has a reason for not adopting it. Indeed for remote debug is very useful. |
bump - it's been a few weeks, any thoughts? |
Yes! Conan team just discussed more than once about this topics, the last meetings was few hours ago. Sorry the delay! There were some options, pros and cons ... anyway, there will be a way to provide PDB files through an extra package folder, which will be optional. This feature will cover more cases, like when users want to package benchmarks or sanitizer results. It need to be studied, but can sure there will be an option for PDB distribution. Thanks for pushing it, this kind of discussion and community engagement it's really important to find new solutions! |
intriguing...looking forward to further details. |
just in case someone interested, here the summary of approaches discussed with their pros and cons:
some summary:
|
btw if the same issue applies to MacOS I think you could go with "symbols" rather than "pdb"...and technically you can strip symbols on linux and do the same. |
One issue I see with the archive solution is that the compiler needs to find the pdbs which IIRC generally means they need to be located next to the dlls (at least with msvc). This requires a capability to overlay an archive on top of the normal package, rather than in a separate folder. |
@rconde01 not really, PDBs could be loaded from anywhere. you may locate them manually with |
@SSE4 That's on the debugging side...I'm talking about at compilation time e.g. for static libraries. |
And now that i think about it, maybe i'm just dumb but i've found pdbs with static libraries to be problematic (although it's possible that was just from a package?)...but in any case, the archive approach doesn't play nice with Z7 I think. |
Not that i'm married to it, but thoughts on 3.
yes - you need to add the option, and propagate it down to dependencies. But you'll need code the handle the archive too right? And regardless you're gonna need the code to ensure they're generated for debug/releasewithdebinfo
Yeah - as mentioned in my other comment..."with-symbols" or "with-debug-info" would work.
Maybe not ABI, but it potentially has an effect on the binary. The pdb name is embedded in the dll. I don't think symbols are the same as docs like some "independent extra thing". So - i don't find those cons particular strong. Also you didn't list any pros:
|
It's a not good idea, today is PDB, tomorrow will be Following option 5, you can add anything there, which will work not only for PDB, but also for any other file that users have requested for a long time, benchmark, for example. So we can hit two birds with a single rock. |
Ok - forget about option 3...what about the problems I mentioned with option 5? |
Any progress on this issue? |
We are also very interested in having pdb files. Option 5 sounds like the most reasonable approach. Is there any decision so far ? |
Let's compare boost package in terms of size and "debug functionality" you get from them:
If we strip the first configuration we end up with 13MB of .so files which is very close to the MSVC configuration without .pdb files packaged. Instead of stripping the debug data altogether we can separate the debug sections into new file [1] - let's call it a .debug file. This ends up taking up 30MB of .so files and 99MB for .debug files - a bit more than original. If you look what you can do with the package the GCC is clearly the winner. For 112MB we get binaries with complete debugging data embedded inside them. On the other hand MSVC users get unoptimized and undebuggable binaries. What about static variants?
Here, the situation is quite alike. Both packages has the same full debugging capabilities. That's because b2 by default for MSVC uses /Z7 which makes the ".pdb contents" embedded inside .lib files. That's why these static libraries are so huge. You can force b2 to spit out .pdb files along .lib [2] and you'd end up with 400MB of .lib and 85.9MB of .pdb [3]. Lastly, let's look at a smaller package, namely thrift:
In 7) .pdb files would take only 4.85MB which is a fraction of the total size of static libraries. Like previously, with GCC for 18.8MB we get a package with a great debugging capabilities. For MSVC our libraries cannot be debugged because of missing 5MB of .pdb files. So the question shouldn't be if we should package .pdb files or not - we've been already doing the equivalence for most of the time - always with GCC-family compilers or with /Z7 for MSVC if that's the settings the package is built with. [1] It mimics the .pdb files in terms of distribution. You store your .debug files aside and hand out stripped executables saving tons of storage four your end-users. |
I’m currently evaluating Conan and the stance on debugging symbols is an issue for us. I would not ship binaries that I do not have debuginfo for. If the program crashes, that debuginfo is needed to analyze the minidump/coredump. I saw a comment higher up saying that most people wont debug third party libraries, but that is not the only reason we need debuginfo for thirdparty modules. A crash will very often happen inside third-party libraries, and if that happens you need the debugging symbols to be able to reliably walk the stack, which you need to diagnose the crash. Storing debuginfo symbols is therefore an unnegotiable requirement. Equally for debug and release builds. Microsoft has a public symbol server and symbol archive for this reason. So does nvidia. On the linux side all major distributions provide debuginfo packages. That is so core/minidumps can be analyzed. |
What is the resolution on this? This question are actually two separate issues:
|
IMO the a great option would be RTFACT-18260 and conan-io/conan#4047, so that the pdb files could be built and peeled off into the symbol server. That way the package download (for CI, etc) would not be unnecessarily bloated, but the symbols for CCI packages could be easily available for debugging (by adding the appropriate CCI symbol server to Visual Studio's debugger). I'm sure I'm not the first to think of this since there were already issues filed, but it's (surprisingly) not linked here, so I'll at least add it. |
I could not find anything in https://github.com/conan-io/tribe. Is this a thing that should be addressed as part of Conan 2.0? |
One idea i'm considering here is for public releases is to:
This ensures:
Of course it's also a big storage and time overhead, but theoretically straightforward and robust |
Compile vs link time PDBsThere appears to be some mixup in this stread about symbols for a static library and symbols for a shared library.
In terms of file sizes, Using a single compile time PDB for an entire package can actually provide even more savings, even though it can also trigger some exotic compiler bugs when compiler flags differ too much for different targets. (And requires a flat list of static libs in the same folder once packaged!) Unfortunately, there doesn't appear to be any (documented) option to convert The consumer of the package does need the compile time PDBs to have the linker build the full link time PDB from it. For shared libraries and executables stripping the linker generated PDBs is very much an option. These are not required for the correct build of dependent libraries, but can be deferred loaded during debugging as required. With as little as the minimal dump, both the image, and from that the associated symbol file, can be identified.
About the build types...Even Release-builds don't mean that you do not want debug capabilities. It only means that you will permit optimizations which might hinder debugging (such as allowing the folding of redundant code sections or aggressive inlining!), but it does not mean that you can categorically discard debug information. Tbh.: Releasing software built with CMakes definition of At the same time CMakes It turns pretty much into madness once you realize that with Always keep in mind that CMake support for Windows was an afterthought, and the concept of splitting symbols from the implementation by default is a first class concept on Windows. So it's perfectly expected that some of the defaults in the integration are just not sane at all. How to index symbolsWhat you should realize about the linker created PDBs:
The 2nd requirement renders The 4th requirement in combination with the perfomance constraints means that you do have to make a trade-off between having to store the binaries twice, or serving from an inefficient container! Conan packages - once installed into the cache - can behave different, but that's unrelated to how the conan center as a web-service can handle this. Building a Windows world compatible symbol index over either dedicated symbol packages or conan archives with embedded link time debug symbols is actually surprisingly simple. Just a simple POC: https://gist.github.com/Ext3h/1c2125ba838b8cb4ac88b1555ba78ba9 The only tricky part is to keep the archive itself, as well as the symbol index in sync with any possible de-published binary package. So some database backend integration is mandatory. There is no pure However, implementing a dedicated symbol indexing service which maps Symbol-Hashes from Have your developers set up their Well, almost all is cached. Beware that cache misses are not cached. So a symbol not served by anyone is searched over and over again. Site local caches still recommended. What about Linux?That's actually a lot more tricky. The biggest constraint here is that dear old GDB only has support for locating debug symbols in local paths, but is completely missing the ability to specify an upstream server and to cache anything from it. Of course you can also just side-load a symbol package, but you need to merge it into a local symbol index. And you need to deal with collisions on file names, which only works in the first place when the I had explored the approach of using |
@Ext3h thanks for the extensive update which I largely agree with. A couple of comments:
I agree 💯!
Not fair. Visual Studio has been supported by CMake for more than 20 years. Windows is a first class platform in CMake.
I believe CMake took the Debug, Release, and RelWithDebInfo names from Visual Studio and if you go back far enough, perhaps to Visual Studio 2005 or thereabouts then the Visual studio "Release" build did not include debug-info.
That sounds very bad and also not correct to me. I looked and found https://github.com/Kitware/CMake/blob/master/Modules/Platform/Windows-MSVC.cmake#L456 where the only difference I see is /Ob1 vs /Ob2. I was very surprised to see this difference and have no idea why there is that difference. More restrictive inlining could have a significant impact on performance.
This is no longer true. debuginfod exists and gdb in e.g. Fedora 36 has it enabled and will use it to pull debug symbols for distro libraries - it is no longer necessary to yum/dnf install debuginfo packages. |
See https://gitlab.kitware.com/cmake/cmake/-/issues/20812. I do the following in my cmake root:
But as I was reading this thread I realized I should be trying to handle this for packages as well :( |
Thank you very much, I completely missed out on that development. Looks like setting build ID tags is the way to go then, and the web facing API is simple enough to implement 👍 |
By default, CMake Release builds are built without debug symbols. The idea is that you use RelWithDebInfo if you want them. However, RelWithDebInfo generates less optimized code, only inlining __inline code. More specifically, RelWithDebInfo builds use the /Ob1 option, and Release builds use /Ob2 [1,2]. In the end, we want to use Release for production code, but we also need debug symbols for post-mortem analysis. [1] conan-io/conan-center-index#1982 (comment) [2] https://gitlab.kitware.com/cmake/cmake/-/blob/d7741457861816d50114801abc84d1d78afdc754/Modules/Platform/Windows-MSVC.cmake#L486-490
Package and Environment Details (include every applicable attribute)
Steps to reproduce (Include if Applicable)
Doing a debug build on windows I'm getting warnings for many missing pdbs (would also apply to RelWithDebInfo). I can create issues and potentially PRs for each one, but since it appears systemic I thought it justified further discussion. I'm also not sure if the additional size is a problem, and thus maybe there should be an option 'with-pdbs' so that cci doesn't need to manage them. Although, in that case better not produce them at all.
The text was updated successfully, but these errors were encountered: