ubuntu18.04 编译Tengine

下载pcre、openssl、zlib三个源码包

ngx_murmur_hash2文件出现错误,编译选项增加 -Wno-error 

使用openssl-1.1.1会导致以下错误

/opt/ngnix/openssl-1.1.1/.openssl/lib/libcrypto.a(threads_pthread.o): In function `fork_once_func':
threads_pthread.c:(.text+0x16): undefined reference to `pthread_atfork'
collect2: error: ld returned 1 exit status

编译脚本:

./configure --with-cc-opt="-Wno-error" \
--with-pcre=/path/to/pcre-8.38 \
--with-openssl=/path/to/openssl-1.1.0i \
--with-zlib=/path/to/zlib-1.2.11

make

 

安装openssl-1.1.0i后openssl命令出错:

有两个 libcrypto.so.1.1  文件,默认使用了 /usr/lib/x86_64-linux-gnu 下的。

使用 objdump -tT /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 | grep EVP_mdc2 查看动态库,并没有对应的符号。

然后 sudo cp /usr/local/lib/libcrypto.so.1.1 libcrypto.so.1.1 替换一下。

 

集成lua

  1. LuaJIT can be downloaded from the latest release of OpenResty's LuaJIT branch version. The official LuaJIT 2.0 and 2.1 releases are also supported, although the performance will be significantly lower in many cases.
  2. Download the latest version of the ngx_devel_kit (NDK) module HERE.
  3. Download the latest version of ngx_lua HERE.
  4. Download the latest version of Nginx HERE (See Nginx Compatibility)

下载luajit  make && make install 

最后的编译脚本

# tell nginx's build system where to find LuaJIT 2.1:
export LUAJIT_LIB=/usr/local/lib
export LUAJIT_INC=/usr/local/include/luajit-2.1


./configure --with-cc-opt="-Wno-error" \
--with-ld-opt="-Wl,-rpath,/usr/local/lib" \
--with-pcre=/path/to/pcre-8.38 \
--with-openssl=/path/to/openssl-1.1.0i \
--with-zlib=/path/to/zlib-1.2.11 \
--add-module=/path/to/ngx_devel_kit-0.3.0 \
--add-module=/path/to/lua-nginx-module-0.10.13

make -j2
#make install

 mysql支持,下载lua-resty-mysql: https://github.com/openresty/lua-resty-mysql 

sudo cp lib/resty/mysql.lua  /usr/local/share/lua/5.1/resty/mysql.lua

 

posted @ 2018-11-14 13:22  csig  阅读(1760)  评论(0编辑  收藏  举报