-
Couldn't load subscription status.
- Fork 56
Building OpenResty
The instructions provided below specify the steps to build OpenResty 1.13.6.1 on Linux on IBM Z for the following distributions:
- RHEL (6.9, 7.1, 7.2, 7.3, 7.4)
- SLES (11 SP4, 12, 12 SP1, 12 SP2, 12 SP3)
- Ubuntu (16.04, 17.04, 17.10)
- LuaJIT -- Instructions for building LuaJIT can be found here
General Notes:
-
When following the steps below please use a standard permission user unless otherwise specified.
-
A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.
-
RHEL 6.9
sudo yum install -y git tar wget make gcc gcc-c++ unix2dos hg postgresql-devel patch pcre-devel readline-devel openssl openssl-devel-
Build GCC 4.8.2:
cd /<source_root>/ sudo yum install -y binutils-devel bzip2 wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2 tar xvf gcc-4.8.2.tar.bz2 cd gcc-4.8.2 ./contrib/download_prerequisites mkdir /<source_root>/gccbuild cd /<source_root>/gccbuild ../gcc-4.8.2/configure --prefix="/opt/gcc" --enable-shared --with-system-zlib --enable-threads=posix --enable-__cxa_atexit --enable-checking --enable-gnu-indirect-function --enable-languages="c,c++" --disable-bootstrap --disable-multilib make all sudo make install export PATH=/opt/gcc/bin:$PATH export LD_LIBRARY_PATH=/opt/gcc/lib64:/opt/gcc/lib:$LD_LIBRARY_PATH sudo mv /usr/bin/gcc /usr/bin/gcc.bkup sudo ln -s /opt/gcc/bin/gcc /usr/bin/gcc
-
Install Perl 5.24.1
cd /<source_root> wget http://www.cpan.org/src/5.0/perl-5.24.1.tar.gz tar xvf perl-5.24.1.tar.gz cd perl-5.24.1 ./Configure -des -Dprefix=/usr/local/perl -Dnoextensions=ODBM_File make sudo make install export PATH=/usr/local/perl/bin/:$PATH perl -v
-
-
RHEL (7.1, 7.2, 7.3, 7.4)
sudo yum install -y git tar wget make gcc gcc-c++ unix2dos hg cpan perl postgresql-devel patch pcre-devel readline-devel openssl openssl-devel -
SLES 11 SP4
sudo zypper install -y git tar wget make gcc gcc-c++ mercurial patch pcre-devel readline-devel openssl libopenssl-devel aaa_base awk flex bison postgresql94-devel-
Install unix2dos 4.1
cd /<source_root> wget https://waterlan.home.xs4all.nl/unix2dos/unix2dos-4.1.tar.gz tar xvf unix2dos-4.1.tar.gz cd unix2dos-4.1 make sudo make install
-
Install Perl 5.24.1
cd /<source_root> wget http://www.cpan.org/src/5.0/perl-5.24.1.tar.gz tar xvf perl-5.24.1.tar.gz cd perl-5.24.1 ./Configure -des -Dprefix=/usr/local/perl -Dnoextensions=ODBM_File make sudo make install export PATH=/usr/local/perl/bin/:$PATH perl -v
-
-
SLES (12, 12 SP1, 12 SP2)
sudo zypper install -y git tar wget make gcc gcc-c++ unix2dos hg perl postgresql94-devel patch pcre-devel readline-devel openssl openssl-devel aaa_base -
SLES 12 SP3
sudo zypper install -y git tar wget make gcc gcc-c++ unix2dos hg perl postgresql96-devel patch pcre-devel readline-devel openssl openssl-devel aaa_base -
Ubuntu (16.04, 17.04, 17.10)
sudo apt-get update sudo apt-get install -y git tar wget make gcc dos2unix hgview libreadline-dev patch libpcre3-dev libpcre3 libcurl4-openssl-dev libncursesada*-dev postgresql libpq-dev openssl libssl-dev perl sudo ln -s make /usr/bin/gmake
Note: Set /sbin to your PATH environment variable if not already set.
cd /<source_root>
wget https://openresty.org/download/openresty-1.13.6.1.tar.gz
tar -xvf openresty-1.13.6.1.tar.gz# if (!$user_luajit_xcflags
# || $user_luajit_xcflags !~ /-msse4\.2\b/)
# {
# # check -msse4.2
# my ($out, $cfile) = tempfile("resty-config-XXXXXX",
# SUFFIX => '.c', TMPDIR => 1,
# UNLINK => 1);
#
# print $out "
#int main(void) {
##ifndef __SSE4_2__
## error SSE 4.2 not found
##endif
# return 0;
#}
#";
# close $out;
#
# my $ofile = tmpnam();
# my $comp = ($cc || 'cc');
# my $found;
#
# if (system("$comp -o $ofile -msse4.2 -c $cfile") == 0 && -s $ofile) {
# unlink $ofile;
#
# if (system("$comp -o $ofile -march=native -c $cfile") == 0 && -s $ofile) {
# print "INFO: found -msse4.2 in $comp.\n";
# $found = 1;
# $luajit_xcflags .= " -msse4.2";
# }
# }
#
# if (-f $ofile) {
# unlink $ofile;
# }
#
# if (!$found) {
# print "WARNING: -msse4.2 not supported in $comp.\n";
# }
# }Note: -msse4.2 compilation option is not supported on s390x.
cd /<source_root>/openresty-1.13.6.1
rm -rf /<source_root>/openresty-1.13.6.1/bundle/LuaJIT-2.1-20171103/
cp -r /<source_root>/LuaJIT /<source_root>/openresty-1.13.6.1/bundle/LuaJIT-2.1-20171103/
cd /<source_root>/openresty-1.13.6.1
./configure --without-http_redis2_module --with-http_iconv_module --with-http_postgres_module -j2
make -j2
sudo make installcd /<source_root>/openresty-1.13.6.1/build/nginx-1.13.6
./configure && make && sudo make installexport PATH=/usr/local/openresty/bin:$PATH
resty -V Notes: Openresty installation is completed. Please follow the below optional steps to run sanity tests on Openresty.
sudo cpan Cwd IPC::Run3 Test::Base Test::LongStringNotes:
1. For options prompted please select the default option.
2. In RHEL 6.9 or SLES 11 SP4, if you get the error sudo: cpan: command not found , use the absolute path for cpan.
3. If you get the warning perl: warning: Setting locale failed. , set LANG environment variable.
export LANG=C
mkdir /<source_root>/openresty-1.13.6.1/t
cd /<source_root>/openresty-1.13.6.1/t
wget https://raw.githubusercontent.com/openresty/openresty/v1.13.6.1/t/Config.pm
wget https://raw.githubusercontent.com/openresty/openresty/v1.13.6.1/t/sanity.t
-
Edit file
/<source_root>/openresty-1.13.6.1/t/Config.pm@@ -20,10 +20,6 @@ chomp $RootDir; sub run_tests { - my $ver = `bash util/ver`; - chomp $ver; - - cd "openresty-$ver"; $DistRoot = cwd(); $BuildRoot = File::Spec->rel2abs("./build");
-
Edit file
/<source_root>/openresty-1.13.6.1/t/sanity.t-
Ubuntu (16.04, 17.04, 17.10)
@@ -1710,8 +1710,8 @@ platform: linux (linux) cp -rp bundle/ build cd build -export LIBPQ_LIB='/usr/lib64' -export LIBPQ_INC='/usr/include' +export LIBPQ_LIB='/usr/lib/s390x-linux-gnu' +export LIBPQ_INC='/usr/include/postgresql' cd LuaJIT-2.1-20171103 INFO: found -msse4.2 in cc. gmake TARGET_STRIP=@: CCDEBUG=-g XCFLAGS='-DLUAJIT_ENABLE_LUA52COMPAT -msse4.2' CC=cc PREFIX=/usr/local/openresty/luajit @@ -1741,7 +1741,7 @@ --add-module=../rds-json-nginx-module-0.15 \ --add-module=../rds-csv-nginx-module-0.08 \ --add-module=../ngx_stream_lua-0.0.3 \ - --with-ld-opt='-Wl,-rpath,/usr/lib64:/usr/local/openresty/luajit/lib' \ + --with-ld-opt='-Wl,-rpath,/usr/lib/s390x-linux-gnu:/usr/local/openresty/luajit/lib' \ --with-stream --with-stream_ssl_module --with-http_ssl_module cd ../.. Type the following commands to build and install:
-
SLES (11 SP4, 12, 12 SP1, 12 SP2)
@@ -1710,8 +1710,8 @@ platform: linux (linux) cp -rp bundle/ build cd build -export LIBPQ_LIB='/usr/lib64' -export LIBPQ_INC='/usr/include' +export LIBPQ_LIB='/usr/postgresql94/lib64' +export LIBPQ_INC='/usr/include/pgsql' cd LuaJIT-2.1-20171103 INFO: found -msse4.2 in cc. gmake TARGET_STRIP=@: CCDEBUG=-g XCFLAGS='-DLUAJIT_ENABLE_LUA52COMPAT -msse4.2' CC=cc PREFIX=/usr/local/openresty/luajit @@ -1741,7 +1741,7 @@ --add-module=../rds-json-nginx-module-0.15 \ --add-module=../rds-csv-nginx-module-0.08 \ --add-module=../ngx_stream_lua-0.0.3 \ - --with-ld-opt='-Wl,-rpath,/usr/lib64:/usr/local/openresty/luajit/lib' \ + --with-ld-opt='-Wl,-rpath,/usr/lib/postgresql94/lib64:/usr/local/openresty/luajit/lib' \ --with-stream --with-stream_ssl_module --with-http_ssl_module cd ../.. Type the following commands to build and install:
-
SLES 12 SP3
@@ -1710,8 +1710,8 @@ platform: linux (linux) cp -rp bundle/ build cd build -export LIBPQ_LIB='/usr/lib64' -export LIBPQ_INC='/usr/include' +export LIBPQ_LIB='/usr/postgresql96/lib64' +export LIBPQ_INC='/usr/include/pgsql' cd LuaJIT-2.1-20171103 INFO: found -msse4.2 in cc. gmake TARGET_STRIP=@: CCDEBUG=-g XCFLAGS='-DLUAJIT_ENABLE_LUA52COMPAT -msse4.2' CC=cc PREFIX=/usr/local/openresty/luajit @@ -1741,7 +1741,7 @@ --add-module=../rds-json-nginx-module-0.15 \ --add-module=../rds-csv-nginx-module-0.08 \ --add-module=../ngx_stream_lua-0.0.3 \ - --with-ld-opt='-Wl,-rpath,/usr/lib64:/usr/local/openresty/luajit/lib' \ + --with-ld-opt='-Wl,-rpath,/usr/lib/postgresql96/lib64:/usr/local/openresty/luajit/lib' \ --with-stream --with-stream_ssl_module --with-http_ssl_module cd ../.. Type the following commands to build and install:
-
All Distributions
sed -i "/configure line 663/d" sanity.t sed -i "/INFO: found -msse4.2 in cc./d" sanity.t sed -i "/WARNING: -msse4.2/d" sanity.t sed -i "s/ XCFLAGS='-msse4.2'//g" sanity.t sed -i "s/ -msse4.2//g" sanity.t sed -i "s/-msse4.2 -DLUAJIT_ENABLE_LUA52COMPAT/-DLUAJIT_ENABLE_LUA52COMPAT/g" sanity.t
-
export PERL5LIB=/<source_root>/openresty-1.13.6.1 # For Ubuntu (17.04, 17.10) only
cd /<source_root>/openresty-1.13.6.1
prove -r t The information provided in this article is accurate at the time of writing, but on-going development in the open-source projects involved may make the information incorrect or obsolete. Please open issue or contact us on IBM Z Community if you have any questions or feedback.