Расширение PHP с C. При создании первой среды я получил синтаксическую ошибку awk, используя ext_skel
Ошибка выше:
enter code here
awk: syntax error at source line 256 source file /Users/Princelo/Downloads/php-5.5.14/ext/skeleton/create_stubs
context is
if (!stubs) print "" > extname >>> "/function_warning" <<<
awk: illegal statement at source line 257 source file /Users/Princelo/Downloads/php-5.5.14/ext/skeleton/create_stubs
awk: syntax error at source line 267 source file /Users/Princelo/Downloads/php-5.5.14/ext/skeleton/create_stubs
rm: function_entries: No such file or directory
rm: function_declarations: No such file or directory
rm: function_stubs: No such file or directory
enter code here
Он сгенерировал myextension.c, у которого нет функции «PHP_FUNCTION (myextension)».
Как решить проблему? Моя ОС Yosemite, версия PHP 5.5.14. Спасибо!
источник create_stubs от строки 251 до конца:
enter code here
print proto > stubfile
if (funcvals) print funcvals > stubfile
if (fetchargs) print fetchargs > stubfile
if (resources) {
print resources > stubfile
if (!stubs) print "" > extname "/function_warning"}
if (!i_know_what_to_do_shut_up_i_dont_need_your_help_mode) {
print "\tphp_error(E_WARNING, \"" funcs[i] ": not yet implemented\");" > stubfile
}
print "}\n/* }}} */\n" > stubfile
if (stubs) {
h_stubs = h_stubs "PHP_FUNCTION(" funcs[i] ");\n"c_stubs = c_stubs "\tPHP_FE(" funcs[i] ",\tNULL)\n"} else {
print "PHP_FUNCTION(" funcs[i] ");" > extname "/function_declarations"print "\tPHP_FE(" funcs[i] ",\tNULL)" > extname "/function_entries"}
if (xml) print xmlstr > xmldoc
}
if (stubs) {
print "\n/* ----------------------------------------------------------- */\n" > stubfile
print c_stubs > stubfile
print "\n/* ----------------------------------------------------------- */\n" > stubfile
print h_stubs > stubfile
}
if (xml) print xmlfoot > xmldoc
}
#
# Local variables:
# tab-width: 2
# c-basic-offset: 2
# End:
enter code here
Строка 256
if (!stubs) print "" > extname "/function_warning"
Выражения на правой стороне >
должны быть заключены в скобки:
if (!stubs) print "" > ( extname "/function_warning" )
так как порядок оценки зависит от реализации. То же самое для других ваших строк печати.
Других решений пока нет …