Skip to content
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

Debian Packages Strip Symbols from Shared Object Files #2624

Closed
brianrob opened this issue Mar 2, 2017 · 26 comments
Closed

Debian Packages Strip Symbols from Shared Object Files #2624

brianrob opened this issue Mar 2, 2017 · 26 comments

Comments

@brianrob
Copy link
Member

brianrob commented Mar 2, 2017

The process of producing the .deb package files strips symbols out of the .so files. However, we explicitly include function-level symbols in native binaries for use during performance tracing. tar.gz files are unaffected.

Steps to reproduce

  1. Install the .deb files for the shared framework for any of the Ubuntu distros either directly or via apt-get.
  2. Run nm </path/to/libcoreclr.so>

Expected behavior

Function-level symbols are displayed.

Actual behavior

No symbols are displayed.

Environment data

@gkhanna79
Copy link
Member

@chcosta Will this be addressed as part of your symbol packaging work?

CC @ericstj @noahfalk

@chcosta
Copy link
Member

chcosta commented Mar 2, 2017

This is not directly related to the symbol packaging work I'm doing. @dagood has more experience with the symbol stripping stuff.

@dagood
Copy link
Member

dagood commented Mar 2, 2017

As written, this has more to do with how deb-tool works. That kind of step is where symbol stripping is commonly done in Linux package manager flows (so I hear). I don't know where deb-tool comes from. It seems unrelated to packaging work to me, unless the root cause is how Core-Setup gets CoreCLR bits rather than deb-tool like the description says.

@omajid
Copy link
Member

omajid commented Mar 2, 2017

I am from Fedora land, where a similar problem would happen, I suppose. From what I understand, the packaging tool, during the package build process, goes over all binaries and strips them. The stripped binaries are put into a separate package (-dbgsym for Debian, -debuginfo for Fedora).

See AutomaticDebugPackages for how debian packages get stripped during build.

The debian announcement lists a few options to disable the stripping during package build.

@brianrob
Copy link
Member Author

brianrob commented Mar 2, 2017

My understanding matches that of @omajid. Likely we just need to disable the stripping when producing packages.

@omajid
Copy link
Member

omajid commented Mar 2, 2017

A tangential question: is there some way to automatically verify that symbols needed for performance testing are available?

@brianrob
Copy link
Member Author

brianrob commented Mar 2, 2017

Yes, you could do something like nm libcoreclr.so and make sure that the result is not "no symbols".

@brianrob
Copy link
Member Author

brianrob commented Mar 2, 2017

Or, you could also take the output of nm before and after the production of the package and diff them.

@omajid
Copy link
Member

omajid commented Mar 2, 2017

Thanks, those are good suggestions.

That said, is there some way to verify the functionality itself? What I mean is that the format for debugging symbols seems to be evolving. I know that (some versions of) lldb have trouble reading debugging symbols processed by some versions of rpmbuild. Is there a way to verify that the symbols present are sufficient for the performance tracing implementation in .NET Core to work?

@goldshtn
Copy link

goldshtn commented Mar 4, 2017

I think it would be perfectly fine to provide a separate debuginfo package and put full symbols in it. This makes installation faster and smaller, and most users and production deployments won't need the debuginfo anyway. I realize it might complicate things on your end a bit, but that's what most packages use. Even fundamentals like libc would usually have minimal symbols embedded and then a debuginfo package with full symbols.

@omajid Performance tracing actually works just fine without symbols. You simply don't have symbols on your call stacks for libcoreclr.so and other native modules. It is not critical for performance tracing user code, although is of course very nice to have. There is an even bigger problem around tracing crossgen'd symbols, which I brought up with Brian on a DL.

@omajid
Copy link
Member

omajid commented Mar 5, 2017

I think it would be perfectly fine to provide a separate debuginfo package and put full symbols in it

This is what we are doing in Fedora [1]. There's a .NET Core package (dotnetcore) and a debug symbols package (dotnetcore-debuginfo). If debug symbols aren't required for general functionality, I suggest that the debian packages follow the same format. But see also https://github.com/dotnet/core-setup/issues/1599 where packaging names and other issues are being discussed.

@danmoseley
Copy link
Member

Assigning to @rakeshsinghranchi per @gkhanna79
@rakeshsinghranchi please let us k now if this will not be resolved by 5/10 ZBB cutoff for 2.0.

@eerhardt
Copy link
Member

@chcosta - is this the same thing you are working on? Same as https://github.com/dotnet/core-setup/issues/186?

I'll assign to you.

@chcosta
Copy link
Member

chcosta commented May 23, 2017

@brianrob , can you help me understand this change? I actually think this is the opposite of the thing I recently worked on. #2450 was a change to ensure we stripped symbols from our nupkgs and produced separate symbols packages. It sounds like you're asking for the opposite behavior for deb packages. @rakeshsinghranchi , is this something you're aware of / familiar with?

@rakeshsinghranchi
Copy link
Member

Moving to 2.1.0 per response from @brianrob . His suggestion is to get the fix in 2.1.0 sooner.

@rakeshsinghranchi
Copy link
Member

@dagood ,is dotnet/source-build#272 required to be ported for this issue ?

@dagood
Copy link
Member

dagood commented Mar 15, 2018

No, porting that (removing -strip-symbols) to Core-Setup official builds would make it impossible to create symbol packages, which we use to submit the stripped-out native symbols to the symbol server. In source-build, the output isn't put on a symbol server, so disabling symbol stripping is ok.

That said, I don't know the proper fix for this issue.

@omajid
Copy link
Member

omajid commented Mar 15, 2018

That said, I don't know the proper fix for this issue.

Just thinking out loud here. removing -strip-symbols leaves the symbols in-place. If they were left in place, we could then create -dbgsym packages from them. That would solve that problem. The other issue, of having symbols for symbol server can be fixed by adding some feature somewhere in the pipeline to create separate symbol files.

Maybe we can add an option to the build for this.

  • default build leaves symbols in native libraries
  • -separate-symbols would leave symbols in native libraries, but also create separate native symbol files that could be uploaded to the symbol server
  • -strip-symbols can be kept as it is now, except it wont be used by many (not by official builds, not by source-build)

@dagood
Copy link
Member

dagood commented Mar 15, 2018

That's a good point, I don't see a reason stripping has to happen during the initial native build. The flag just runs commands on the outputs:

https://github.com/dotnet/core-setup/blob/b5dd381dd3a586640e4bfe4804d6563861eaab20/src/settings.cmake#L84-L107

(-separate-symbols should also output the stripped native library files. I believe we still want to use them in some scenarios to reduce file size.)

@rakeshsinghranchi
Copy link
Member

@dagood , can you help with enabling --separate-symbols option , am not familiar with build process. Thanks.

@dagood
Copy link
Member

dagood commented Apr 2, 2018

I can't right now (and my cmake knowledge is pretty rudimentary), but the overall idea, I think, is to copy strip_source_file so we don't "lose" the version with all the symbols. Then we get all three files from a build: so with symbols, so with symbols removed, and so.dbg that contains the stripped symbols. Then they can be put into the appropriate artifacts.

@rakeshsinghranchi
Copy link
Member

I don't think it can be done for release 2.1.0 . Moving this to future.

@rakeshsinghranchi rakeshsinghranchi removed their assignment Jan 10, 2019
@dagood
Copy link
Member

dagood commented Oct 16, 2019

This came up recently in dotnet/symstore#126 due to the unexpected difference between the libcoreclr.so shipped in our Debian package vs. other artifacts. Looking over this issue knowing a little more about how the problem comes up, I think it got off track.

I don't think turning off symbol stripping and leaving it to debtool helps. Symbol stripping is not all-or-nothing: debtool strips more than it should for .NET Core. We need to figure out how to make debtool leave the function-level symbols in the so, no matter what else we do, so that perf tracing works with this installation method. (Keeping parity with other artifacts.)

We do have this issue tracking making proper debuginfo/dbgpkg packages now, though: dotnet/core-setup#8356. 🙂

@omajid
Copy link
Member

omajid commented Oct 16, 2019

I don't think turning off symbol stripping and leaving it to debtool helps. Symbol stripping is not all-or-nothing: debtool strips more than it should for .NET Core. We need to figure out how to make debtool leave the function-level symbols in the so, no matter what else we do, so that perf tracing works with this installation method. (Keeping parity with other artifacts.)

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=595810 has some hints on how to do that. I haven't tested/verified it.

@msftgits msftgits transferred this issue from dotnet/core-setup Jan 30, 2020
@msftgits msftgits added this to the 5.0 milestone Jan 30, 2020
@dagood dagood removed the Triaged label Jan 30, 2020
@dagood dagood removed their assignment Jul 1, 2020
@NikolaMilosavljevic
Copy link
Member

@brianrob is this still an issue for perf tracing or do you utilize a workaround? Is this needed for 5.0?

@brianrob
Copy link
Member Author

@NikolaMilosavljevic I think its safe to close this now. We have a tool for downloading symbols now. Thanks.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests