Subject: Re: [bitcoin-dev] Bitcoin Archaeology

From: Dan Bryant <[email-masked]>
Date: Sat, 14 Nov 2020 11:00:12 -0600

Finally got it working,but was a bit harder than I expected.  I had to
forgo the OpenSSL modifications that Satoshi originally suggested.  I also
switched to Strawberry Perl.  Those two changes seemed to fix the OpenSSL
build.  Everything else was all essentially as documented in v0.4.0, which
is the first version to put all the build steps out in detail.  The one
exception is the bitcoin build itself.  There are three minor issues that
can be worked around with copy commands.

1. The Makefile points to /wxWidgets/lib/vc_lib/ where it should really
point to /wxWidgets/lib/gcc_lib/
2. The Makefile points to /OpenSSL/include where it should really point to
/OpenSSL/outinc
3. The Makefile builds to /obj without first creating the directory

That covers v0.1.5, and I think it will probably be smooth sailing from
there all the way to v0.4.0.  I'll verify that my v0.1.5 toolchain can
build v0.1.0 and v0.1.3 as well.  For anyone interested, here are the
binaries I used to create the build environment.  All of them are
vintage and would have been accessible to Satoshi with the exception of
Win2012 and VirtualBox.  I'll try to reproduce my work on a Win2000 which
is now quasi-open-domain.

For anyone wanting to give it a shot...

* https://www.microsoft.com/en-us/evalcenter/evaluate-hyper-v-server-2012
*
https://download.virtualbox.org/virtualbox/6.1.12/VirtualBox-6.1.12-139181-Win.exe
* https://downloads.sourceforge.net/gnuwin32/zlib-1.2.3-bin.zip
* https://downloads.sourceforge.net/gnuwin32/bzip2-1.0.5-bin.zip
* https://downloads.sourceforge.net/gnuwin32/libarchive-2.4.12-1-bin.zip
* https://downloads.sourceforge.net/mingw/binutils-2.19.1-mingw32-bin.tar.gz
* https://downloads.sourceforge.net/mingw/gcc-core-3.4.5-20051220-1.tar.gz
* https://downloads.sourceforge.net/mingw/gcc-g++-3.4.5-20051220-1.tar.gz
* https://downloads.sourceforge.net/mingw/mingwrt-3.15.2-mingw32-dev.tar.gz
* https://downloads.sourceforge.net/mingw/mingwrt-3.15.2-mingw32-dll.tar.gz
* https://downloads.sourceforge.net/mingw/w32api-3.13-mingw32-dev.tar.gz
*
https://downloads.sourceforge.net/mingw/mingw32-make-3.81-20080326-2.tar.gz
* https://downloads.sourceforge.net/mingw/MSYS-1.0.11.exe
* https://downloads.sourceforge.net/mingw/msysDTK-1.0.1.exe
* http://strawberryperl.com/download/5.8.8/strawberry-perl-5.8.8.2.zip
* https://github.com/bitcoin/bitcoin/archive/v0.1.5.zip
* https://downloads.sourceforge.net/wxwindows/wxWidgets-2.8.11.zip
* https://github.com/openssl/openssl/archive/OpenSSL_0_9_8h.zip
* https://download.oracle.com/berkeley-db/db-4.7.25.NC.zip
* https://downloads.sourceforge.net/boost/1.37.0/boost_1_37_0.zip
*
https://downloads.sourceforge.net/boost/boost-jam/boost-jam-3.1.17-1-ntx86.zip

On Wed, Nov 11, 2020 at 9:06 AM Dan Bryant <[email-masked]> wrote:

> TLDR; How to build old OpenSSL releases in MSYS/MinGW v1.0.11
>
> In a similar vein to the Github Artic Code Vault, and the Nakamoto
> Institute, I thought it would be educational to do a build of the first
> three versions of Bitcoin (v0.1.0, v0.1.3, and v0.1.5) [ref1].  Don't
> worry, I will keep these on a VLAN and not spam the IRC channel.
>
> Wanting to be as accurate as possible, I spun up some VMs to try to
> recreate the vintage Oct 2009 toolchains that were used.  The original
> Satoshi posts seem to imply that the builds could be done using Visual C++
> version 6.0 or MinGW and MSYS (which were at v1.0.11).  Since it looks like
> most versions of VC 6 have been purged from the internet, the only option
> left is MinGW which is still up on sourceforge.  Most things seemed to
> build OK, with the exception of OpenSSL, which looks to fail due to some
> issues in mk1mf.pl [ref2]  Perhaps there was a bad version of perl in
> MSYS v1.0.11, I'm not sure.
>
> So my question is..  Has anyone been here long enough to recall the steps
> to build OpenSSL v0.9.8h in MSYS 1.0.11?  Or, does anyone know where to
> find a non-sketchy copy of Visual C++ 6.0?
>
> My options so far seem to be.
>
> 1. Try to find out how Satoshi did the MinGW OpenSSL build back in 2009.
> 2. Try to do the OpenSSL build through Cygwin which could
> cross-complile to MinGW at the time
> 3. Try to do the  OpenSSL build through Msys2 with later versions of perl
> and libc
> 4. Buy some sketchy version of VC 6 on ebay and try that
> 5. Patch Bitcoin 0.1.0 to use OpenSSL v1.0.0 where they fixed the perl bug
> 6. Give up and use a precompiled OpenSSL release
> 7. Give up and use the Linux build methods introduced in Bitcoin v0.1.6
>
> I realize this all sounds like a fool's folly, but it seems important (at
> some level) to be able to reproduce these old builds.  But perhaps it's
> just my OCD.
>
> Thoughts?
>
> For those interested.  The mk1mf.pl bug seems to be in parsing the list
> of headers through either the var_add, clean_up_ws, or do_copy_rule subs.
> I see both the headers and header directories being parsed, but the
> directories are dropped when building the make rules causing make to assume
> all headers are at root, failing the build.  Perhaps there is a version
> sed, basename or dirname that is missing in MSYS, but I've failed to find
> the dependency yet.
>
> * ref1: https://satoshi.nakamotoinstitute.org/code/
> * ref1:
> https://github.com/openssl/openssl/blob/OpenSSL_0_9_8h/util/mk1mf.pl
>
>