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
291 stars 50 forks source link

Make errors — MacOS Catalina, v10.15.7 #20

Open EDePasquale opened 3 years ago

EDePasquale commented 3 years ago

A sequence of errors occurred during installation when calling the 'make' command. In general, most of them seem to be related to implicit declarations, examples:

To correct this for my machine, I modified the files to either remove or move the if blocks beginning with 'ifdef_WIN32', though there is likely a better solution that doesn't affect other non-Windows operating systems. To make it successfully build on my machine I changed the following:

I may have missed a change or 2 while writing this issue, but these same actions can be used to correct other similar errors.

Wikinaut commented 3 years ago

thanks for reporting. I have not compiled it on/for Mac. Perhaps you can file a regular pull request, please, so that someone else can pull your request and try that. I am very sorry, that I cannot test it at the moment.

adamshostack commented 2 years ago

It's easier to change the Makefile:

-CFLAGS = $(MYDEFINEFLAGS) $(SUBDIRCFLAGS) +CFLAGS = $(MYDEFINEFLAGS) $(SUBDIRCFLAGS) -Wno-implicit-function-declaration

However, I'm not sure how to ifdef that so it only happens on the mac, and turning off that warning seems like a bad idea overall.

petervangalen commented 2 years ago

I am using @EDePasquale's changes to run agrep on macOS Monterey and Red Hat Enterprise Linux Server Version 7.7 (Maipo). I'm happy to create a pull request but don't want to overreach. @Wikinaut which option do you prefer I use here: Screen Shot 2022-04-21 at 11 43 31

Wikinaut commented 2 years ago

Of course, you can issue a pull request, perhaps best in form of a well-named branch.

ryandesign commented 10 months ago

I have not compiled it on/for Mac.

I am very sorry, that I cannot test it at the moment.

You don't need a Mac to verify the problem or its fix. You can add -Werror=implicit-function-declaration to CFLAGS to test it on any OS with any version of clang (and maybe gcc; I don't know). If you use LLVM.org clang 16 or later, that is even the default behavior (as it is for Apple clang 12 or later).

It's easier to change the Makefile:

-CFLAGS       = $(MYDEFINEFLAGS) $(SUBDIRCFLAGS)
+CFLAGS       = $(MYDEFINEFLAGS) $(SUBDIRCFLAGS) -Wno-implicit-function-declaration

However, I'm not sure how to ifdef that so it only happens on the mac, and turning off that warning seems like a bad idea overall.

Right, don't disable the error. Apple and LLVM.org have made it an error in their respective clangs for a reason. It needs to be fixed properly. Much more information at https://trac.macports.org/wiki/WimplicitFunctionDeclaration.