I need to cross compile from linux host to windows x86 (i586 / i686) target.
I tried to do it following this tutorial:
After few attempts (I wont describe the minor issues like apt build-dep failed and I was forced to download latest version sources manually/git) I’ve got executables successfully built by i686-w64-mingw32-gcc.
But here is the problem. As one may know, Windows executable PE header contains two important fields: Major OS version and Major subsystem version. I got the executable with 4.0 that must run under Windows XP / Server 2003 / Windows CE. Unfortnately, it does not. First problem is that bcrypt not found (BCryptGenRandom called by openssl, rand_win.c and probably libevent, util.h:838) and it’s impossible to copy this library from Windows 7 as it was build for 6.1 minium OS version. Second problem is incompatible functions AcquireSRWLockExclusive and similar calls in openssl, libevent and tor itself.
I’ve compared different builds of TOR (mainly from browser bundles) that I have. There is a tor browser bundle 5.0.6 from 2016 that I’ve used under Server 2003, but now it can not connect to the Tor network for unknown reason. The binary is fully compatible, the size is 2.4 Mb, there are libevent-2-0-5, zlib1 and openssl aside as dynamic link libraries.
There is a Tor.exe x86 from browser bundle 12.5.5 (7.5 Mb) possibly built by one of the latest Visual Studio and requires VC++ redistributable packages (api-ms-win-ctr-.dll) with static build of openssl inside, but it does not run as the OS version is set to 6.0.
I see an obvious solution to compile tor using shared (external dll) libraries openssl, zlib, libevent, borrowed from previous version browser bundles (or any other sources, for example I have openssl libraries on my Windows that are used by various software).
I tried to replace --enable-static-openssl with --enable-dynamic-openssl or remove this option but result is the same - static bilt binary off 11 Mb.
I would appreciate some manual how to build TOR with usage of external libraries under Linux (mingw).
Alternatively, any manual how to buld working TOR binary with Visual Studio 2010 (not later!) compatible with Windows v. 5 (XP) and later.
Also, if somebody have the information on why old tor.exe binary that was installed and worked 2-3 years ago can not connect to the network now (new can, so it’s not a censorship issue) or which version is the latest WinXP-compatible tor.exe binary. As for bundle, it is 7.5.6 (next 8.x already fails).