IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    nginx模块开发(56)—编译可调试的openssl版本

    cjhust发表于 2016-06-06 12:51:48
    love 0

    方法1

    nginx模块开发(56)—编译可调试的openssl版本 - cjhust - 我一直在努力

    CFLAGS="-g -O0" ./configure --prefix=/root/marco \

                                --with-debug \

                                --with-http_stub_status_module \

                                --with-pcre=/root/src/public/pcre-8.38 \

                                --with-openssl-opt="-g -O0"\

                                --with-openssl=/root/src/public/openssl-1.0.2g/ \

                                --with-http_ssl_module \

                                --with-ld-opt="-Wl,-rpath,$LUAJIT_LIB" \

                                --add-module=addons/lua-nginx-module-master

    #make

    #make install

    备注:openssl默认编译选项是O3,加上--with-openssl=-g -O0,只是在编译选项的开头加上了该选项,并没有将O3替换掉,因此没有达到想要的效果。


    方法2(推荐该方法)

    nginx部分

    CFLAGS="-g -O0" ./configure --prefix=/root/marco \

                                --with-debug \

                                --with-http_stub_status_module \

                                --with-pcre=/root/src/public/pcre-8.38 \

                                --with-openssl-opt="-g -O0"\

                                --with-openssl=/root/src/public/openssl-1.0.2g/ \

                                --with-http_ssl_module \

                                --with-ld-opt="-Wl,-rpath,$LUAJIT_LIB" \

                                --add-module=addons/lua-nginx-module-master

    备注:nginx./configure完成后会生成objs/Makefile。

    #vi objs/Makefile

    nginx模块开发(56)—编译可调试的openssl版本 - cjhust - 我一直在努力
     备注:屏蔽nginx对openssl的编译(即openssl手动编译),默认安装在.openssl/目录下。

    openssl部分

    #make depend

    #./config --prefix=/root/src/public/openssl-1.0.2g/.openssl no-shared -g -O0

    备注:将生成的Makefile中的O3改为O0。

    nginx模块开发(56)—编译可调试的openssl版本 - cjhust - 我一直在努力
    #make

    #make install

    备注:默认安装在.openssl/下,nginx链接的也是该目录。(如果你优化了openssl的代码,不想把代码分享给其他人,也可以这样做)

    nginx模块开发(56)—编译可调试的openssl版本 - cjhust - 我一直在努力

    nginx部分

    openssl手动编译好后,nginx再进行make和make install,即可得到可调试版本的openssl。

     


沪ICP备19023445号-2号
友情链接