Building GREP

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Building GREP

Diego Casorran
Hi there,

Has anyone tried to compile grep 2.18-2.20 using mingw/gcc 4.8.1?

Using f.ex "grep foooobar -r *" causes:

C:\MSYS\1.0\bin\grep.exe: build-aux: Bad file descriptor

While using "grep foooobar -R *" gives:

C:\MSYS\1.0\bin\grep.exe: warning: build-aux/snippet: recursive directory loop


Some clue what's going on/how to solve it? nothing from configure i
can find related to that which would help nor Google did, except by
this downvoted SO[1] post mentioning it's caused by symlinks... of
course there aren't symlinks so i'm really lost, wondering if that
might be related to some dirent/opendir issue...

Cheers.

[1] : http://stackoverflow.com/questions/22552538/grep-warning-recursive-directory-loop

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building GREP

Paul Moore
On 4 June 2014 06:14, Diego Casorran <[hidden email]> wrote:
> While using "grep foooobar -R *" gives:
>
> C:\MSYS\1.0\bin\grep.exe: warning: build-aux/snippet: recursive directory loop
>
>
> Some clue what's going on/how to solve it?

IIRC, the code assumes 2 directories with the same ino and device are
the same. That's not true on Windows. Needs a code patch.

Paul

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building GREP

Eli Zaretskii
In reply to this post by Diego Casorran
> Date: Wed, 4 Jun 2014 07:14:53 +0200
> From: Diego Casorran <[hidden email]>
>
> Using f.ex "grep foooobar -r *" causes:
>
> C:\MSYS\1.0\bin\grep.exe: build-aux: Bad file descriptor

Isn't that the MSYS grep.exe that is being invoked here, not the
grep.exe that you've built?

(If that _is_ the grep.exe which you built, then why is it in the MSYS
bin/ directory?)

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building GREP

Diego Casorran
In reply to this post by Paul Moore
2014-06-04 8:58 GMT+02:00 Paul Moore <[hidden email]>:
>
> IIRC, the code assumes 2 directories with the same ino and device are
> the same. That's not true on Windows. Needs a code patch.
>

Thanks! In fact, i read something on lib/fts-cycle.c enter_dir() about
matching dev/inode, but had no clue how to get around that.

Er, well... where can i find such patch? :) I've just downloaded the
original 2.5.4 srcs from the mingw page, but the patch there
(999-grep-2.5.4-2-msys.patch) has - apparently unrelated - changes on
makefile/configure only.


2014-06-04 9:08 GMT+02:00 Eli Zaretskii <[hidden email]>:
> Isn't that the MSYS grep.exe that is being invoked here, not the
> grep.exe that you've built?
>

I've copied it there myself replacing the old 2.5.4

> (If that _is_ the grep.exe which you built, then why is it in the MSYS
> bin/ directory?)

When initially compiled 2.18 a few months ago i ran make install and
it got installed to /usr/local/bin iirc, can't remember if there was
some conflict or something but decided to move it to the place where
the former was installed, to completely replace it.

Cheers.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building GREP

Eli Zaretskii
> Date: Wed, 4 Jun 2014 19:13:09 +0200
> From: Diego Casorran <[hidden email]>
>
> 2014-06-04 8:58 GMT+02:00 Paul Moore <[hidden email]>:
> >
> > IIRC, the code assumes 2 directories with the same ino and device are
> > the same. That's not true on Windows. Needs a code patch.
> >
>
> Thanks! In fact, i read something on lib/fts-cycle.c enter_dir() about
> matching dev/inode, but had no clue how to get around that.
>
> Er, well... where can i find such patch? :)

If you aren't afraid of Windows native symlinks, just disable the
inode test (make it always fail).

> 2014-06-04 9:08 GMT+02:00 Eli Zaretskii <[hidden email]>:
> > Isn't that the MSYS grep.exe that is being invoked here, not the
> > grep.exe that you've built?
> >
>
> I've copied it there myself replacing the old 2.5.4

That's not a good idea, IMO: you should keep MSYS programs under
MSYS's bin/ directory and MinGW programs elsewhere.

> > (If that _is_ the grep.exe which you built, then why is it in the MSYS
> > bin/ directory?)
>
> When initially compiled 2.18 a few months ago i ran make install and
> it got installed to /usr/local/bin iirc

That's because you didn't pass --prefix to the configure scripts, os
it configured with the default prefix, which resolves to the MSYS
tree.  That's not what you'd normally want, and it appears that you
have now overwritten your MSYS Grep that was there before.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building GREP

Diego Casorran
2014-06-04 19:43 GMT+02:00 Eli Zaretskii <[hidden email]>:
> If you aren't afraid of Windows native symlinks, just disable the
> inode test (make it always fail).
>

Yeah, that's the easy path, no doubt. However, even then i'd love to
see that patch since i've noticed some other weird behavior i was
going to mention at some point... such that the newer builds looks
much slower, but rather than processing the files it looks like it's
just while printing to the console. for example grep --help on 2.5.4
the whole text is printed within ms, while on 2.18+ it takes a couple
of seconds.

> That's not a good idea, IMO: you should keep MSYS programs under
> MSYS's bin/ directory and MinGW programs elsewhere.
>

Thanks for the advice :)

> That's because you didn't pass --prefix to the configure scripts, os
> it configured with the default prefix, which resolves to the MSYS
> tree.  That's not what you'd normally want, and it appears that you
> have now overwritten your MSYS Grep that was there before.
>

Actually /usr/local/bin resolves to the MinGW's bin directory here,
I.e it's where gcc.exe resides.

I made a junction from C:\MSYS\1.0\local to C:\MinGW

In any case and fwiw, i did renamed the old binary to grep254.exe
before copying the new version, so i have them both around but the new
one as the default.

Cheers.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building GREP

Paul Moore
On 4 June 2014 19:15, Diego Casorran <[hidden email]> wrote:
> Yeah, that's the easy path, no doubt. However, even then i'd love to
> see that patch

When you say "that patch" there isn't really any such patch. I just
did what we're talking about here which is to disable the inode check.
Sure, I did that by patching the original source, but it's not rocket
science.

If you're interested, the actual patch is in
https://bitbucket.org/pmoore/win64/ specifically look in
https://bitbucket.org/pmoore/win64/src/1175b3b0512cf939f4a8aa4bd07a0b5d714ce14e/patches/?at=default
at diffutils-3.3.tar.xz. The patch file is win64.patch in that
archive.

The rest of that project may be of interest, too, but use at your own
peril. I don't offer support for it, it's purely my personal build
process (and probably makes a lot of choices that people will argue
over :-))

Paul

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building GREP

Diego Casorran
Thanks Paul & Eli, it seems to work fine now :)

My patch:

--- grep-2.20.orig/lib/fts-cycle.c    2014-01-02 02:32:05.000000000 +0100
+++ grep-2.20/lib/fts-cycle.c    2014-06-04 21:25:57.294804000 +0200
@@ -158,3 +158,10 @@ free_dir (FTS *sp)
   else
     free (sp->fts_cycle.state);
 }
+
+#ifdef __MINGW32__
+# define setup_dir(a)     (true)
+# define enter_dir(a,b)   (true)
+# define leave_dir(a,b)   ((void)0)
+# define free_dir(a)      ((void)0)
+#endif /* __MINGW32__ */
--- grep-2.20.orig/lib/same-inode.h    2014-01-02 02:32:06.000000000 +0100
+++ grep-2.20/lib/same-inode.h    2014-06-04 21:12:59.106294100 +0200
@@ -24,6 +24,8 @@
      && (a).st_ino[1] == (b).st_ino[1] \
      && (a).st_ino[2] == (b).st_ino[2] \
      && (a).st_dev == (b).st_dev)
+# elif defined(__MINGW32__)
+#  define SAME_INODE(a, b) (0)
 # else
 #  define SAME_INODE(a, b)    \
     ((a).st_ino == (b).st_ino \


I'm still getting "Bad file descriptor" with -r so i think i'll just
redirect that to -R

Also, if some of you have some idea as to why it prints quite slow to
the console please share! :)

Btw Paul, some specific reason you're using --enable-threads=windows?
I need newer grep to have PCRE support, but i think i read somewhere
it had issues using the native threads (?)

Cheers.



2014-06-04 20:37 GMT+02:00 Paul Moore <[hidden email]>:

> On 4 June 2014 19:15, Diego Casorran <[hidden email]> wrote:
>> Yeah, that's the easy path, no doubt. However, even then i'd love to
>> see that patch
>
> When you say "that patch" there isn't really any such patch. I just
> did what we're talking about here which is to disable the inode check.
> Sure, I did that by patching the original source, but it's not rocket
> science.
>
> If you're interested, the actual patch is in
> https://bitbucket.org/pmoore/win64/ specifically look in
> https://bitbucket.org/pmoore/win64/src/1175b3b0512cf939f4a8aa4bd07a0b5d714ce14e/patches/?at=default
> at diffutils-3.3.tar.xz. The patch file is win64.patch in that
> archive.
>
> The rest of that project may be of interest, too, but use at your own
> peril. I don't offer support for it, it's purely my personal build
> process (and probably makes a lot of choices that people will argue
> over :-))
>
> Paul
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> _______________________________________________
> MinGW-users mailing list
> [hidden email]
>
> This list observes the Etiquette found at
> http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.
>
> _______________________________________________
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users
> Also: mailto:[hidden email]?subject=unsubscribe

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building GREP

Paul Moore
On 4 June 2014 20:48, Diego Casorran <[hidden email]> wrote:
> Btw Paul, some specific reason you're using --enable-threads=windows?
> I need newer grep to have PCRE support, but i think i read somewhere
> it had issues using the native threads (?)

TBH I can't remember. Possibly not wanting to have to include a posix
threads library? (Do other values need that?) It's very much a "works
for me" setup, and I didn't document everything particularly well,
sorry :-(

Paul

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building GREP

Diego Casorran
Ok, no worries, I was just curious. I may give it a try to check how it goes.

Cheers.


2014-06-04 22:29 GMT+02:00 Paul Moore <[hidden email]>:

> On 4 June 2014 20:48, Diego Casorran <[hidden email]> wrote:
>> Btw Paul, some specific reason you're using --enable-threads=windows?
>> I need newer grep to have PCRE support, but i think i read somewhere
>> it had issues using the native threads (?)
>
> TBH I can't remember. Possibly not wanting to have to include a posix
> threads library? (Do other values need that?) It's very much a "works
> for me" setup, and I didn't document everything particularly well,
> sorry :-(
>
> Paul
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> _______________________________________________
> MinGW-users mailing list
> [hidden email]
>
> This list observes the Etiquette found at
> http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.
>
> _______________________________________________
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users
> Also: mailto:[hidden email]?subject=unsubscribe

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe