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

Checksum in fu-hash.h changing between builds #1298

Closed
lcp opened this issue Aug 21, 2019 · 4 comments
Closed

Checksum in fu-hash.h changing between builds #1298

lcp opened this issue Aug 21, 2019 · 4 comments

Comments

@lcp
Copy link
Contributor

lcp commented Aug 21, 2019

The checksum in fu-hash.h is used to detect the 3rd party plugins. However, after enabling LTO, the checksum changed between builds even without any source code change. It's because the extra LTO sections like .gnu.lto_.profile.e56fb3a1c2ab9039 were added to the object files in libfwupdprivate.a, and the static library becomes irreproducible.

I currently work around the issue by creating a never used libfwupdprivate_dyn.so from libfwupdprivate.a and hash it. It's not perfect but at least guarantee a stable hash.

@hughsie
Copy link
Member

hughsie commented Aug 21, 2019

Isn't a stable .a a prerequisite for a reproducible build? From memory the LTO build didn't actually work correctly, i.e. the plugin initialisation was failing.

@lcp
Copy link
Contributor Author

lcp commented Aug 21, 2019

Yeah, it's funny that .a became irreproducible after enabling LTO, and I'm not sure how to deal with those LTO sections correctly.
Anyway, LTO is enabled by default for openSUSE Tumbleweed now, and the daemon seems loading the plugins without errors, so it's probably fine now.

@hughsie
Copy link
Member

hughsie commented Aug 21, 2019

Hmm, LTO does seem to work on Fedora now too. Does the fwupd binary change hash between builds, or just the .a static lib? If not, the input : libfwupdprivate could be replaced with something that creates a checksum of the source files rather than the build staticlib.

hughsie added a commit that referenced this issue Aug 25, 2019
The unstripped static library changes between builds with profiling metadata
when compiling with LTO.

Fixes #1298
@lcp
Copy link
Contributor Author

lcp commented Aug 26, 2019

Sorry for my late reply. The fwupd binary is stable. The static library was the only one changed between builds. I was thinking about stripping the LTO section from object files in libfwupdprivate.a, but hashing the source files also works anyway. Thanks for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants