Linux系统下,环境是apache+php5,写了一个PHP扩展库,这个扩展库中还需要调用外部的C编写的一个库,我将这个外部库拷贝到/usr/lib下,然后在扩展库中将这个外部库对应的头文件包含进来,扩展库中调用外部库中的函数,在./config --with-php-config=/usr/local/bin/config 的时候出现下面的错误:
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for gcc... gcc
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.有人知道是什么原因吗?请教一下高手。
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for gcc... gcc
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.有人知道是什么原因吗?请教一下高手。
不用放在/usr/lib,放在php自己的库目录中就行。我觉得是用dlopen来使用动态库的。
看看你的/bin下有没有sed这个文件,这是linux的文本以及流处理工具。gcc好像需要用到这个东西。config.log里面有更详细的描述。可以使用dl来动态加载so文件,或者也可以编译的时候把它编译进去。configure --help看一下,有个参数是加载自定义扩展库的。忘记叫什么了。
执行下面两行指令,然后再编译你的扩展库试试
# echo /usr/lib > /etc/ld.so.conf.d/local.conf
# ldconfig