Shared Library files not found when building Python3.12 as non-root user

I am trying to build Python3.12 from source as a non-root user. I am aware that it need openssl (for pip) and the libffi headers, which I have attempted to build from source as well. Doing this I end up with the following errors in the make log:

[ERROR] _ctypes failed to import: libffi.so.8: cannot open shared object file: No such file or directory
[ERROR] _hashlib failed to import: libcrypto.so.3: cannot open shared object file: No such file or directory
[ERROR] _ssl failed to import: libssl.so.3: cannot open shared object file: No such file or directory
The following modules are *disabled* in configure script:
_sqlite3                                                       

The necessary bits to build these optional modules were not found:
_curses               _curses_panel         _dbm               
_gdbm                 _lzma                 _tkinter           
nis                   readline                                 
To find the necessary bits, look in configure.ac and config.log.

Following modules built successfully but were removed because they could not be imported:
_ctypes               _hashlib              _ssl               

Could not build the ssl module!
Python requires a OpenSSL 1.1.1 or newer

Checked 111 modules (31 built-in, 67 shared, 1 n/a on linux-x86_64, 1 disabled, 8 missing, 3 failed on import)

I would like to be able to (among other) use the ctype module, so this is sub-optimal.

The steps I took

Step 1: build libffi from source. I followed [these][(https://github.com/libffi/libffi?tab=readme-ov-file#installing-libffi) instructions and included --prefix=$HOME/.local (since that is where I would like to install everything locally) when configuring the make file. (./configure --prefix=$HOME/.local).

Step 2: build openssl from source. I (more or less) followed these instructions. I again included --prefix=$HOME/.local during configuration.

By now, my .local folder looks something like this:

├── bin
│   ├── c_rehash
│   └── openssl
├── include
│   ├── ffi.h
│   ├── ffitarget.h
│   └── openssl
│       └── <loads of header files>.h
├── lib
│   ├── libcrypto.so
│   ├── libffi.so
│   ├── libssl.so
│   └── pkgconfig
│       └── libffi.pc
├── lib64
│   ├── cmake
│   │   └── OpenSSL
│   │       ├── OpenSSLConfig.cmake
│   │       └── OpenSSLConfigVersion.cmake
│   ├── engines-3
│   │   ├── afalg.so
│   │   ├── capi.so
│   │   ├── loader_attic.so
│   │   └── padlock.so
│   ├── libcrypto.a
│   ├── libcrypto.so
│   ├── libcrypto.so.3
│   ├── libffi.a
│   ├── libffi.la
│   ├── libffi.so
│   ├── libffi.so.8
│   ├── libffi.so.8.1.3
│   ├── libssl.a
│   ├── libssl.so
│   ├── libssl.so.3
│   ├── ossl-modules
│   │   └── legacy.so
│   └── pkgconfig
│       ├── libcrypto.pc
│       ├── libssl.pc
│       └── openssl.pc
├── share
│   ├── ...
...

Step 3: build Python3.12 from source. Here I also included the take-aways from this post and tried to include all the correct flag etc. My suspicion is that it goes wrong here.

To configure:

./configure --enable-optimizations --with-lto --with-openssl=$HOME/.local 
--prefix=$HOME/.local/ 
LIBFFI_INCLUDEDIR=$HOME/.local/include 
LDFLAGS="-L$HOME/.local/lib/../lib64 -L$HOME/.local/lib64" 
CFLAGS="-I$HOME/.local/include"

This resulted (after lots of tries) in some positive outputs for the checks to libiff and openssl files.

To build (for some reason repeating the include dir, see earlier link):

make LIBFFI_INCLUDEDIR=$HOME/.local/include

This executing of make then results in the errors

(Note: New here, not a Linux-wizard)

New contributor

bart is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật