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
Build not reproducible #2102
Comments
I can't really tell from that log what exactly is different in between builds. The only files that differ are the cmake log files, I don't really have the time to do a lot of work here, but patches are welcome and if you can point to what exactly is different on the salsa build server it would certainly make tracking down reproducibilty issues a lot easier. |
Let me try to chime in with a little bit more information, I'm trying to debug the issue but there might be more than one thing involved. I'm attaching the output of diffoscope from our CI at Salsa, the job builds polybar twice, with different host configurations (timezone, directories location, locale...) and runs diffoscope against the resulting .debs I'm attaching this log here in case someone wants to investigate, but beware of the following:
I'll ask for help to investigate why the builds are failing on our side and will keep you posted on updates if I have any. |
From the diffoscope output, it looks like some things live at a different address, otherwise the assembly code seems exactly the same. In the 0x0025c270 436f6d70 696c6572 20666c61 67733a20 Compiler flags:
0x0025c280 2d67202d 4f32202d 66646562 75672d70 -g -O2 -fdebug-p
0x0025c290 72656669 782d6d61 703d2f74 6d702f72 refix-map=/tmp/r
0x0025c2a0 6570726f 74657374 2e576656 62617a2f eprotest.WfVbaz/
- 0x0025c2b0 636f6e73 745f6275 696c645f 70617468 const_build_path
- 0x0025c2c0 2f636f6e 73745f62 75696c64 5f706174 /const_build_pat
- 0x0025c2d0 683d2e20 2d667374 61636b2d 70726f74 h=. -fstack-prot
- 0x0025c2e0 6563746f 722d7374 726f6e67 202d5766 ector-strong -Wf
- 0x0025c2f0 6f726d61 74202d57 6572726f 723d666f ormat -Werror=fo
- 0x0025c300 726d6174 2d736563 75726974 79202d57 rmat-security -W
- 0x0025c310 64617465 2d74696d 65202d44 5f464f52 date-time -D_FOR
- 0x0025c320 54494659 5f534f55 5243453d 32202d57 TIFY_SOURCE=2 -W
- 0x0025c330 616c6c20 2d576578 74726120 2d577065 all -Wextra -Wpe
- 0x0025c340 64616e74 6963200a 00000000 00000000 dantic .........
+ 0x0025c2b0 6275696c 642d6578 70657269 6d656e74 build-experiment
+ 0x0025c2c0 2d312f62 75696c64 2d657870 6572696d -1/build-experim
+ 0x0025c2d0 656e742d 313d2e20 2d667374 61636b2d ent-1=. -fstack-
+ 0x0025c2e0 70726f74 6563746f 722d7374 726f6e67 protector-strong
+ 0x0025c2f0 202d5766 6f726d61 74202d57 6572726f -Wformat -Werro
+ 0x0025c300 723d666f 726d6174 2d736563 75726974 r=format-securit
+ 0x0025c310 79202d57 64617465 2d74696d 65202d44 y -Wdate-time -D
+ 0x0025c320 5f464f52 54494659 5f534f55 5243453d _FORTIFY_SOURCE=
+ 0x0025c330 32202d57 616c6c20 2d576578 74726120 2 -Wall -Wextra
+ 0x0025c340 2d577065 64616e74 6963200a 00000000 -Wpedantic ..... This seems to suggest polybar is built with different compiler flags, once with:
and once with
In particular the Why are different build-flags used when testing for reproducability? |
@patrick96 Sorry, I didn't mention that one of the issues, this one with I'm gonna attach here the diff from using polybar_fdebug_diffoscope.log |
In the log you attached, the compiler flags are still different:
vs
This time it's just the The difference in diff size could be that some of the data that is used most-often has changed position, it's still the addresses that the assembly references that produces most of the diff. |
@patrick96 So the main reason we use You can read a little bit more about it here: What Considering the diff that we have, I believe it's likely that the reproducibility issue is coming from cmake or gcc, I'm now verifying if the issue is coming from CMAKE's RPATH, as described at https://reproducible-builds.org/docs/deterministic-build-systems/#cmake-notes So the summary of the current situation is that the issue might be on the build tools rather than Polybar's source, which is a not an unusual thing on reproducible builds. I will keep you updated on any progress made. |
Thanks for your efforts :) Why do you pass different directories to those flags between the two builds? I thought a reproducible build only needs to reproducible in the same build directory. |
@patrick96 We aim to have reproducible builds even with varying build directories, so our tooling is setup to build against different locations. In those build logs you are seeing the logs of both builds, so one way of easily identifying where the second build started is by looking at the other build directory. Thank you for your help as well! |
I just remembered that you may not actually know this, but polybar saves the compiler flags in the executable so that it can print it as part of And a lot of the differences between the binaries are because there are different compiler flags. So it is impossible to reproducibly build polybar in different build directories if you pass the build directory as part of some compiler flag. |
@patrick96 that explains why I was still seeing the build path on the diffs :) We can patch that function on Debian to redact the build path to fix it. Alright so the only non-identified diff we have is the assembly instructions location one. EDIT- I reread your comment and realized now that the diff on rodata (build path) might be causing the assembly location diff, of course, I'm checking that now |
Confirmed that by removing the flags from Since it doesn't looks like there's a "direct" reproducibility issue on polybar's source[0], I believe this issue could be closed, but it's up to you. FWIW I just uploaded Polybar 3.4.3-2 with this fixes to Debian unstable, the only diff we will get is the What are your thoughts on this @utkarsh2102? [0] The two issues we found were the generation of config file by the target |
How is it possible that only the build id differs? I though the build id is just a hash over the rest of the file. I'm closing this for now. Feel free to ping me, if you identify reproducibility issues that polybar is responsible for. |
@patrick96 I also thought that was weird, then I found out that this happens because the other parts which were causing the build id to differ were stripped out of this binary. We first build polybar with debugging information ( The build path might still be being embedded to the binary, I'm investigating that. So far there's nothing showing there's an issue on polybar's side. I appreciate the help you gave me :) |
Whilst working on the Reproducible Builds front, I came across that polybar doesn't build reproducibly.
Here are the CI logs: https://salsa.debian.org/debian/polybar/-/jobs/664513
It'd be nice if we can have a fix for this? :)
The text was updated successfully, but these errors were encountered: