変奏現実

パソコンやMMORPGのことなどを思いつくまま・・・記載されている会社名・製品名・システム名などは、各社の商標、または登録商標です。

この画面は、簡易表示です

Python-3.8.0

Python-3.8.0 OpenSSLでハマる

ReadyNas のアプリにはPython ver.2.xがあるがver.3.xは無い。

メンドクサイのかなと思ったら

$ sudo apt install python3
Reading package lists… Done
 Building dependency tree
 Reading state information… Done
 The following additional packages will be installed:
   dh-python libmpdec2 libpython3-stdlib libpython3.4-minimal
   libpython3.4-stdlib python3-minimal python3.4 python3.4-minimal
 Suggested packages:
   python3-doc python3-tk python3-venv python3.4-venv python3.4-doc binutils
   binfmt-support
 The following NEW packages will be installed:
   dh-python libmpdec2 libpython3-stdlib libpython3.4-minimal
   libpython3.4-stdlib python3 python3-minimal python3.4 python3.4-minimal
 0 upgraded, 9 newly installed, 0 to remove and 24 not upgraded.
 Need to get 4,276 kB of archives.
 After this operation, 17.5 MB of additional disk space will be used.
 Do you want to continue? [Y/n] y
・・・
$ python3  --version
Python 3.4.2

簡単だった。

元ネタ:Ubuntu18.04にPyhton3.7を導入や設定をしよう!

ps. 2019/11/27
ソースからコンパイルしてみる
ソースからPythonをインストール

ビルドに必要なパッケージが足りないらしいのでインストする。
元ネタは見つかっていない。
参考:Ubuntu環境のPython

sudo apt install build-essential libbz2-dev libdb-dev \
  libreadline-dev libffi-dev libgdbm-dev liblzma-dev \
  libncursesw5-dev libsqlite3-dev libssl-dev \
  zlib1g-dev uuid-dev tk-dev

では設定してコンパイル

$ sudo curl -O https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz
$ sudo tar Jxf Python-3.8.0.tar.xz
$ cd Python-3.8.0
$ sudo ./configure --prefix=/usr/local/python380 --with-ensurepip --enable-optimizations
・・・
$ date; sudo make ; date
・・・
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_ssl
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc                  atexit                pwd
time
Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
LibreSSL 2.6.4 and earlier do not provide the necessary APIs, https://github.com/libressl-portable/portable/issues/381
・・・
Wed Nov 27 21:41:47 JST 2019 ~ Wed Nov 27 21:53:28 JST 2019

実は初回コンパイル時に

If you want a release build with all stable optimizations active (PGO, etc),
please run ./configure --enable-optimizations

と出力されたのて、–enable-optimizations を付けた。

上の Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl は
$ sudo apt-get install libssl-dev 済みだけど中身が
libssl-dev is already the newest version (1.0.1t-1+deb8u12).
と少し古いだけなのに新しいVersionを探さないといけないらしい。
なんとかopensslの1.0.2や1.1.dをインストールしても
sudo make は1.0.2か1.1以上を求めてくるので、
configureに
LDFLAGS=”-L/usr/local/openssl-1.1.1d/lib” CFLAGS=”-I/usr/local/openssl-1.1.1d/include”
を付けたが
流れるログを見ると

/include が取れていた。

多分 /libも取れる

ダメです。

諦めつつもconfigureを読むと
–with-openssl というOpenSSLのパスを指定するオプションがあった。

$ sudo ./configure --prefix=/usr/local/python380 --with-ensurepip --enable-optimizations --with-openssl="/usr/local/openssl-1.1.1d"
$ grep OPENSSL  Makefile
OPENSSL_INCLUDES=-I/usr/local/openssl-1.1.1d/include
OPENSSL_LIBS=-lssl -lcrypto
OPENSSL_LDFLAGS=-L/usr/local/openssl-1.1.1d/lib
$ sudo make
$ sudo make install




top