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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM