Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not make on mac os x #2

Closed
cinayakoshka opened this issue Mar 2, 2014 · 20 comments
Closed

Does not make on mac os x #2

cinayakoshka opened this issue Mar 2, 2014 · 20 comments

Comments

@cinayakoshka
Copy link

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
Copy link
Owner

Wikinaut commented Mar 2, 2014

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

@cinayakoshka
Copy link
Author

@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
Copy link
Owner

Wikinaut commented Mar 2, 2014

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

@Wikinaut
Copy link
Owner

Wikinaut commented Mar 2, 2014

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

@cinayakoshka
Copy link
Author

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
Copy link
Owner

Wikinaut commented Mar 3, 2014

@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
Copy link

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
Copy link
Owner

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

@helelein
Copy link

Meaning you can fix it?

@tolik56
Copy link

tolik56 commented Feb 24, 2016

This works for me:

brew install tre

In fact, it builds agrep.

@helelein
Copy link

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
#2 (comment).

@Wikinaut
Copy link
Owner

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

@jarekbryk
Copy link

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
Copy link

Hi, if anybody still faces this problem, my patch fixes the issue: #10

@jarekbryk
Copy link

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
Copy link

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 <string.h> // strcpy()
< #include <stdlib.h> // free()
< #include <unistd.h> // exec()
< #endif

<

/*

  • #include <sys/stat.h>
    */

@Wikinaut
Copy link
Owner

Thanks, I will test this soon.

@rwmitchell
Copy link

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 #2 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/APNMiXGvaXBROSYF56vnpYCxItB4NX4yks5qqVFigaJpZM4BmInA.

@Wikinaut
Copy link
Owner

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

@Wikinaut
Copy link
Owner

Wikinaut commented Oct 9, 2016

fixed with #11

@Wikinaut Wikinaut closed this as completed Oct 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants