openwrtでpython3.9をコンパイルする方法は?

openwrtでpython3.9をコンパイルする方法は?

Debianでpython3.9をコンパイルするのは簡単です:

    sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev
    wget https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz
    tar -xf Python-3.9.1.tgz
    cd Python-3.9.1
    ./configure --enable-optimizations
    #nproc value is 4 in my pc platform
    make -j 4
    sudo make altinstall

python3.9をコンパイルしてopenwrtにインストールする方法は?

root@OpenWrt:~# cat /etc/banner
  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 19.07.7, r11306-c4a6851c72
 -----------------------------------------------------
root@OpenWrt:~# uname -a
Linux OpenWrt 4.14.221 #0 SMP Mon Feb 15 15:22:37 2021 x86_64 GNU/Linux
root@OpenWrt:~# python3
Python 3.7.10 (default, May 28 2021, 13:26:31) 
[GCC 7.5.0] on linux

一部のソフトウェアにはPython 3.8以降が必要で、python3.9をコンパイルしたいと思います。

ベストアンサー1

OpenWRTバージョン用のSDKをダウンロードし、Python Makefileを変更し、SDKを使用してPythonをコンパイルします。

ここではいくつかの設定手順を見ることができます。https://openwrt.org/docs/guide-developer/using_the_sdk

SDKをインストールしたら、python3のMakefileを変更します。以下は、Pythonを3.9.5に更新するためにマージされたPRの例です。https://github.com/openwrt/packages/pull/15586/commits/e312275dd9c25c4032b4d2d3623b042905c8bf16)

make package/python3/compile V=scその後、SDKフォルダにインストール可能なIPKを生成する同様のコマンドを使用してパッケージをコンパイルできます。bin

おすすめ記事