Skip to content

Commit 957c0fd

Browse files
committed
gitian: make windows build deterministic
1 parent 2e31d74 commit 957c0fd

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

contrib/gitian-descriptors/gitian-win.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,30 @@ script: |
6363
chmod +x ${WRAP_DIR}/${i}-${prog}
6464
done
6565
done
66+
67+
# Create per-host linker wrapper
68+
# This is only needed for trusty, as the mingw linker leaks a few bytes of
69+
# heap, causing non-determinism. See discussion in https://github.com/bitcoin/bitcoin/pull/6900
70+
for i in $HOSTS; do
71+
mkdir -p ${WRAP_DIR}/${i}
72+
for prog in collect2; do
73+
echo '#!/bin/bash' > ${WRAP_DIR}/${i}/${prog}
74+
REAL=$(${i}-gcc -print-prog-name=${prog})
75+
echo "export MALLOC_PERTURB_=255" >> ${WRAP_DIR}/${i}/${prog}
76+
echo "${REAL} \$@" >> $WRAP_DIR/${i}/${prog}
77+
chmod +x ${WRAP_DIR}/${i}/${prog}
78+
done
79+
for prog in gcc g++; do
80+
echo '#!/bin/bash' > ${WRAP_DIR}/${i}-${prog}
81+
echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
82+
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
83+
echo "export FAKETIME=\"${REFERENCE_DATETIME}\"" >> ${WRAP_DIR}/${i}-${prog}
84+
echo "export COMPILER_PATH=${WRAP_DIR}/${i}" >> ${WRAP_DIR}/${i}-${prog}
85+
echo "\$REAL \$@" >> $WRAP_DIR/${i}-${prog}
86+
chmod +x ${WRAP_DIR}/${i}-${prog}
87+
done
88+
done
89+
6690
export PATH=${WRAP_DIR}:${PATH}
6791
6892
cd bitcoin

0 commit comments

Comments
 (0)