随笔 - 95  文章 - 0  评论 - 0  阅读 - 96339

/fastdfs-nginx-module/src/common.c:21:25: fatal error: fdfs_define.h: No such file or directory解决方法

问题描述

安装fastdfs-nginx-module模块配置nginx时,出现报错:

In file included from …/fastdfs-nginx-module/src//ngx_http_fastdfs_module.c:6:0:
…/fastdfs-nginx-module/src//common.c:21:25: fatal error: fdfs_define.h: No such file or directory
#include “fdfs_define.h”
^
compilation terminated.

原因分析:

从报错信息可以看出错误位置/fastdfs-nginx-module/src,是config文件配置错误。

nginx配置fastdfs-nginx-module模块时,需要修改config文件

ngx_module_incs=“/usr/include/fastdfs /usr/include/fastcommon/”
CORE_INCS=“$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/”

于是,查看我的配置文件如下:

HTTP_MODULES="$HTTP_MODULES ngx_http_fastdfs_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_fastdfs_module.c"
CORE_INCS="$CORE_INCS /usr/local/include/fastdfs /usr/local/include/fastcommon/"
CORE_LIBS="$CORE_LIBS -L/usr/lib -lfastcommon -lfdfsclient"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='\"/etc/fdfs/mod_fastdfs.conf\"'"

发现CORE_INCS配置有误

解决方案:

将config文件中含有local的地方去掉,然后重新编译nignx即可。

正确的配置文件

HTTP_MODULES="$HTTP_MODULES ngx_http_fastdfs_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_fastdfs_module.c"
ngx_module_incs="/usr/include/fastdfs /usr/include/fastcommon/"
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
CORE_LIBS="$CORE_LIBS -L/usr/lib -lfastcommon -lfdfsclient"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='\"/etc/fdfs/mod_fastdfs.conf\"'"

删除nginx解压目录下的Makefile文件,重新编译安装

./configure --add-module=…/fastdfs-nginx-module/src/
make && make install

创作不易,关注💖、点赞👍、收藏🎉就是对作者最大的鼓励👏,欢迎在下方评论留言🧐

posted on   猫的树kireCat  阅读(483)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示