Wikinaut / agrep

AGREP - approximate GREP for fast fuzzy string searching. Files are searched for a string or regular expression, with approximate matching capabilities and user-definable records. Developed 1989-1991 by Udi Manber, Sun Wu et al. at the University of Arizona. ISC open source license since Sept. 2014.
Other
292 stars 50 forks source link

Does not make on mac os x #2

Closed cinayakoshka closed 7 years ago

cinayakoshka commented 10 years ago

on 10.9.2, make ends with the following:

^~~~~~~~
10 warnings generated.
gcc -DMEASURE_TIMES=0 -DAGREP_POINTER=1 -DDOTCOMPRESSED=0 -c -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=0 -DHAVE_SYS_NDIR_H=0 -DHAVE_NDIR_H=0 -DUTIME=1 -DISO_CHAR_SET=1 -DS_IFLNK=-1 -Dlstat=stat -O3   -c -o checkfil.o checkfil.c
checkfil.c:53:14: error: variable has incomplete type 'struct stat'
        struct stat buf;
                    ^
checkfil.c:53:9: note: forward declaration of 'struct stat'
        struct stat buf;
               ^
checkfil.c:55:6: warning: implicit declaration of function 'stat' is invalid in C99 [-Wimplicit-function-declaration]
        if (stat(fname, &buf) != 0) {
            ^
1 warning and 1 error generated.
make: *** [checkfil.o] Error 1
Wikinaut commented 10 years ago

@cinayakoshka perhaps you can try to fix that and send me a pull request then?

cinayakoshka commented 10 years ago

@Wikinaut I'm not sure how to fix it. What worked for me was adding CFLAGS = -O -Wno-return-type to the Makefile of the distribution that I found here.

Wikinaut commented 10 years ago

@cinayakoshka so, do I understand correctly, that you now have a working version of AGREP?

Wikinaut commented 10 years ago

@cinayakoshka if you have proposals how to improve the source code, pls. let me know.

cinayakoshka commented 10 years ago

Yeah I don't know about that. C is not my favorite language. Maybe instructions for compiling on Mac OS X could be added to the README. I'll PR that later today if I can get it to work.

Wikinaut commented 10 years ago

@cinayakoshka don't worry. You have posted here, what makes it compiling. That is fine, and will be sufficient for others. There is no need for a formal PR.

helelein commented 8 years ago

Hi, I'm trying to install agrep in a MacBook-Pro OS X 10.10 but get the following errors:

git clone git://github.com/wikinaut/agrep.git Cloning into 'agrep'... remote: Counting objects: 280, done. remote: Total 280 (delta 0), reused 0 (delta 0), pack-reused 280 Receiving objects: 100% (280/280), 3.49 MiB | 1.98 MiB/s, done. Resolving deltas: 100% (119/119), done. Checking connectivity... done. cd agrep/ make gcc -DMEASURE_TIMES=0 -DAGREP_POINTER=1 -DDOTCOMPRESSED=0 -c -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=0 -DHAVE_SYS_NDIR_H=0 -DHAVE_NDIR_H=0 -DUTIME=1 -DISO_CHAR_SET=1 -DS_IFLNK=-1 -Dlstat=stat -O3 -c -o follow.o follow.c gcc -DMEASURE_TIMES=0 -DAGREP_POINTER=1 -DDOTCOMPRESSED=0 -c -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=0 -DHAVE_SYS_NDIR_H=0 -DHAVE_NDIR_H=0 -DUTIME=1 -DISO_CHAR_SET=1 -DS_IFLNK=-1 -Dlstat=stat -O3 -c -o asearch.o asearch.c gcc -DMEASURE_TIMES=0 -DAGREP_POINTER=1 -DDOTCOMPRESSED=0 -c -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=0 -DHAVE_SYS_NDIR_H=0 -DHAVE_NDIR_H=0 -DUTIME=1 -DISO_CHAR_SET=1 -DS_IFLNK=-1 -Dlstat=stat -O3 -c -o asearch1.o asearch1.c gcc -DMEASURE_TIMES=0 -DAGREP_POINTER=1 -DDOTCOMPRESSED=0 -c -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=0 -DHAVE_SYS_NDIR_H=0 -DHAVE_NDIR_H=0 -DUTIME=1 -DISO_CHAR_SET=1 -DS_IFLNK=-1 -Dlstat=stat -O3 -c -o agrep.o agrep.c gcc -DMEASURE_TIMES=0 -DAGREP_POINTER=1 -DDOTCOMPRESSED=0 -c -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=0 -DHAVE_SYS_NDIR_H=0 -DHAVE_NDIR_H=0 -DUTIME=1 -DISO_CHAR_SET=1 -DS_IFLNK=-1 -Dlstat=stat -O3 -c -o bitap.o bitap.c gcc -DMEASURE_TIMES=0 -DAGREP_POINTER=1 -DDOTCOMPRESSED=0 -c -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=0 -DHAVE_SYS_NDIR_H=0 -DHAVE_NDIR_H=0 -DUTIME=1 -DISO_CHAR_SET=1 -DS_IFLNK=-1 -Dlstat=stat -O3 -c -o checkfil.o checkfil.c checkfil.c: In function ‘check_file’: checkfil.c:53:14: error: storage size of ‘buf’ isn’t known struct stat buf; ^ make: *\ [checkfil.o] Error 1

Besides, I tried the solution explained in this other forum: http://practicalcomputing.org/node/136 that seemed to work for cinayakoshka but still had an error. Typing CFLAGS = -O -Wno-return-type to the Makefile did not work for me.

Any suggestions how to fix this error so that I can compile agrep on a Mac OS X 10.10?

Thanks in advance;)

Wikinaut commented 8 years ago

seems to be a bug, which needs to be fixed, yes.

helelein commented 8 years ago

Meaning you can fix it?

tolik56 commented 8 years ago

This works for me:

brew install tre

In fact, it builds agrep.

helelein commented 8 years ago

Thanks a lot! It worked and now I can run agrep;)

2016-02-24 5:21 GMT+01:00 tolik56 notifications@github.com:

This works for me:

brew install tre

In fact, it builds agrep.

— Reply to this email directly or view it on GitHub https://github.com/Wikinaut/agrep/issues/2#issuecomment-188057277.

Wikinaut commented 8 years ago

@tolik56 TRE ( https://github.com/laurikari/tre/ ) is not agrep...

jarekbryk commented 8 years ago

Hello, I have the same problem, this time on OSX 10.11.4 (El Capitan). When I do:

make

this happens:

gcc -DMEASURE_TIMES=0 -DAGREP_POINTER=1 -DDOTCOMPRESSED=0 -c -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=0 -DHAVE_SYS_NDIR_H=0 -DHAVE_NDIR_H=0 -DUTIME=1 -DISO_CHAR_SET=1 -DS_IFLNK=-1 -Dlstat=stat -O3   -c -o checkfil.o checkfil.c
checkfil.c:53:14: error: variable has incomplete type 'struct stat'
        struct stat but;
                    ^
checkfil.c:53:9: note: forward declaration of 'struct stat'
        struct stat but;
               ^
checkfil.c:55:6: warning: implicit declaration of function 'stat' is invalid in
      C99 [-Wimplicit-function-declaration]
        if (stat(fname, &buf) != 0) {
            ^
1 warning and 1 error generated.
make: *** [checkfil.o] Error 1
charlesroelli commented 8 years ago

Hi, if anybody still faces this problem, my patch fixes the issue: https://github.com/Wikinaut/agrep/pull/10

jarekbryk commented 8 years ago

Hello, just tried to make after incorporating changes in your patch and IT WORKS. Thanks a lot! I include a few warnings my system generated whilst making for potential reference below.

I am on OS X 10.11.5 (there was a system update this morning on 25 May 2016 which I installed).

cheers

6 warnings generated.
gcc -DMEASURE_TIMES=0 -DAGREP_POINTER=1 -DDOTCOMPRESSED=0 -c -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=0 -DHAVE_SYS_NDIR_H=0 -DHAVE_NDIR_H=0 -DUTIME=1 -DISO_CHAR_SET=1 -DS_IFLNK=-1 -Dlstat=stat -O3   -c -o codepage.o codepage.c
gcc -DMEASURE_TIMES=0 -DAGREP_POINTER=1 -DDOTCOMPRESSED=0 -c -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=0 -DHAVE_SYS_NDIR_H=0 -DHAVE_NDIR_H=0 -DUTIME=1 -DISO_CHAR_SET=1 -DS_IFLNK=-1 -Dlstat=stat -O3   -c -o agrephlp.o agrephlp.c
agrephlp.c:68:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
extern  AGREPOPT_STR[MAX_LINE_LEN];
~~~~~~  ^
agrephlp.c:69:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
extern  VERBOSE;
~~~~~~  ^
agrephlp.c:222:28: warning: format specifies type 'char *' but the argument has type 'int *' [-Wformat]
fprintf(stderr,"   %s\n\n",AGREPOPT_STR);
                   ~~      ^~~~~~~~~~~~
agrephlp.c:228:12: warning: implicit declaration of function 'get_current_codepage' is invalid in C99
      [-Wimplicit-function-declaration]
if ((cpage=get_current_codepage()) != -1) fprintf(stderr,"is CP %d.\n\n",page);
           ^
4 warnings generated.
gcc -o agrep follow.o asearch.o asearch1.o agrep.o bitap.o checkfil.o compat.o dummyfil.o main.o maskgen.o parse.o checksg.o preproce.o delim.o asplit.o recursiv.o sgrep.o newmgrep.o utilitie.o codepage.o agrephlp.o
rwmitchell commented 7 years ago

I recently did a git pull and the compile failed with many of the similar messages mentioned above. I fixed it by adding include files to:

modified:   checkfil.c
modified:   newmgrep.c
modified:   recursiv.c

Here are the diffs:

checkfil.c 13c13

< #ifdef APPLE

/* 15c15

< #endif

*/ Exit 1 newmgrep.c 23,26d22 < #ifdef APPLE < #include <sys/stat.h> < #endif < 77,79c73,75 < extern int COUNT, FNAME, SILENT, FILENAMEONLY, prev_num_of_matched, num_of_matched; < extern int INVERSE, OUTTAIL;

< extern int WORDBOUND, WHOLELINE, NOUPPER;

extern COUNT, FNAME, SILENT, FILENAMEONLY, prev_num_of_matched, num_of_matched; extern INVERSE, OUTTAIL; extern WORDBOUND, WHOLELINE, NOUPPER; 83,84c79,80 < extern int total_line;

< extern int agrep_initialfd;

extern total_line; extern agrep_initialfd; Exit 1 recursiv.c 65,71c65,67 < #ifdef APPLE < #include <sys/stat.h> < #include // strcpy() < #include // free() < #include // exec() < #endif

<

/*

  • include <sys/stat.h>

    */

Wikinaut commented 7 years ago

Thanks, I will test this soon.

rwmitchell commented 7 years ago

I can send the actual files if need be, or maybe a better diff. I still get a lot of warnings but it produces an executable that seems to work.

On Sep 15, 2016, at 10:08 , Wikinaut notifications@github.com wrote:

Thanks, I will test this soon.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Wikinaut/agrep/issues/2#issuecomment-247338588, or mute the thread https://github.com/notifications/unsubscribe-auth/APNMiXGvaXBROSYF56vnpYCxItB4NX4yks5qqVFigaJpZM4BmInA.

Wikinaut commented 7 years ago

I compiled a working version for El Capitan even without your patches many months ago. Of course, the warnings are more than ugly...

Wikinaut commented 7 years ago

fixed with https://github.com/Wikinaut/agrep/pull/11