编译安装nginx 1.26.0、openssl 3.0.13 常见报错

报错1

[root@iZbp1htavfuau9xei2p5meZ openssl-3.0.13]# ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl shared
Can't locate IPC/Cmd.pm in @INC (@INC contains: /root/nginx-install/openssl-3.0.13/util/perl /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . /root/nginx-install/openssl-3.0.13/external/perl/Text-Template-1.56/lib) at /root/nginx-install/openssl-3.0.13/util/perl/OpenSSL/config.pm line 19.
BEGIN failed--compilation aborted at /root/nginx-install/openssl-3.0.13/util/perl/OpenSSL/config.pm line 19.
Compilation failed in require at /root/nginx-install/openssl-3.0.13/Configure line 23.
BEGIN failed--compilation aborted at /root/nginx-install/openssl-3.0.13/Configure line 23.

处理:

yum install -y gcc make perl-ExtUtils-MakeMaker perl-IPC-Cmd

报错2

root@iZbp1htavfuau9xei2p5meZ ~]# cd /usr/local/openssl/bin/
[root@iZbp1htavfuau9xei2p5meZ bin]# ldd openssl
        linux-vdso.so.1 =>  (0x00007ffe67b28000)
        libssl.so.3 => not found
        libcrypto.so.3 => not found
        libz.so.1 => /lib64/libz.so.1 (0x00007f329c187000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f329bf83000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f329bd67000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f329b999000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f329c39d000)

处理:

[root@iZbp1htavfuau9xei2p5meZ bin]# cp -a /usr/local/openssl/lib64/libcrypto.so.3 /usr/local/openssl/lib64/libssl.so.3  /usr/lib/
[root@iZbp1htavfuau9xei2p5meZ bin]# ldconfig
[root@iZbp1htavfuau9xei2p5meZ bin]# ldd openssl
        linux-vdso.so.1 =>  (0x00007ffccc1bf000)
        libssl.so.3 => /lib/libssl.so.3 (0x00007f135a4cb000)
        libcrypto.so.3 => /lib/libcrypto.so.3 (0x00007f1359e55000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f1359c3f000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f1359a3b000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f135981f000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f1359451000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f135a770000)

报错3:

[root@iZbp1htavfuau9xei2p5meZ nginx-1.26.0]# make
make -f objs/Makefile
make[1]: Entering directory `/root/nginx-install/nginx-1.26.0'
cd /usr/local/openssl \
&& if [ -f Makefile ]; then make clean; fi \
&& ./config --prefix=/usr/local/openssl/.openssl no-shared no-threads  \
&& make \
&& make install_sw LIBDIR=lib
/bin/sh: line 2: ./config: No such file or directory
make[1]: *** [/usr/local/openssl/.openssl/include/openssl/ssl.h] Error 127
make[1]: Leaving directory `/root/nginx-install/nginx-1.26.0'
make: *** [build] Error 2

处理:

修改$nginx_dir/auto/lib/openssl/conf

        *)
            CORE_INCS="$CORE_INCS $OPENSSL/include"
            CORE_DEPS="$CORE_DEPS $OPENSSL/include/openssl/ssl.h"
            CORE_LIBS="$CORE_LIBS $OPENSSL/lib64/libssl.a"
            CORE_LIBS="$CORE_LIBS $OPENSSL/lib64/libcrypto.a"
            CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
            CORE_LIBS="$CORE_LIBS $NGX_LIBPTHREAD"

            if [ "$NGX_PLATFORM" = win32 ]; then
                CORE_LIBS="$CORE_LIBS -lgdi32 -lcrypt32 -lws2_32"
            fi

报错4:

[root@iZbp1htavfuau9xei2p5meZ sbin]# ldd nginx
        linux-vdso.so.1 =>  (0x00007ffe7bd14000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f14fc715000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f14fc4f9000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f14fc2c2000)
        libpcre2-8.so.0 => not found
        libz.so.1 => /lib64/libz.so.1 (0x00007f14fc0ac000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f14fbcde000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f14fc919000)
        libfreebl3.so => /lib64/libfreebl3.so (0x00007f14fbadb000)

处理:

echo "/usr/local/lib" >> /etc/ld.so.conf
posted @ 2024-05-23 18:21  海yo  阅读(568)  评论(0编辑  收藏  举报