Closed cinayakoshka closed 7 years ago
@cinayakoshka perhaps you can try to fix that and send me a pull request then?
@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.
@cinayakoshka so, do I understand correctly, that you now have a working version of AGREP?
@cinayakoshka if you have proposals how to improve the source code, pls. let me know.
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.
@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.
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;)
seems to be a bug, which needs to be fixed, yes.
Meaning you can fix it?
This works for me:
brew install tre
In fact, it builds agrep.
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.
@tolik56 TRE ( https://github.com/laurikari/tre/ ) is not agrep...
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
Hi, if anybody still faces this problem, my patch fixes the issue: https://github.com/Wikinaut/agrep/pull/10
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
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
/* 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>
*/
Thanks, I will test this soon.
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.
I compiled a working version for El Capitan even without your patches many months ago. Of course, the warnings are more than ugly...
fixed with https://github.com/Wikinaut/agrep/pull/11
on 10.9.2,
make
ends with the following: