Skip to content

编译的时候报了几个错 #14

Description

@hustnaive

1、

/usr/bin/m4:config.m4:10: cannot open `php-ext-embed/php_ext_embed.m4': Not a di
rectory

2、

checking for sample support... yes, shared
checking with libelf path... yes, shared
checking whether php_ext_embed_dir is correct... configure: error: php_ext_embed
.h is not exist
make: *** [sample/Makefile] Error 1

3、

make[1]: Entering directory `/tmp/php-ext-embed/sample'
/bin/bash /tmp/php-ext-embed/sample/libtool --mode=compile cc  -I. -I/tmp/php-ex
t-embed/sample -DPHP_ATOM_INC -I/tmp/php-ext-embed/sample/include -I/tmp/php-ext
-embed/sample/main -I/tmp/php-ext-embed/sample -I/usr/local/include/php -I/usr/l
ocal/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zen
d -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/tmp/php-
ext-embed  -DHAVE_CONFIG_H  -g -O2   -c /tmp/php-ext-embed/sample/sample.c -o sa
mple.lo
mkdir .libs
cc -I. -I/tmp/php-ext-embed/sample -DPHP_ATOM_INC -I/tmp/php-ext-embed/sample/i
nclude -I/tmp/php-ext-embed/sample/main -I/tmp/php-ext-embed/sample -I/usr/local
/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/
local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext
/date/lib -I/tmp/php-ext-embed -DHAVE_CONFIG_H -g -O2 -c /tmp/php-ext-embed/samp
le/sample.c  -fPIC -DPIC -o .libs/sample.o
make[1]: *** No rule to make target `/tmp/php-ext-embed/sample//tmp/php-ext-embe
d/php_ext_embed.c', needed by `/tmp/php-ext-embed/php_ext_embed.lo'.  Stop.
make[1]: Leaving directory `/tmp/php-ext-embed/sample'
make: *** [sample-ext-build] Error 2

依次执行下面的命令解决:

假设代码放在/tmp/php-ext-embed目录下面

#调整一下m4文件中的一些问题
sed -i -e 's/PHP_EXT_EMBED_DIR\=php-ext-embed/PHP_EXT_EMBED_DIR\=\/tmp\/php-ext-embed/g' /tmp/php-ext-embed/php_ext_embed.m4
sed -i -e 's/m4_include(php-ext-embed\/php_ext_embed.m4)/m4_include(\/tmp\/php-ext-embed\/php_ext_embed.m4)/g' /tmp/php-ext-embed/sample/config.m4

#生成配置文件
cd /tmp/php-ext-embed/sample && phpize && ./configure

#替换makefile中生成的错误路径(目前还没找到原因)
sed -i -e 's/tmp\/php-ext-embed\/sample\/\/tmp\/php-ext-embed/tmp\/php-ext-embed/g' /tmp/php-ext-embed/sample/Makefile

初接触扩展开发,对phpize和Makefile不是很熟悉,不清楚是我自己编译过程的问题还是代码本身的问题。问题解决过程提供给作者参考一下,如果作者有更好的方案烦请告知。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions