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

Gitian-built 0.9.0rc1 : windows bitcoin-qt.exe mismatch #3612

Closed
gavinandresen opened this issue Feb 1, 2014 · 8 comments
Closed

Gitian-built 0.9.0rc1 : windows bitcoin-qt.exe mismatch #3612

gavinandresen opened this issue Feb 1, 2014 · 8 comments

Comments

@gavinandresen
Copy link
Contributor

I'm successfully reproducibly gitian-building Linux 0.9.0rc1:

    20b208827262ad4a4afb2419e60bf27c16e96406e3df518f77d56771e22ab13f  bin/32/bitcoin-cli
    9c30a979a2282e8326a2bec06352a3bf67f141c019d833bd1039d5de7e37cdae  bin/32/bitcoin-qt
    4c98b5904854b0616938f53dbb682559b4f583ff3aea18353cf86725013c1cc7  bin/32/bitcoind
    557671b4ae41fb4561d83360e9da917a5b29a1c315fcf470d16230e4a5e64548  bin/32/test_bitcoin
    9c364ebb6ccad2c0944ebc6f07dfc0d7ef5c61a06045d107cb3dd9f477fb8b83  bin/32/test_bitcoin-qt
    20a93099050df6176afa3a5745b15e54be88831bd7deb91398038d6b57013917  bin/64/bitcoin-cli
    7a5dcc2344558f751499e57412145a286127f2c4a3922618023b6606a28cc5f9  bin/64/bitcoin-qt
    6fe77a9610c6b85c550a970e51c65b21bb2b23ba05837f6091cd27840605fb45  bin/64/bitcoind
    b62e830e6560fba96075964d406f9948b53fafd6c9009cd98caa1b87c4e87171  bin/64/test_bitcoin
    b0470e352c303409135894783cb7cd1f99c79e14b56582218d25dd7f9c7f7587  bin/64/test_bitcoin-qt
    a6e1b52393807db50061430454f9d0f38b3d6485bafe7f63998f8aaa3b465347  src/bitcoin-0.9.0.tar.gz

But two separate Windows builds do not match:

==> /tmp/bitcoin-res.yml <==
--- !omap
- out_manifest: |
    a3e13e99152d53c870eaa8bfbea1afb5c6da8b0a2e550a4c2914041c31a45a08  32/bitcoin-0.9.0-win32-setup.exe
    798b82c18b29fb25dc77ec30121942619533c43d43cacaa857b7a336dfcf781f  32/bitcoin-cli.exe
    198233f3b91dc9e7e24e2688478f6a1aed0074e0f06ed84a18abc8ef937a6e62  32/bitcoin-qt.exe
    4c5f7737530016e971ab8e51df424c931ceebdb2d76f37df59c742d4c4f88871  32/bitcoind.exe
    9f8e04398fd0e4e77400ebcbce7e443527d539286ddf5e59826eb902b9f8c536  32/test_bitcoin-qt.exe
    6cc535dd7b85db172b1de99f3d9966927d38b7cbb96e912f2dc5b13c13de859a  32/test_bitcoin.exe
    911c1e0e90b2b133868dd9e316d90b38df51de56d6c8fd6dbcd4fac422161679  64/bitcoin-0.9.0-win64-setup.exe
    c3bd6dffc332587e6ecb065828711a40d61de6630e5c23e2ca185858e3d6e0dc  64/bitcoin-cli.exe

==> /tmp/bitcoin-res2.yml <==
--- !omap
- out_manifest: |
    d85996c5e77d3a1022f7bde478614de1d602ec3580a7abc0ed87841b2c85486c  32/bitcoin-0.9.0-win32-setup.exe
    798b82c18b29fb25dc77ec30121942619533c43d43cacaa857b7a336dfcf781f  32/bitcoin-cli.exe
    b86a9ba01100763e9936cc70f99b307a2009f168f1173e9ca1284d11ca57441a  32/bitcoin-qt.exe
    4c5f7737530016e971ab8e51df424c931ceebdb2d76f37df59c742d4c4f88871  32/bitcoind.exe
    9f8e04398fd0e4e77400ebcbce7e443527d539286ddf5e59826eb902b9f8c536  32/test_bitcoin-qt.exe
    6cc535dd7b85db172b1de99f3d9966927d38b7cbb96e912f2dc5b13c13de859a  32/test_bitcoin.exe
    39f36eefa382deb1f76f3eb3b817dbf1a590be0063328a0d4c6d8d872e849089  64/bitcoin-0.9.0-win64-setup.exe
    c3bd6dffc332587e6ecb065828711a40d61de6630e5c23e2ca185858e3d6e0dc  64/bitcoin-cli.exe

The bitcoin-qt.exes (and, therefore, the -setup.exes) are the only mismatches. I haven't looked into what is different.

@gavinandresen
Copy link
Contributor Author

For debugging other gitian mismatches, here are my dependency checksums:

Linux:

- in_manifest: |-
    a9d7258eb26c4cd8897ca9906fb654905fa63101ed972218bd14af11d7f2624e  bitcoin-desc.yml
    a6003db7a32717058016905ef4323a54326fc59ff9f461c81fb1ee18cb2bae50  bitcoin-deps-linux32-gitian-r2.zip
    5444f1fe020435766c2dc62f9a703b820599243eb320192af751e365c9d54cf3  bitcoin-deps-linux64-gitian-r2.zip
    51fc0d85ccfe0e9268919e67644cbd44823b25b9636fc0e1e125f94b1587f2a0  boost-linux32-1.55.0-gitian-r1.zip
    d950310c806b3daea4e274a9fc75929f2cd05fe458c3f935b8e682d1c390a11e  boost-linux64-1.55.0-gitian-r1.zip
    git:15ec451554b5889a92651b9fe71bf01047ba9fc3 bitcoin

Windows:

- in_manifest: |-
    a3552e2fc61228c8d068d54101665a200abfc77633eb5f1c3429f227572dc77e  bitcoin-desc.yml
    690fc422b7a925e16565cad40139384f0dba15030331a30e9269d659a1135ea6  qt-win32-5.2.0-gitian-r1.zip
    be308ce02e547f9da468057184828c5ed065d9ad114f6f2ee5b46293e5f73752  qt-win64-5.2.0-gitian-r1.zip
    c569a722aedbbfd28dce8ee8dd0a0abd6469a87c1d593ef1bc27b14adf03818f  boost-win32-1.55.0-gitian-r6.zip
    dfb8fd6475b0692596f3c1c56aa1fac68b7fff458506b34c2326ac8d1b9786dd  boost-win64-1.55.0-gitian-r6.zip
    7d3d22c433ee7b97ad6cab40aa148e602aa4e847e8d07ff2ae6b9573bbbe50d4  bitcoin-deps-win32-gitian-r10.zip
    ede88f7152dfb0a28fe71577b0f1f0b254c6a820f5e54ddae9c71a5079e012e0  bitcoin-deps-win64-gitian-r10.zip
    546b45ec363ad48007de79df2bfd08a60c97414d14fd2796ed82f7a445056885  protobuf-win32-2.5.0-gitian-r4.zip
    18d210fdf44a156bbdaabd6aaec98ce0dadc61d206132881df83fcb16a685362  protobuf-win64-2.5.0-gitian-r4.zip
    git:15ec451554b5889a92651b9fe71bf01047ba9fc3 bitcoin

@Michagogo
Copy link
Contributor

I'm also seeing the bitcoin-qt.exes (and the setups, of course) not matching between builds, but I also noticed that Gavin and I don't have matching outputs. I don't know if the fact that my builds and Gavin's don't match is related, though... I am using LXC to build, while Gavin uses (I believe) VirtualBox, but I have successfully built matching binaries for 0.8.6 in LXC on that machine, so I don't know what changed.

Here are my outputs:

Linux:

- out_manifest: |
    20b208827262ad4a4afb2419e60bf27c16e96406e3df518f77d56771e22ab13f  bin/32/bitcoin-cli
    2368f359274c4ad6c3078c1f7fd7a306faab841c7103dc5adb7a2beb160c7e92  bin/32/bitcoin-qt
    df3f7f54b412c4ace7345475783bed2ac3ee03f7aa0ecc92f54ac6f7df93c2f7  bin/32/bitcoind
    557671b4ae41fb4561d83360e9da917a5b29a1c315fcf470d16230e4a5e64548  bin/32/test_bitcoin
    21db605ee7ee03d8e8de24e9ac492db8ea66b94c310b22fb975948b0cf51320d  bin/32/test_bitcoin-qt
    20a93099050df6176afa3a5745b15e54be88831bd7deb91398038d6b57013917  bin/64/bitcoin-cli
    c60f6f4620d959a7cfefe22ab2484f09b91ea5de18397901bd5851c63b87b7b5  bin/64/bitcoin-qt
    0af8095ac2a6fe3d69cdd49c7f1b40574e8cae60e7a737663697f04fd2e09d7f  bin/64/bitcoind
    b62e830e6560fba96075964d406f9948b53fafd6c9009cd98caa1b87c4e87171  bin/64/test_bitcoin
    d28e56cdc74630dffb649d8a9cd2149b089cb5c1287d171fecfaccd774c59d96  bin/64/test_bitcoin-qt
    afca51f5299d27787a5c8edf350767718c13fa532037b37a65008d97d0be5c3c  src/bitcoin-0.9.0.tar.gz

Windows:

- out_manifest: |
    ba7449ad3132df7ca7100a77c25a5129675010fc66e84f3d381c1076ff7d9c5a  32/bitcoin-0.9.0-win32-setup.exe
    798b82c18b29fb25dc77ec30121942619533c43d43cacaa857b7a336dfcf781f  32/bitcoin-cli.exe
    c2c21fcb9eacb49f0a6a2d0318199251531d989bd3e8425bc72ca28ed618633b  32/bitcoin-qt.exe
    4c5f7737530016e971ab8e51df424c931ceebdb2d76f37df59c742d4c4f88871  32/bitcoind.exe
    7bb0db3663c3ab3bea71ffad17fb4ad495f645bbe21a6d9e0e8af349d7aa8555  32/test_bitcoin-qt.exe
    6cc535dd7b85db172b1de99f3d9966927d38b7cbb96e912f2dc5b13c13de859a  32/test_bitcoin.exe
    5cf7928ad018c47d247ec9e8df1b1aecd5397e2ba6c8e0c7ca4e1f4dcfdb35b9  64/bitcoin-0.9.0-win64-setup.exe
    c3bd6dffc332587e6ecb065828711a40d61de6630e5c23e2ca185858e3d6e0dc  64/bitcoin-cli.exe
    9a332158ede24e4aa5c536c935e208bfdde20f972e56625de8aae66f4c1f77bd  64/bitcoin-qt.exe
    9d985b1f14802a75be92b6b7ec4d4ed37ad980c291e3368816597b145d8cbb36  64/bitcoind.exe
    a387c4c5dcea77b0b1344c92cb234ce772b0388658037e08e86f3ba5ed40c214  64/test_bitcoin-qt.exe
    ef8c53cf2d53162406580f2052374a93a13d678c254571e19d1804f526751df6  64/test_bitcoin.exe
    a294f1c1ac3988795c46b7b54d0f5f905265b7ad9937067198fd29de4abd62c9  src/bitcoin-0.9.0.tar.gz

@laanwj
Copy link
Member

laanwj commented Feb 3, 2014

Looking into the determinism problems for Windows first.
I see the same result as @gavinandresen for win32/win64 bitcoin-cli.exe bitcoind.exe and test_bitcoin.exe and even test_bitcoin-qt.exe.
However the bitcoin-qt.exe and the setup.exe are different, and also different every run.

@Michagogo
Copy link
Contributor

@laanwj What's your build system? LXC? KVM? VBox?

On Monday, February 3, 2014, Wladimir J. van der Laan <
notifications@github.com> wrote:

Looking into the determinism problems for Windows first.
I see the same result as @gavinandresen https://github.com/gavinandresenfor win32/win64 bitcoin-cli.exe bitcoind.exe and test_bitcoin.exe.
However the bitcoin-qt.exe and test_bitcoin-qt.exe are different, and also
different every run.


Reply to this email directly or view it on GitHubhttps://github.com//issues/3612#issuecomment-33932470
.

@laanwj
Copy link
Member

laanwj commented Feb 3, 2014

KVM

@Michagogo
Copy link
Contributor

Interesting. When I get a chance, I'll try building in LXC on another
system and see if LXC is non-deterministic or if it's just deterministic
differently. (If that made sense... I'm a little tired.)

On Monday, February 3, 2014, Wladimir J. van der Laan <
notifications@github.com> wrote:

KVM


Reply to this email directly or view it on GitHubhttps://github.com//issues/3612#issuecomment-33932733
.

@laanwj
Copy link
Member

laanwj commented Feb 3, 2014

Comparing two bitcoin-qt.exes the first difference is at offset 0xD8. This is likely some timestamp part of the PE header:

+0000 00D0: 00 E0 7F 01 00 04 00 00  0E 22 7F 01 02 00 40 01  ........ ."....@.                                                                                 
-0000 00D0: 00 E0 7F 01 00 04 00 00  99 43 7F 01 02 00 40 01  ........ .C....@.                                                                                 

There is also a large non-matching tract 01270E70....014A1000. This contains image data and text and appear to be the compiled Qt resources. Possibly an ordering issue.

Edit: the field at 0xD8 (PE_header+0x58) is a 16-bit checksum. It makes sense for this to not match. So the problem is fully in the compiled Qt resources.

Edit.2: Yep, the qrc_bitcoin.cpp as generated by Qt's rcc is different every time. It appears to pick a random ordering of files easily reproduced with ~/staging32/host/bin/rcc --list bitcoin.qrc.

Edit.3: The Qt4 resource compiler does not do this randomization, as we still use Qt4 on Linux this explains why this only happens on Windows. Looking into a way around this Qt5 'feature'.

Edit.4: Oh joy, all of this is due to a QHash security fix. Every run of an executable, the ordering is different. https://qt.gitorious.org/qt/qtbase/commit/c01eaa438200edc9a3bbcd8ae1e8ded058bea268 . They shouldn't be using a QHash here but some ordered dictionary...

Edit.5: I think I found a way to override the behavior without patching Qt rcc source (for now) by setting QT_RCC_TEST=1.

Edit 6: That worked. I'll submit a pull for this and #3610 later.

laanwj added a commit to laanwj/bitcoin that referenced this issue Feb 3, 2014
- Add 'g++' package (virtualbox images don't have this by default)
- Workaround for determinism in Qt5 resources
- Pass --disable-maintainer-mode --disable-dependency-tracking to
  configure for libqrencode to avoid random errors about missing m4
  directory
- Fix typo -with-pic -> --with-pic

It is not necessary to rebuild dependencies after this commit.
Fixes bitcoin#3610 and bitcoin#3612.
@laanwj
Copy link
Member

laanwj commented Feb 22, 2014

Should be solved by #3625

@laanwj laanwj closed this as completed Feb 22, 2014
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
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

3 participants