On 4/20/22 01:03, Chris Johns wrote:
On 19/4/2022 8:06 pm, Karel Gardas wrote:

   Chris,

testing RSB on soon to be release Ubuntu 22.04 LTS. This distro provides python
3.10 and interestingly gdb compilation fails badly on it with:

making dir:
/home/karel/workspace/rtems-source-builder/rtems/build/tmp/gmp-6.1.0-x86_64-linux-gnu-1-1000/home/karel/workspace/rtems-tools/share/rtems/rsb

reporting: devel/gmp-6.1.0.cfg -> gmp-6.1.0-x86_64-linux-gnu-1.xml
making dir:
/home/karel/workspace/rtems-source-builder/rtems/build/tmp/gmp-6.1.0-x86_64-linux-gnu-1-1000/home/karel/workspace/rtems-tools/share/rtems/rsb

config: tools/rtems-gdb-11.2.cfg
error: shell macro failed:
/home/karel/workspace/rtems-source-builder/source-builder/sb/rtems-build-dep -c
gcc  -l : 2: error: no library (-l) provided
Build Set: Time 0:01:01.843930


The reason for this is wrong usage of probably lexicographic comparison of
python versions in gdb-common-1.cfg:

Let's apply this debug patch to it and see the output:

diff --git a/source-builder/config/gdb-common-1.cfg
b/source-builder/config/gdb-common-1.cfg
index c7f3955..45e3b88 100644
--- a/source-builder/config/gdb-common-1.cfg
+++ b/source-builder/config/gdb-common-1.cfg
@@ -110,6 +110,7 @@
    %if %{gdb-python-config} != %{nil}
      %define gdb-python-lib-filter awk 'BEGIN{FS="
"}/python/{for(i=1;i<NF;++i)if(match($i,".*lpython.*")) print
"lib"substr($i,3)"*";}'
      %if %{gdb-python-ver-mm} < 3.8
+        %error "not working, python is %{gdb-python-ver-mm} and yet we're in <
3.8 block!"
          %define gdb-python-config-lib-check-flags --ldflags
      %else
          %define gdb-python-config-lib-check-flags --ldflags --embed



and the output is:

Build Set: 6/rtems-arm
config: tools/rtems-gdb-11.2.cfg
error: config error: gdb-common-1.cfg:113: "not working, python is 3.10 and yet
we're in < 3.8 block!"
Build Set: Time 0:00:00.090733

Sorry about the %error usage, have not found any way how to debug cfg files yet
except of moving %error directive around...

Do you have any idea how to make 3.10 to be bigger/higher than 3.8 in this
comparison?

The number 3.8 is less than 3.10 so if we changed things so it was a numeric
check it would still fail.

No, it would not fail, since then

       %if 3.10 < 3.8
+ %error "not working, python is %{gdb-python-ver-mm} and yet we're in < 3.8 block!"
           %define gdb-python-config-lib-check-flags --ldflags
       %else
           %define gdb-python-config-lib-check-flags --ldflags --embed

will evaluate to else block which is exactly what we need for python 3.10.

I suggest %{gdb-python-ver-mm} is split into major and minor parts and each 
checked:

%define gdb-python-ver-major %(echo "%{gdb-python-ver-mm}" | sed -e 's/\..*//')
%define gdb-python-ver-minor %(echo "%{gdb-python-ver-mm}" | sed -e 's/.*\.//')

then:

   %if %{gdb-python-ver-major} < 3 && %{gdb-python-ver-minor} < 8

I would guess this should be

    %if %{gdb-python-ver-major} <= 3 && %{gdb-python-ver-minor} < 8

but otherwise yes, if we're really going this route.

The question is still why we cannot use simple numerical comparison above... This would mean less code -> less bugs. Be more intuitive etc.

Thanks!
Karel



_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to