在 centos7 上使用静态 openssl 和 libffi 构建 python3.11.5

Build python3.11.5 with static openssl and libffi on centos7

提问人:Vaghani Rushi 提问时间:10/30/2023 更新时间:10/30/2023 访问量:20

问:

我正在尝试使用静态 openssl 和 libffi 构建 python3.11.5,以便它可以在任何 linux 64 位上运行而不会出现任何问题,但我仍然看到它动态链接到 libcrypto.so

我正在尝试使用静态 openssl 和 libffi 构建 python3.11.5,以便它可以在任何 linux 64 位上运行而不会出现任何问题,但我仍然看到它动态链接到 libcrypto.so

我已经静态构建了 openssl 和 libffi,我看到 libssl.a 和 libcrypto.a 存在于 /customer_path/openssl/lib/ 中 libffi 也是如此

[root@localhost Python-3.11.5]# cat test.sh
!/bin/sh

export LDFLAGS=“-L/home/test/openssl/lib -L/home/test/libffi/lib64 -L/usr/lib -L/usr/lib64 -lffi -ldl -lssl -lcrypto”
export CPPFLAGS=“-I/home/test/openssl/include -I/home/test/libffi/include -I/usr/include”
export CFLAGS=“-static-libgcc”
export LD_LIBRARY_PATH=“/home/test/openssl/lib:/home/test/libffi/lib64”

上面的代码用于使用静态 OpenSSL 和 libffi 构建 Python。

尝试静态构建 openssl 和 libffi,并使用它尝试使用静态 openssl 和 libffi 构建 python3.11.5,但仍然显示与 libcrypt 的动态链接 openssl 和 libffi,但它仍然显示与 libcrypt 的动态链接

I am trying to build python3.11.5 with static openssl and libffi so it can work on any linux 64bit without any issue but i am seeing still its linking dynamically to libcrypto.so

i have statically build openssl and libffi and i see libssl.a and libcrypto.a present in /customer_path/openssl/lib/
and same for libffi

[root@localhost Python-3.11.5]# cat test.sh
!/bin/sh

export LDFLAGS=“-L/home/test/openssl/lib -L/home/test/libffi/lib64 -L/usr/lib -L/usr/lib64 -lffi -ldl -lssl -lcrypto”
export CPPFLAGS=“-I/home/test/openssl/include -I/home/test/libffi/include -I/usr/include”
export CFLAGS=“-static-libgcc”
export LD_LIBRARY_PATH=“/home/test/openssl/lib:/home/test/libffi/lib64”

make clean
./configure --prefix=/home/test/python_static/ --with-openssl=/home/test/openssl --with-system-ffi=/home/test/libffi/lib64 --enable-optimizations --enable-shared=no
make LINKFORSHARED=" "
make install

But still its showing python3.11 binary linking as below

[root@localhost Python-3.11.5]# ldd /home/test/python_static/bin/python3.11
    linux-vdso.so.1 =>  (0x00007ffd521a5000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fb7fdeff000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fb7fdce3000)
    libutil.so.1 => /lib64/libutil.so.1 (0x00007fb7fdae0000)
    libm.so.6 => /lib64/libm.so.6 (0x00007fb7fd7de000)
    libz.so.1 => /lib64/libz.so.1 (0x00007fb7fd5c8000)
    librt.so.1 => /lib64/librt.so.1 (0x00007fb7fd3c0000)
    libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fb7fd189000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fb7fcdbb000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fb7fe103000)
    libfreebl3.so => /lib64/libfreebl3.so (0x00007fb7fcbb8000)

Tried to build openssl and libffi statically and using that trying to build python3.11.5 with static openssl and libffi but still its showing dynamic linking with libcrypt
蟒蛇 python打包

评论


答: 暂无答案