{"id":7063,"date":"2024-03-26T17:01:01","date_gmt":"2024-03-26T09:01:01","guid":{"rendered":""},"modified":"2024-03-26T17:01:01","modified_gmt":"2024-03-26T09:01:01","slug":"Nginx \u6dfb\u52a0\u7b2c\u4e09\u65b9\u6a21\u5757\uff0c\u51fa\u73b0 is not binary compatible in \u9519\u8bef\u7684\u95ee\u9898\u89e3\u51b3","status":"publish","type":"post","link":"https:\/\/mushiming.com\/7063.html","title":{"rendered":"Nginx \u6dfb\u52a0\u7b2c\u4e09\u65b9\u6a21\u5757\uff0c\u51fa\u73b0 is not binary compatible in \u9519\u8bef\u7684\u95ee\u9898\u89e3\u51b3"},"content":{"rendered":"

\n <\/path> \n<\/svg> <\/p>\n

\n

Nginx \u6dfb\u52a0\u7b2c\u4e09\u65b9\u6a21\u5757\uff0c\u51fa\u73b0 is not binary compatible in \u9519\u8bef\u7684\u95ee\u9898\u89e3\u51b3<\/h4>\n

\u5728\u542f\u52a8
\n nginx<\/code> \u65f6\uff0c\u53ef\u80fd\u78b0\u5230\u8fc7\u8fd9\u79cd\u60c5\u51b5\uff1a\n<\/div>\n<\/p>\n

[<\/span>centos@localhost ~]<\/span>$ sudo<\/span> \/usr\/sbin\/nginx\n[<\/span>sudo]<\/span> centos \u7684\u5bc6\u7801\uff1a\nnginx: [<\/span>emerg]<\/span> module \"\/usr\/lib64\/nginx\/modules\/ngx_http_image_filter_module.so\"<\/span> is not binary compatible in<\/span> \/usr\/share\/nginx\/modules\/mod-http-image-filter.conf:1\n<\/code><\/pre>\n

\u8fd9\u79cd\u60c5\u51b5\u4e00\u822c\u662f\u7b2c\u4e09\u65b9\u6a21\u5757\u7f16\u8bd1\u4e2d\u5305\u542b\u7684\u7b7e\u540d\u548c\u4f7f\u7528\u7684 nignx<\/strong> \u4e0d\u4e00\u81f4\u5bfc\u81f4\u7684\u3002<\/p>\n

\u89e3\u51b3\u5982\u4e0b<\/mark>\uff1a<\/p>\n

\u9996\u5148\uff0c\u901a\u8fc7 nginx -V<\/code> \u67e5\u770b\u7f16\u8bd1\u4f7f\u7528\u9009\u9879\uff08\u5373\u5f53\u524d\u914d\u7f6e\u7684 configure<\/em> \u53c2\u6570\uff09\uff1a<\/p>\n

[<\/span>centos@localhost ~]<\/span>$ nginx -V\nnginx version: nginx\/1.16.1\nbuilt by gcc 4.8.5 20150623 (<\/span>Red Hat 4.8.5-39)<\/span> (<\/span>GCC)<\/span> \nbuilt with OpenSSL 1.0.2k-fips  26 Jan 2017\nTLS SNI support enabled\nconfigure arguments: --prefix=<\/span>\/usr\/local\/nginx1.16.1 --sbin-path=<\/span>\/usr\/sbin\/nginx --conf-path=<\/span>\/etc\/nginx\/nginx.conf --user=<\/span>nginx --group=<\/span>nginx --pid-path=<\/span>\/var\/run\/nginx.pid --lock-path=<\/span>\/var\/run\/nginx.lock --error-log-path=<\/span>\/var\/log\/nginx\/error.log --http-log-path=<\/span>\/var\/log\/nginx\/access.log --with-select_module --with-poll_module --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=<\/span>dynamic --with-http_image_filter_module=<\/span>dynamic --with-http_geoip_module=<\/span>dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-mail=<\/span>dynamic --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-stream_realip_module --with-stream_geoip_module=<\/span>dynamic --with-stream_ssl_preread_module --with-compat --with-debug\n<\/code><\/pre>\n

\u4e4b\u540e\uff0c\u91cd\u65b0\u7f16\u8bd1 nginx<\/strong> \u6e90\u7801\u751f\u6210\u7684 .so<\/code> \u6a21\u5757\u5e76\u590d\u5236\u5230\u65e7\u76ee\u6807\u8def\u5f84\uff08\u5373\u8986\u76d6\u6389\u539f\u6709\u7684\uff09\u3002\u64cd\u4f5c\u65f6\u9700\u8981\u5728 configure<\/code> \u547d\u4ee4\u4e0a\u8ffd\u52a0\u4e00\u4e2a\u52a8\u6001\u7f16\u8bd1\u7684\u9009\u9879 --add-dynamic-module=<\/code> \u6216\u8005\u76f4\u63a5\u8c03\u7528 .\/configure --with-compat --add-dynamic-module=<\/code> \u7b2c\u4e09\u65b9\u6a21\u5757\u52a8\u6001\u7f16\u8bd1\u547d\u4ee4\u3002\u6b64\u5904\u8def\u5f84\u9700\u8981\u627e\u5230\u4f60\u8981\u7f16\u8bd1\u7684\u52a8\u6001\u6a21\u5757\uff0c\u5373 .c<\/code> \u6587\u4ef6\uff0c\u540e\u9762\u4f7f\u7528 cp<\/code> \u6307\u4ee4\u5728\u8fc1\u79fb\u5230\u76ee\u6807\u6587\u4ef6\u5373\u53ef\u3002<\/p>\n

[<\/span>centos@localhost nginx-1.16.1]<\/span>$ find<\/span> .<\/span> -name \"*http_image_filter_module*\"<\/span>\n.\/src\/http\/modules\/ngx_http_image_filter_module.c\n<\/code><\/pre>\n

\u540c\u65f6\u8fd8\u8981\u5728\u8be5 modules<\/code> \u6587\u4ef6\u5939\u4e0b\u65b0\u589e config<\/code> \u6587\u4ef6\uff0c\u8be5\u6587\u4ef6\u6765\u81ea\u5b98\u7f51\uff0c\u9700\u8981\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u8fdb\u884c\u8c03\u6574\u3002<\/p>\n

[<\/span>centos@localhost nginx-1.16.1]<\/span>$ :<<<\/span>!<\/span>\n \u8fd9\u91cc\u4e3a\u4e86\u6587\u4ef6\u7684\u66f4\u52a0\u89c4\u5219\u6709\u5e8f\uff0c\u4e0d\u76f4\u63a5\u5728 'modules'<\/span> \u91cc\u65b0\u52a0 'config'<\/span> \u6587\u4ef6\uff0c\u800c\u662f\u65b0\u5efa\u7acb 'ngx_http_image_filter_module'<\/span> \u6587\u4ef6\uff0c\u5e76\u5c06 '.c'<\/span> \u539f\u6587\u4ef6\u590d\u5236\u5230\u8be5\u76ee\u5f55\u4e2d\n!<\/span>\n[<\/span>centos@localhost nginx-1.16.1]<\/span>$ mkdir<\/span> src\/http\/modules\/ngx_http_image_filter_module\n[<\/span>centos@localhost nginx-1.16.1]<\/span>$ cp<\/span> src\/http\/modules\/ngx_http_image_filter_module.c src\/http\/modules\/ngx_http_image_filter_module\/ngx_http_image_filter_module.c \n[<\/span>centos@localhost nginx-1.16.1]<\/span>$ vim src\/http\/modules\/ngx_http_image_filter_module\/config\nngx_addon_name=<\/span>ngx_http_image_filter_module\n\nif<\/span> test<\/span> -n \"$ngx_module_link<\/span>\"<\/span>;<\/span> then<\/span>\n    ngx_module_type=<\/span>HTTP\n    ngx_module_name=<\/span>ngx_http_image_filter_module\n    ngx_module_srcs=<\/span>\"$ngx_addon_dir<\/span>\/ngx_http_image_filter_module.c\"<\/span>\n\n    .<\/span> auto\/module\nelse<\/span>\n    HTTP_MODULES=<\/span>\"$HTTP_MODULES<\/span> ngx_http_image_filter_module\"<\/span>\n    NGX_ADDON_SRCS=<\/span>\"$NGX_ADDON_SRCS<\/span> $ngx_addon_dir<\/span>\/ngx_http_image_filter_module.c\"<\/span>\nfi<\/span>\n\n[<\/span>centos@localhost nginx-1.16.1]<\/span>$ :<<<\/span>!<\/span>\n \u5728\u540e\u7eed make<\/span> \u7f16\u8bd1\u9636\u6bb5\uff0c\u53d1\u73b0\u9519\u8bef\n!<\/span>\nAssembler messages:\n\u81f4\u547d\u9519\u8bef\uff1acan't create objs\/src\/http\/modules\/ngx_http_image_filter_module\/ngx_http_image_filter_module.o: \u6ca1\u6709\u90a3\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55\nmake[<\/span>1]<\/span>: *** [<\/span>objs\/src\/http\/modules\/ngx_http_image_filter_module\/ngx_http_image_filter_module.o]<\/span> \u9519\u8bef 2\nmake[<\/span>1]<\/span>: \u79bb\u5f00\u76ee\u5f55\u201c\/home\/centos\/nginx-1.16.1\u201d\nmake: *** [<\/span>build]<\/span> \u9519\u8bef 2\n[<\/span>centos@localhost nginx-1.16.1]<\/span>$ :<<<\/span>!<\/span>\n \u8fd9\u91cc\u5e94\u8be5\u4f7f\u8be5\u6587\u4ef6\u4e0enginx\u76ee\u5f55\u5e73\u7ea7\n!<\/span>\n[<\/span>centos@localhost nginx-1.16.1]<\/span>$ cd<\/span> ..<\/span>\n[<\/span>centos@localhost ~]<\/span>$ cp<\/span> -r nginx-1.16.1\/src\/http\/modules\/ngx_http_image_filter_module ngx_http_image_filter_module\/\n<\/code><\/pre>\n

\u6b64\u5904 config<\/code> \u6587\u4ef6\u6765\u6e90\uff0c\u53c2\u8003\u5b98\u65b9\u8bf4\u660e\uff1aConverting Static Modules to Dynamic Modules<\/p>\n

\u5b8c\u6574\u6d41\u7a0b\u5982\u4e0b\uff1a
\u5728\u4f60\u7f16\u8bd1 nginx<\/strong> \u6e90\u7801\u7684\u6587\u4ef6\u91cc\u518d\u6b21\u6267\u884c .\/configure<\/code> \u6307\u4ee4\uff0c\u5982\u679c\u4f60\u4f7f\u7528\u76f4\u63a5\u8ffd\u52a0\u7684\u547d\u4ee4\uff0c \u6ce8\u610f<\/code> \uff0c\u539f\u6709\u7684\u914d\u7f6e\u53c2\u6570\u4e00\u5b9a\u4e5f\u8981\u52a0\u5165\u3002<\/p>\n

$ .\/configure --prefix=<\/span>\/usr\/local\/nginx1.16.1 \\\n            --sbin-path=<\/span>\/usr\/sbin\/nginx \\\n            --conf-path=<\/span>\/etc\/nginx\/nginx.conf \\\n            --user=<\/span>nginx \\\n            --group=<\/span>nginx \\\n            --pid-path=<\/span>\/var\/run\/nginx.pid \\\n            --lock-path=<\/span>\/var\/run\/nginx.lock \\\n            --error-log-path=<\/span>\/var\/log\/nginx\/error.log \\\n            --http-log-path=<\/span>\/var\/log\/nginx\/access.log \\\n            --with-select_module \\\n            --with-poll_module \\\n            --with-threads \\\n            --with-file-aio \\\n            --with-http_ssl_module \\\n            --with-http_v2_module \\\n            --with-http_realip_module \\\n            --with-http_addition_module \\\n            --with-http_xslt_module=<\/span>dynamic \\\n            --with-http_image_filter_module=<\/span>dynamic \\\n            --with-http_geoip_module=<\/span>dynamic \\\n            --with-http_sub_module \\\n            --with-http_dav_module \\\n            --with-http_flv_module \\\n            --with-http_mp4_module \\\n            --with-http_gunzip_module \\\n            --with-http_gzip_static_module \\\n            --with-http_auth_request_module \\\n            --with-http_random_index_module \\\n            --with-http_secure_link_module \\\n            --with-http_degradation_module \\\n            --with-http_slice_module \\\n            --with-http_stub_status_module \\\n            --with-mail=<\/span>dynamic \\\n            --with-mail_ssl_module \\\n            --with-stream \\\n            --with-stream_ssl_module \\\n            --with-stream_realip_module \\\n            --with-stream_geoip_module=<\/span>dynamic \\\n            --with-stream_ssl_preread_module \\\n            --with-compat \\\n            --with-pcre=<\/span>..<\/span>\/pcre-8.42 \\\n            --with-pcre-jit \\\n            --with-zlib=<\/span>..<\/span>\/zlib-1.2.11 \\\n            --with-openssl=<\/span>..<\/span>\/openssl-1.1.1a \\\n            --with-openssl-opt=<\/span>no-nextprotoneg \\\n            --with-debug \\\n \t\t\t--add-dynamic-module=<\/span>..<\/span>\/ngx_http_image_filter_module #\u8ffd\u52a0\u7684\u52a8\u6001\u7f16\u8bd1<\/span>\n<\/code><\/pre>\n

\u6216\u8005\u91c7\u7528\u52a8\u6001\u7f16\u8bd1\u7684\u547d\u4ee4\uff0c\u663e\u7136\u8fd9\u79cd\u547d\u4ee4\u6bd4\u8f83\u65b9\u4fbf\uff0c\u7701\u53bb\u4e86\u4e86\u89e3\u539f\u6709 configure<\/code> \u914d\u7f6e\u53c2\u6570\u7684\u6b65\u9aa4\uff1a<\/p>\n

$ .\/configure --with-compat --add-dynamic-module=<\/span>..<\/span>\/ngx_http_image_filter_module\n<\/code><\/pre>\n

\u6267\u884c make<\/code> \u7f16\u8bd1\u547d\u4ee4\uff0c\u7f16\u8bd1\u6210\u529f\u4e4b\u540e\uff0c\u4e0d\u8981\u7ee7\u7eed\u6267\u884c make install<\/code> \u3002<\/p>\n

$ make<\/span> \n<\/code><\/pre>\n

\u6700\u540e\u5c06\u4f60\u91cd\u65b0\u7f16\u8bd1\u751f\u6210\u7684\u6587\u4ef6\u590d\u5236\uff08\u8986\u76d6\uff09\u6389\u539f\u6587\u4ef6\u5373\u53ef\uff0c\u5148\u5c06\u539f\u8def\u5f84\u4e0b .so<\/code> \u6587\u4ef6\u5907\u4efd\uff0c\u9632\u6b62\u610f\u5916\uff1a<\/p>\n

[<\/span>centos@localhost nginx-1.16.1]<\/span>$ sudo<\/span> mv<\/span> \/usr\/lib64\/nginx\/modules\/ngx_http_image_filter_module.so \/usr\/lib64\/nginx\/modules\/ngx_http_image_filter_module.so-bak\n[<\/span>centos@localhost nginx-1.16.1]<\/span>$ sudo<\/span> cp<\/span> objs\/ngx_http_image_filter_module.so \/usr\/lib64\/nginx\/modules\/\n<\/code><\/pre>\n

\u8fd9\u6837\u4fbf\u5b8c\u6210\u4e86\u52a8\u6001\u7f16\u8bd1\u3002\u914d\u7f6e\u5982\u679c\u6ca1\u5f00\uff0c\u8bb0\u5f97\u52a0\u8f7d\u6253\u5f00\u5373\u53ef\u3002<\/p>\n

\u7b2c\u4e09\u65b9\u6a21\u5757\u52a8\u6001\u7f16\u8bd1\u5b98\u65b9\u7f51\u7ad9\u53c2\u8003\uff1aCompiling Third-Party Dynamic Modules for NGINX and NGINX Plus<\/p>\n","protected":false},"excerpt":{"rendered":"Nginx \u6dfb\u52a0\u7b2c\u4e09\u65b9\u6a21\u5757\uff0c\u51fa\u73b0 is not binary compatible in \u9519\u8bef\u7684\u95ee\u9898\u89e3\u51b3Nginx\u6dfb\u52a0\u7b2c\u4e09\u65b9\u6a21\u5757\uff0c\u51fa\u73b0isnotbinarycompatiblein...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/7063"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=7063"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/7063\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=7063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=7063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=7063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}