diffutils for windows 64-bit

Needed to diff large (> 1GB) text files as part of a toolset, but DiffUtils provided by gnuwin32 is 32-bit only 😦 Of course I tried, but expectedly, it failed to diff the large files. Next solution: compile a native 64-bit version of diff. (Why is there no gnuwin64?) Anyway, I chose to compile on a x86_64 linux machine because I happen to have such a test machine around.

apt-get install mingw-w64
wget http://ftp.gnu.org/gnu/diffutils/diffutils-3.3.tar.xz
tar xJf diffutils-3.3.tar.xz
cd diffutils-3.3
# get diffutils-3.3-mingw64.patch and place it here
patch -p1 -i diffutils-3.3-mingw64.patch
./configure --host=x86_64-w64-mingw32 --prefix=/tmp/diffutils-3.3-mingw64
make && make install

Now, the goods are in /tmp/diffutils-3.3-mingw64/bin. Enjoy!

The file diffutils-3.3-mingw64.patch can be found under Resources. I would have gladly pasted the file here if not for the non-printable character found in the original source. If anyone knows the settings for diff to generate pure printable patch file do drop a comment below, thanks!

Further interesting read: MinGW 64 how-to

 

Advertisements

2 thoughts on “diffutils for windows 64-bit

  1. Hi,
    Great post.
    Strangely, I have not managed to find mingw-w64 in my Ubuntu… I’m running it from a LiveCD on a stick, that may be why.

    I will continue to investigate.

    For converting the patch into readable file, you can use the following page:
    http://www.motobit.com/util/base64-decoder-encoder.asp

    That leads to the following patch:

    diff -ur diffutils-3.3/src/sdiff.c diffutils-3.3-mingw64/src/sdiff.c
    — diffutils-3.3/src/sdiff.c 2013-02-02 12:39:05.000000000 +0800
    +++ diffutils-3.3-mingw64/src/sdiff.c 2013-04-01 00:00:00.000000000 +0800
    @@ -805,7 +805,7 @@

    /* Yield an exit status indicating that a signal was received. */
    untrapsig (s);
    – kill (getpid (), s);
    + raise (s);

    /* That didn’t work, so exit with error status. */
    exit (EXIT_TROUBLE);
    diff -ur diffutils-3.3/src/system.h diffutils-3.3-mingw64/src/system.h
    — diffutils-3.3/src/system.h 2013-02-02 12:39:05.000000000 +0800
    +++ diffutils-3.3-mingw64/src/system.h 2013-04-01 00:00:00.000000000 +0800
    @@ -132,7 +132,6 @@
    #define LIN_MAX PTRDIFF_MAX
    verify (TYPE_SIGNED (lin));
    verify (sizeof (ptrdiff_t) <= sizeof (lin));
    -verify (sizeof (lin) <= sizeof (long int));

    /* This section contains POSIX-compliant defaults for macros
    that are meant to be overridden by hand in config.h as needed. */

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s