安装phpssdb 'ext/standard/php_smart_str.h' file not found 问题拓展总结

本文详细记录了在编译PHPSSDB过程中遇到的'ext/standard/php_smart_str.h'文件未找到的问题及解决方案。通过正确下载源码、切换分支等步骤,最终成功解决了编译错误。

1.首先看看问题描述

/Users/augdai/src/phpssdb/ssdb_library.c:21:10: fatal error: 

      'ext/standard/php_smart_str.h' file not found

#include "ext/standard/php_smart_str.h"

         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1 error generated.

make: *** [ssdb_library.lo] Error 1



 'ext/standard/php_smart_str.h' file not found

这个错误是致命的。一起来看看是怎么产生的。


下载文件

wget https://github.com/jonnywang/phpssdb/archive/master.zip

表明 master.zip 是主分支


错误的安装步骤,请看:

1.wget https://github.com/jonnywang/phpssdb/archive/master.zip

2.unzip master.zip

3.cd phpssdb-master

4./Applications/MAMP/bin/php/php7.1.1/bin/phpize

5../configure --with-php-config=/Applications/MAMP/bin/php/php7.1.1/bin/php-config

6.make && sudo make install


当执行到make时候 报错: 'ext/standard/php_smart_str.h' file not found


问题出在我没有切换分支



重点来了!

正确的打开姿势:

1.切换master分支

augdaideMBP:src augdai$ git branch

* master


2.下载git文件

augdaideMBP:src augdai$ git clone https://github.com/jonnywang/phpssdb.git

Cloning into 'phpssdb'...

remote: Counting objects: 361, done.

remote: Total 361 (delta 0), reused 0 (delta 0), pack-reused 361

Receiving objects: 100% (361/361), 818.93 KiB | 162.00 KiB/s, done.

Resolving deltas: 100% (229/229), done.


3.进入下载的文件夹中

augdaideMBP:src augdai$ cd phpssdb


4.调整分支

augdaideMBP:phpssdb augdai$ git branch

* master


5.切换到php7

augdaideMBP:phpssdb augdai$ git checkout php7

Branch php7 set up to track remote branch php7 from origin.

Switched to a new branch 'php7'



6.编译phpize

augdaideMBP:phpssdb augdai$ /Applications/MAMP/bin/php/php7.1.1/bin/phpize

Configuring for:

PHP Api Version:         20160303

Zend Module Api No:      20160303

Zend Extension Api No:   320160303


7.配置参数

augdaideMBP:phpssdb augdai$ ./configure --with-php-config=/Applications/MAMP/bin/php/php7.1.1/bin/php-config

。。。。漫长的等待。。。。


=====结果=====

----------------------------------------------------------------------

Libraries have been installed in:

   /Users/augdai/src/phpssdb/modules


If you ever happen to want to link against installed libraries

in a given directory, LIBDIR, you must either use libtool, and

specify the full pathname of the library, or use the `-LLIBDIR'

flag during linking and do at least one of the following:

   - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable

     during execution


See any operating system documentation about shared libraries for

more information, such as the ld(1) and ld.so(8) manual pages.

----------------------------------------------------------------------


Build complete.

Don't forget to run 'make test'.


augdaideMBP:phpssdb augdai$ sudo make install

Password:

Installing shared extensions:     /Applications/MAMP/bin/php/php7.1.1/lib/php/extensions/no-debug-non-zts-20160303/

augdaideMBP:phpssdb augdai$ 


8.完成安装。


9.感谢 姚逸帆 的耐心指导,不胜感激!

<think>好的,我现在需要解决用户提到的编译错误,具体是关于找不到头文件`include/hook/libcameraservice_ext_hook.h`,导致`CameraService.h`编译失败的问题。首先,我得分析可能的原因,然后一步步给出解决方案。 首先,用户的问题是在编译过程中出现头文件缺失的错误。常见的这类错误通常有几个原因:头文件路径未正确包含、头文件确实未安装或未被正确生成、或者编译配置有误。用户提到的文件`libcameraservice_ext_hook.h`看起来像是一个自定义或扩展的头文件,可能属于某个特定的库或模块。 接下来,我需要考虑Android系统的代码结构。根据用户提供的引用[1],Camera相关的本地方法封装在`android_hardware_Camera.cpp`,位于`frameworks/base/core/jni/`路径下。这可能意味着与CameraService相关的代码可能在`frameworks/av/services/camera/libcameraservice/`目录中。因此,用户可能需要检查这个路径下是否存在该头文件,或者是否正确引用了相关模块。 可能的解决方案步骤: 1. **确认头文件是否存在**:用户需要先确定`libcameraservice_ext_hook.h`是否存在于源代码中。如果不存在,可能需要从其他部分获取,比如是否是第三方库或自定义修改的一部分。 2. **检查编译配置**:在Android.mk或Android.bp文件中,是否正确添加了该头文件的路径。例如,使用`LOCAL_C_INCLUDES`或者`include_dirs`来包含头文件所在的目录。 3. **模块依赖**:确保依赖的模块已经被正确编译和链接。如果`libcameraservice_ext`是一个单独的库,需要确认它是否被正确构建,并且在编译顺序上优先于当前模块。 4. **权限和生成脚本**:根据引用[3]提到的权限问题,虽然主要是关于打包镜像的,但有时候编译脚本的权限问题也可能导致生成文件失败,需要检查相关脚本是否完整。 5. **同步代码和清理构建**:有时,代码未完全同步或残留的中间文件可能导致问题,执行`repo sync`和清理构建目录可能解决。 接下来,我需要验证这些步骤是否合理,并确保没有遗漏的可能性。例如,是否有环境变量需要设置,或者是否特定的分支或提交引入了这个头文件。此外,用户可能需要查阅相关模块的文档或构建说明,以确认是否需要额外的配置步骤。 最后,将这些步骤整理成用户容易理解的解决方案,分点说明,并引用提供的参考资料,特别是关于Camera模块的路径和编译注意事项。</think>### 解决方案:CameraService.h编译错误`libcameraservice_ext_hook.h`未找到 #### 1. 确认头文件来源与路径 - **定位文件位置**:首先在Android源码中搜索`libcameraservice_ext_hook.h`文件,例如: ```bash find . -name "libcameraservice_ext_hook.h" ``` 根据引用[1],Camera相关代码位于`frameworks/base/core/jni/`和`frameworks/av/services/camera/libcameraservice/`路径下,需优先检查这些目录及其子目录[^1]。 #### 2. 修复编译配置 - **添加头文件路径**: - 如果头文件存在于源码中但路径未包含,需在模块的`Android.mk`或`Android.bp`中添加路径: ```makefile # Android.mk示例 LOCAL_C_INCLUDES += frameworks/av/services/camera/libcameraservice/hook ``` - 若使用`Android.bp`,添加: ```json include_dirs: ["frameworks/av/services/camera/libcameraservice/hook"] ``` #### 3. 检查模块依赖关系 - **确认模块编译顺序**:`libcameraservice_ext`可能是CameraService的扩展模块,需确保其先被编译。在`Android.mk`中添加依赖: ```makefile LOCAL_STATIC_LIBRARIES += libcameraservice_ext ``` #### 4. 同步代码并清理构建 - **更新代码分支**:执行`repo sync`确保代码最新,避免因分支差异导致文件缺失。 - **清理中间文件**: ```bash make clean rm -rf out/target/common/obj/CAMERA_LIBRARIES/libcameraservice_ext_intermediates/ ``` #### 5. 验证自定义修改 - **检查Hook实现**:若`libcameraservice_ext_hook.h`是自定义扩展(如相机Hook功能),需确认: - Hook代码已正确集成到源码树 - 相关`LOCAL_MODULE`定义完整 - 权限配置正确(参考引用[3]中提到的权限修复方法)[^3] #### 6. 补充环境配置 - **设置环境变量**:在编译前执行: ```bash source build/envsetup.sh lunch <device-config> ``` --- ### 相关问题 1. Android Camera HAL层与Framework层如何交互? 2. 如何调试Android源码中的头文件依赖问题? 3. Android编译系统如何管理模块依赖? --- 通过上述步骤可系统性地解决头文件缺失问题。若文件属于第三方扩展,需联系提供方获取完整代码。若涉及权限问题,可尝试使用`-f`参数强制修复路径(参考引用[3])[^3]。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值