Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade system version of build container #2

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

CodeChenL
Copy link

@CodeChenL CodeChenL commented Sep 6, 2024

Signed-off-by: Chen Jiali <chenjiali@radxa.com>
@CodeChenL
Copy link
Author

@RadxaYuntian request a review


RUN dpkg --add-architecture arm64 && \
apt-get update && \
apt-get full-upgrade --no-install-recommends -y \
build-essential crossbuild-essential-arm64 default-jdk-headless git \
cmake debhelper devscripts lintian swig pkgconf:arm64 python3-dev:arm64 libjson-c-dev:arm64 && \
cmake debhelper devscripts lintian swig pkgconf:arm64 python3-dev:arm64 libjson-c-dev:arm64 libstdc++6:arm64 && \
ln -s /usr/bin/python3 /usr/bin/python && \
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python-is-python3依赖冲突的替代方案

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么不直接用python-is-python3

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么不直接用python-is-python3

https://github.com/radxa-pkg/mraa/pull/2/files#r1746676203

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

所以为什么不直接用python-is-python3?依赖冲突是怎么回事

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[0 ~/Documents/GitHub/mraa]$ .github/container/build-deb 
STEP 1/2: FROM debian:bookworm
STEP 2/2: RUN dpkg --add-architecture arm64 &&     apt-get update &&     apt-get full-upgrade --no-install-recommends -y         build-essential crossbuild-essential-arm64 default-jdk-headless git         cmake debhelper devscripts lintian swig pkgconf:arm64 python-is-python3 python3-dev:arm64 libjson-c-dev:arm64 libstdc++6:arm64 &&     ln -s /usr/bin/python3 /usr/bin/python &&     adduser --gecos runner --disabled-password runner &&     rm -rf /var/lib/apt/lists/*
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8787 kB]
Get:5 http://deb.debian.org/debian bookworm/main arm64 Packages [8689 kB]
Get:6 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [13.8 kB]
Get:7 http://deb.debian.org/debian bookworm-updates/main arm64 Packages [13.7 kB]
Get:8 http://deb.debian.org/debian-security bookworm-security/main arm64 Packages [176 kB]
Get:9 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [179 kB]
Fetched 18.1 MB in 3s (6206 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-dev:arm64 : Depends: python3:arm64 (= 3.11.2-1+b1) but it is not installable
 python3.11-dev:arm64 : Depends: python3.11:arm64 (= 3.11.2-6+deb12u3) but it is not installable
E: Unable to correct problems, you have held broken packages.
Error: building at STEP "RUN dpkg --add-architecture arm64 &&     apt-get update &&     apt-get full-upgrade --no-install-recommends -y         build-essential crossbuild-essential-arm64 default-jdk-headless git         cmake debhelper devscripts lintian swig pkgconf:arm64 python-is-python3 python3-dev:arm64 libjson-c-dev:arm64 libstdc++6:arm64 &&     ln -s /usr/bin/python3 /usr/bin/python &&     adduser --gecos runner --disabled-password runner &&     rm -rf /var/lib/apt/lists/*": while running runtime: exit status 100
[chen@ChenArchLinux 18:39]
[100 ~/Documents/GitHub/mraa]$ 

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

参照zfs提供fake dependency试试?

Makefile Outdated
@@ -56,7 +56,7 @@ dch: debian/changelog
EDITOR=true gbp dch --commit --debian-branch=master --release --dch-opt=--upstream

.PHONY: deb
deb: debian
deb: debian SOURCE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是从哪来的改动

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要先make all在能make deb,这正常吗,正常的话就不改了

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个算是正常的,只是我们平常的包的Makefile是在根目录下,debuild会自动make all。现在mraa自己有一个,就不会自动调用我们的make all了

debian/python3-mraa.install Outdated Show resolved Hide resolved

RUN dpkg --add-architecture arm64 && \
apt-get update && \
apt-get full-upgrade --no-install-recommends -y \
build-essential crossbuild-essential-arm64 default-jdk-headless git \
cmake debhelper devscripts lintian swig pkgconf:arm64 python3-dev:arm64 libjson-c-dev:arm64 && \
cmake debhelper devscripts lintian swig pkgconf:arm64 python3-dev:arm64 libjson-c-dev:arm64 libstdc++6:arm64 && \
ln -s /usr/bin/python3 /usr/bin/python && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么不直接用python-is-python3

CodeChenL and others added 2 commits September 6, 2024 17:05
apt-get full-upgrade --no-install-recommends -y \
build-essential crossbuild-essential-arm64 default-jdk-headless git \
cmake debhelper devscripts lintian swig pkgconf:arm64 python3-dev:arm64 libjson-c-dev:arm64 && \
cmake debhelper devscripts lintian swig pkgconf:arm64 python-is-python3 \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实为什么要安装python-is-python3,我们之前没有安装也生成了py3包吧?

Copy link
Author

@CodeChenL CodeChenL Sep 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有一个测试脚本的shebang指定的/usr/bin/python,不安装python-is-python3报错command not found

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#!/usr/bin/python

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

给mraa提pr把这些python都显式改成python3吧。这个他们之前有改过一部分

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外我们debian 11的container难道内置了python2?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看了一下bullseye在config阶段检查不到python2,

-- Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "2.7")
-- Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "2.7")
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.9.2", minimum required is "3") 
-- Found PythonLibs: /usr/lib/aarch64-linux-gnu/libpython3.9.so (found suitable exact version "3.9.2") 

bookworm在config阶段把python3误检测为python2
所以bullseye不会运行这个test脚本,bookworm会

if (PYTHON2INTERP_FOUND AND BUILDSWIGJAVA)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你在这个pr里面改一下看看。如果没问题可以先分一个PR给上游

@CodeChenL
Copy link
Author

@RadxaYuntian request a review

@CodeChenL
Copy link
Author

已在rock5b bookworm测试同样将python3检测为python2并test报错

@@ -138,6 +142,9 @@ endfunction(find_python)
set(MIN_VER_PYTHON2 2.7)
set(MIN_VER_PYTHON3 3.2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我感觉是不是strcmp(“3.11”, "3.2") < 0导致的?上面的修改只是检查检测到的版本是否正确,却没有修正导致检测版本不正确的代码

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

和3.2关系不大吧,主要是find_package(PythonInterp "2.7") 会找到python3,更像是cmake的find_package的bug

find_package(PythonInterp "${preferred_version}")

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我尝试过几个FIND_VERSION_MAJOR变量都没有效果https://cmake.org/cmake/help/latest/command/find_package.html

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

就干脆在下面做判断了

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还试过min...max指定版本范围,但是提示PythonInterp这个包不支持指定范围

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加个cmake版本判断,>=3.12用FindPython2/FindPython3。很快find_package(PythonInterp)就不能用了:https://cmake.org/cmake/help/latest/module/FindPythonInterp.html

Copy link
Author

@CodeChenL CodeChenL Sep 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉是不是直接从opencv更新这个文件比较好,他们有做主版本号判断https://github.com/opencv/opencv/blob/976fb3e8d682cc37caa72fcb32885c97e0a10d24/cmake/OpenCVDetectPython.cmake#L102 ,本来就是copy的opencv的脚本,后续mraa也好跟进opencv的修改,比较有连续性

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opencv的文件和mraa的差别比较大,并且还有他自己的改动(比如优先使用py3)。先要分析mraa到底是怎么在使用这个文件才能下判断

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我使用了FindPython,这个模块也支持主版本号判断

cmake/modules/OpenCVDetectPython.cmake Outdated Show resolved Hide resolved
cmake/modules/OpenCVDetectPython.cmake Outdated Show resolved Hide resolved
Co-authored-by: ZHANG Yuntian <yt@radxa.com>
Copy link
Member

@RadxaYuntian RadxaYuntian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个修改合入后可以把这个文件提给上游

cmake/modules/OpenCVDetectPython.cmake Outdated Show resolved Hide resolved
Co-authored-by: ZHANG Yuntian <yt@radxa.com>
@CodeChenL
Copy link
Author

已提交上游eclipse#1133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

升级编译环境为Debian 12
2 participants