CentOS 下编译 Windows 下使用的 OpenResty 1.25.3.1

要在 CentOS 下编译 Windows 下使用的 OpenResty 1.25.3.1,你需要使用交叉编译工具链。以下是基本步骤:

1. 安装必要的工具和依赖项

sudo yum install epel-release
sudo yum groupinstall "Development Tools"
sudo yum install pcre-devel openssl-devel zlib-devel
sudo yum install wget

 

2. 下载 OpenResty 源码

wget https://openresty.org/download/openresty-1.25.3.1.tar.gz
tar -zxvf openresty-1.25.3.1.tar.gz
cd openresty-1.25.3.1

 

3. 配置交叉编译工具链

在 CentOS 中,默认情况下可能没有预装 Windows 下的交叉编译工具链。你需要手动安装。

sudo yum install mingw64-gcc mingw64-gcc-c++ mingw64-pkg-config mingw64-zlib

 

4. 配置和编译 OpenResty

./configure --crossbuild=x86_64-w64-mingw32 \
    --prefix=/path/to/output \
    --with-cc=x86_64-w64-mingw32-gcc \
    --with-pcre-jit \
    --with-ipv6 \
    --with-http_ssl_module \
    --with-http_realip_module \
    --with-http_addition_module \
    --with-http_xslt_module \
    --with-http_image_filter_module \
    --with-http_geoip_module \
    --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_random_index_module \
    --with-http_secure_link_module \
    --with-http_degradation_module \
    --with-http_stub_status_module
make -j$(nproc)
make install

 

5. 验证编译结果

编译完成后,你可以在指定的输出目录中找到编译好的 Windows 可执行文件。将这些文件传输到 Windows 系统上进行测试,确保它们正常运行。

总结

以上是在 CentOS 下编译 Windows 下使用的 OpenResty 的基本步骤。确保按照以上步骤正确配置和编译,以获得所需的 Windows 可执行文件。

posted @ 2024-05-15 16:01  锐洋智能  阅读(37)  评论(0编辑  收藏  举报