I am trying to build rtems-arm toolchain for v5.3 on a Debian 13 host. The first hurdle was to make a minor modification to version.py so it would run under Python 3. The build of the various tools starts but the end of the output shows a failure with rtems-gdb-9.1-1.
package: expat-2.1.0-x86_64-linux-gnu-1
building: expat-2.1.0-x86_64-linux-gnu-1
sizes: expat-2.1.0-x86_64-linux-gnu-1: 7.096MB (installed: 1.311MB)
cleaning: expat-2.1.0-x86_64-linux-gnu-1
reporting: devel/expat-2.1.0-1.cfg -> expat-2.1.0-x86_64-linux-gnu-1.txt
reporting: devel/expat-2.1.0-1.cfg -> expat-2.1.0-x86_64-linux-gnu-1.xml
config: tools/rtems-gdb-9.1-1.cfg
error: shell macro failed: /opt/path_redacted/rtems/rtems-source-builder-5.3/source-builder/sb/rtems-build-dep -c gcc -l : 2: error: no library (-l) provided
Is there some other modifications needed in order to build v5.3 on newer Debian releases?
-Andy.
This reminds me of a problem that was already solved for RTEMS 6. The problem was that new Python versions needed different command line argument :
$ python3.6-config --ldflags
-L/usr/lib64 -lpython3.6m -lpthread -ldl -lutil -lm -Xlinker -export-dynamic
but higher Python versions need --embed:
$ python3.12-config --ldflags --embed
-L/usr/lib64 -lpython3.12 -ldl -lm
What is needed from that output is the -lpythonX.Y part.
When you look into the current RTEMS source builder sources, the file:
source-builder/config/gdb-common-1.cfg (which is %included from tools/rtems-gdb-9.1-1.cfg of your output) line 141:
%define gdb-python-lib-check %(%{_sbdir}/sb/rtems-build-dep -c %{__cc} %{gdb-host-libs} %{gdb-python-config-libpath} -l %{gdb-python-config-libs})
then in your case, gdb-python-config-libs is most likely empty. What it would need there is -lpython3.6m or -lpython3.12 or what ever pythonX.Y-config --ldflags returns in your case.
I can just guess that the fix may not have been ported back to RTEMS 5.
Running the command gives:
$ python-config --ldflags --embed
-L/usr/lib/python3.13/config-3.13-x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -lpython3.13 -ldl -lm
Forcing that value and re-running the build now gives:
error: shell macro failed: /opt/.../RTEMS/development/rtems/rtems-source-builder-5.3/source-builder/sb/rtems-build-dep -c gcc -lpython3.13: 2: error: no header or library file to find found.
-Andy
Just guessing, the next thing which is empty is the gdb-python-config-libpath. From your output it probably needs -L/usr/lib/python3.13/config-3.13-x86_64-linux-gnu or -L/usr/lib/x86_64-linux-gnu to find libpython3.13.so.
Adding --embed to end of the line %define gdb-python-config-lib-check-flags --ldflags (or wherever --ldflags appears in your case) is probably a better way to fix these issues than to hard replace these variables.
It appears that this check in gdb-common-1.cfg fails with Python 3.13:
%if %{gdb-python-ver-mm} < 3.8
%define gdb-python-config-lib-check-flags --ldflags
%else
%define gdb-python-config-lib-check-flags --ldflags --embed
%endif
Replacing it with the code from the same file in v6.1:
%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/.*\.//')
%if %{gdb-python-ver-major} < 3 || \
%{gdb-python-ver-major} == 3 && %{gdb-python-ver-minor} < 8
solves this problem.
-Andy.
Very well.
It needs --embed when Python version is larger than 3.8. %if %{gdb-python-ver-mm} < 3.8 does not work correctly because mathematically (floating point numbers) 3.13 < 3.8.