PerseusDL / morpheus

Morpheus parser
26 stars 24 forks source link

recipe for target 'setquant.c' failed #16

Open matteo-pellegrini opened 7 years ago

matteo-pellegrini commented 7 years ago

I have very basic programming skills, so forgive me if this is a trivial issue. When launching "make", I get this error message:

`make[1]: Entering directory '/home/matteo/Downloads/morpheus-master/src/gkdict' flex -t setquant.l > setquant.c /bin/sh: 1: flex: not found

: recipe for target 'setquant.c' failed make[1]: *** [setquant.c] Error 127 rm setquant.c make[1]: Leaving directory '/home/matteo/Downloads/morpheus-master/src/gkdict' makefile:2: recipe for target 'all' failed make: *** [all] Error 2 ` I understand that the file "setquant.c" is missing, but I have just downloaded the folder without changing anything, so I don't know why. Anyone knows how to solve it? Thanks in advance
christiancasey commented 5 years ago

Definitely not a trivial issue. I had the same problem and it took me forever to figure it out.

All of the .l files are [Flex]() libraries, not standard C source code. Those have to be precompiled by Flex in order to work properly, which means that you need to have Flex installed. Here's a handy guide. (I used Homebrew, but I don't think it matters. Basically you need to install Flex however works best for you.) If you don't have Flex installed, you get that error, which doesn't do anything to indicate the problem. It's very confusing.

Assuming you're using OS X like I am, the problem once you do have Flex installed is that the Flex libraries are named differently. You need to find and change every line in all makefiles that has -lfl to -ll. Then it should find the right Flex files and compile properly.

You may have other problems, such as the error generated when functions without a return type are automatically treated as int fn() by newer versions of gcc. I fixed this by changing CC=gcc to CC=gcc -Wno-return-type in all of the make files. That flag prevents an error from being generated by the many functions that contain return; somewhere, but no return type. I also tried changing all return; to return 0;, but that creates a host of new problems. Ignoring the error is your best bet.

All of that said, after successfully compiling and running cruncher, I've still failed to get the libraries to compile properly. I suspect that it's a similar sort of problem (very old code on new computers), but I haven't been able to find a solution. I'm opening a new issue for that.