On 01/19/2013 02:36 AM, Boszormenyi Zoltan wrote:


Cross-compiling is not really a supported platform. Why don't you just build natively? This is know to work as shown by the buildfarm animals doing it successfully.

Because I don't have a mingw setup on Windows. (Sorry.)


A long time ago I had a lot of sympathy with this answer, but these days not so much. Getting a working mingw/msys environment sufficient to build a bare bones PostgreSQL from scratch is both cheap and fairly easy. The improvements that mingw has made in its install process, and the presence of cheap or free windows instances in the cloud combine to make this pretty simple. But since it's still slightly involved here is how I constructed one such this morning:

 * Create an Amazon t1.micro spot instance of
   Windows_Server-2008-SP2-English-64Bit-Base-2012.12.12 (ami-554ac83c)
   (current price $0.006 / hour)
 * get the credentials and log in using:
     o rdesktop -g 80%  -u Administrator -p 'password' amazon-hostname
 * turn off annoying IE security enhancements, and fire up IE
 * go to
   <http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/>
   and download latest mingw-get-inst
 * run this - make sure to select the Msys and the developer toolkit in
   addition to the C compiler
 * navigate in explorer or a command window to \Mingw\Msys\1.0 and run
   msys.bat
 * run this command to install some useful packages:
     o mingw-get install msys-wget msys-rxvt msys-unzip
 * close that window
 * open a normal command window and run the following to create an
   unprivileged user and open an msys window as that user:
     o net user pgrunner SomePw1234 /add
     o runas /user:pgrunner "cmd /c \mingw\msys\1.0\msys.bat --rxvt"
 * in the rxvt window run:
     o wget
       http://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.gz
     o tar -z -xf postgresql-snapshot.tar.gz
     o wget
       
"http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/mingw-w64-bin_i686-mingw_20111220.zip/download";
     o mkdir /mingw64
     o cd /mingw64
     o unzip ~/mingw-w64-bin_i686-mingw_20111220.zip
     o cd ~/postgresql-9.3devel
     o export PATH=/mingw64/bin:$PATH
     o ./configure --host=x86_64-w64-mingw32 --without-zlib && make  &&
       make check
         + ( make some coffee and do the crossword or read War and
           Peace - this can take a while)

Of course, for something faster you would pick a rather more expensive instance than t1.micro (say, m1.large, which usually has a spot price of $0.03 to $0.06 per hour), and if you're going to do this a lot you'll stash your stuff on an EBS volume that you can remount as needed, or zip it up and put it on S3, and then just pull it and unpack it in one hit from there. And there's barely enough room left on the root file system to do what's above anyway. But you can get the idea from this. Note that we no longer need to look elsewhere for extra tools like flex and bison as we once did - the ones that come with modern Msys should work just fine.

If you want more build features (openssl, libxml, libxslt, perl, python etc) then there is extra work to do in getting hold of those. But then cross-compiling for those things might not be easy either.

Somebody more adept at automating Amazon than I am should be able to automate most or all of this.

Anyway that should be just about enough info for just about any competent developer to get going, even if they have never touched Windows. (No doubt one or two people will want to quibble with what I've done. That's fine - this is a description, not a prescription.)

cheers

andrew


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to