Mac: make: *** [Zend/zend_language_parser.lo] Error 1

Error reporting content:

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1317:5: error: implicit declaration of function 'yystpcpy' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

                                yystpcpy(yyres, "end of file");

                                ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1317:5: note: did you mean 'stpcpy'?

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/string.h:130:7: note: 'stpcpy' declared here

char    *stpcpy(char *__dst, const char *__src);

         ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1324:29: error: implicit declaration of function 'yystrlen' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

                yystr_len = (unsigned int)yystrlen(yystr);

                                          ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1324:29: note: did you mean 'strlen'?

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/string.h:82:9: note: 'strlen' declared here

size_t   strlen(const char *__s);

         ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1345:4: error: implicit declaration of function 'yystpcpy' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

                        yystpcpy(yyres, buffer);

                        ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1352:10: error: implicit declaration of function 'yystrlen' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

                return yystrlen(yystr) - (*yystr == '"' ?2 : 0);

                       ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1365:2: error: implicit declaration of function 'yystpcpy' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

        yystpcpy(yyres, yystr);

        ^

5 errors generated.

make: *** [Zend/zend_language_parser.lo] Error 1

Implicit declaration of function ‘yystpcpy’ is invalid in C99. Looking up information on the Internet, we can find that this error type is related to the header file or the previous define. From the prompts in the error report, we can see that the function yystpcpy is missing.

Access the file php-src/Zend/zend_language_parser.c. You can see this code below:

Add the definitions of yystpcpy and yystrlen to it, guess that their original functions should be stpcpy and strlen functions: re-make after modification, and compile successfully.

Read More: