具有 json-c 未定义符号的 nginx 模块:json_object_to_json_string

nginx module with json-c undefined symbol: json_object_to_json_string

使用 hello 模块安装 nginx(此模块使用 #include )

我在安装 nginx 之前使用 yum -y install json-c json-c-devel

make && make 安装成功。但是当我 运行 nginx 测试

/usr/sbin/nginx-t

显示错误消息:

nginx: [emerg] dlopen() "/etc/nginx/modules/ngx_http_hello_module.so" failed (/etc/nginx/modules/ngx_http_hello_module.so: undefined symbol: json_object_to_json_string) in /etc/nginx/nginx.conf:5
nginx: configuration file /etc/nginx/nginx.conf test failed

ldd /usr/sbin/nginx

json-c库没有加载!我能做什么?

解决这个问题;)

方法是:./configure ... --with-ld-opt="-ljson"

安装成功后(make && make install),输入ldd /usr/sbin/ngin然后你会显示加载的库文件(.so)