Canadian cross building error during mpfr configuration

I’m trying to use RTEMS Canadian Cross Building as described in
RTEMS User Manual (7.491f6c8) 15.3. Cross and Canadian Cross Building — RTEMS User Manual 7.491f6c8 (12th May 2025) documentation.

Before all, I have to tell that I’m a real newbie in RTEMS domain. I’m just starting using and configuring RTEMS tool chain. So please, forgive me if I’m not as clear as I should in my explanations.

Here is my work context :

  • BUILD machine(B) : WSL/Linux (where the build is ran to create the Tool Chain)
  • HOST machine (H) : Windows x64 (where the Tool Chain produced will run)
  • TARGET machine (T) : ARM/RTEMS6 (where binaries produced by the host machine will be executed)

As recommended in User Manual, I launch the following command in WSL session :
…/source-builder/sb-set-builder --build=x86_64-linux-gnu --host=x86_64-w64-mingw32 --target=arm-rtems6 --prefix=$HOME/.local/rtems-6-arm-xilinx_zynq_a9 --bset-tar-file --no-install 6/rtems-arm-windows-host

Rsb release 6 is a constraint imposed by my customer. I have created the new build set 6/rtems-arm-windows-host.bset from 6/rtems-arm.bset specifically for Canadian Cross building.

Commands added in 6/rtems-arm-windows-host.bset vs 6/rtems-arm.bset are :

  • %defineifnot build x86_64-linux-gnu
  • %defineifnot host x86_64-w64-mingw32
  • %defineifnot target arm-rtems6
  • %define allow_cxc

Without these commands in the build set, Canadian Cross building (Cxc) is not done .

The previous sb-set-builder command fails with following error :

sylvainc@EX-PC008:~/src/rsb/rtems$ ../source-builder/sb-set-builder --build=x86_64-linux-gnu --host=x86_64-w64-mingw32 --target=arm-rtems6 --prefix=$HOME/.local/rtems-6-arm-xilinx_zynq_a9 --bset-tar-file --no-install 6/rtems-arm-windows-host
RTEMS Source Builder - Set Builder, 6 (0c685d82082a modified)
warning: environment PATH suspicious path: [Errno 13] Permission denied: '/mnt/c/Program Files/WindowsApps'
Build Set: 6/rtems-arm-windows-host
Build Set: tools/rtems-default-tools.bset
config: devel/dtc-1.6.1-1.cfg
package: dtc-1.6.1-x86_64-linux-gnu-1
building: dtc-1.6.1-x86_64-linux-gnu-1
sizes: dtc-1.6.1-x86_64-linux-gnu-1: 4.615MB (installed: 1.214MB)
cleaning: dtc-1.6.1-x86_64-linux-gnu-1
package: (Cxc) dtc-1.6.1-x86_64-w64-mingw32-1
building: (Cxc) dtc-1.6.1-x86_64-w64-mingw32-1
sizes: dtc-1.6.1-x86_64-w64-mingw32-1: 4.613MB (installed: 1.213MB)
cleaning: (Cxc) dtc-1.6.1-x86_64-w64-mingw32-1
reporting: devel/dtc-1.6.1-1.cfg -> dtc-1.6.1-x86_64-w64-mingw32-1.txt
reporting: devel/dtc-1.6.1-1.cfg -> dtc-1.6.1-x86_64-w64-mingw32-1.xml
Build Set: devel/expat-internal.bset
config: devel/expat-2.5.0-1.cfg
package: expat-2.5.0-x86_64-linux-gnu-1
building: expat-2.5.0-x86_64-linux-gnu-1
sizes: expat-2.5.0-x86_64-linux-gnu-1: 8.896MB (installed: 0.000B)
cleaning: expat-2.5.0-x86_64-linux-gnu-1
package: (Cxc) expat-2.5.0-x86_64-w64-mingw32-1
building: (Cxc) expat-2.5.0-x86_64-w64-mingw32-1
sizes: expat-2.5.0-x86_64-w64-mingw32-1: 9.125MB (installed: 0.000B)
cleaning: (Cxc) expat-2.5.0-x86_64-w64-mingw32-1
cleaning: expat-2.5.0-x86_64-w64-mingw32-1
Build Set: Time 0:00:23.942061
Build Set: devel/gmp-internal.bset
config: devel/gmp-6.3.0.cfg
package: gmp-6.3.0-x86_64-linux-gnu-1
building: gmp-6.3.0-x86_64-linux-gnu-1
sizes: gmp-6.3.0-x86_64-linux-gnu-1: 35.536MB (installed: 0.000B)
cleaning: gmp-6.3.0-x86_64-linux-gnu-1
package: (Cxc) gmp-6.3.0-x86_64-w64-mingw32-1
building: (Cxc) gmp-6.3.0-x86_64-w64-mingw32-1
sizes: gmp-6.3.0-x86_64-w64-mingw32-1: 31.505MB (installed: 0.000B)
cleaning: (Cxc) gmp-6.3.0-x86_64-w64-mingw32-1
cleaning: gmp-6.3.0-x86_64-w64-mingw32-1
Build Set: Time 0:01:32.215594
Build Set: devel/mpfr-internal.bset
config: devel/mpfr-4.2.1.cfg
package: mpfr-4.2.1-x86_64-linux-gnu-1
building: mpfr-4.2.1-x86_64-linux-gnu-1
error: building %{name}
Build FAILED
  See error report: rsb-report-mpfr-4.2.1-x86_64-linux-gnu-1.txt
  Note: In some cases the error appears only in
  the complete build log (see --log option)
error: building %{name}
Build Set: Time 0:00:06.828520
error: building %{name}
Build Set: Time 0:02:18.207793
error: building %{name}
Build Set: Time 0:02:18.210143
Build FAILED

The following error is notified in rsb-log-20251105-112107.txt :

checking for recent GMP... yes
checking usable gmp.h at link time... yes
checking for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency... yes
checking for long to fit in mp_limb_t... yes
checking for intmax_t to fit in mp_limb_t... yes
checking if we can link with GMP... no
configure: error: libgmp not found or uses a different ABI (including static vs shared).
Please read the INSTALL file -- see "In case of problem".
shell cmd failed: /bin/sh -ex  /home/sylvainc/src/rsb/rtems/build/mpfr-4.2.1-x86_64-linux-gnu-1-cxc/do-build
error: building %{name}
  See error report: rsb-report-mpfr-4.2.1-x86_64-linux-gnu-1.txt
  Note: In some cases the error appears only in
  the complete build log (see --log option)
Build Set: Time 0:00:06.828520
Build Set: Time 0:02:18.207793
Build Set: Time 0:02:18.210143

The following error is notified in rsb-report-mpfr-4.2.1-x86_64-linux-gnu-1.txt :

checking for TLS support using C11... yes
checking if compiler knows _Decimal64... yes
checking decimal float format... BID
checking bit-field ordering for _Decimal128... little endian
checking if _Float128 with hex constants is supported... yes
checking for Static Assertion support... yes
checking whether gcc __attribute__ ((mode (XX))) works... yes
checking for gmp.h... yes
checking for recent GMP... yes
checking usable gmp.h at link time... yes
checking for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency... yes
checking for long to fit in mp_limb_t... yes
checking for intmax_t to fit in mp_limb_t... yes
checking if we can link with GMP... no
configure: error: libgmp not found or uses a different ABI (including static vs shared).
Please read the INSTALL file -- see "In case of problem".
shell cmd failed: /bin/sh -ex  /home/sylvainc/src/rsb/rtems/build/mpfr-4.2.1-x86_64-linux-gnu-1-cxc/do-build
error: building %{name}

The error appears during build of mpfr-4.2.1 package.
Build of mpfr-4.2.1 package required access to lib libgmp.a which is available in temporary folder : src\rsb\rtems\build\tmp\sb-1000-internal\lib

I found on the internet and in some chat room that sometimes there might be inconsistencies between gmp package and mpfr package release 4.2.1. I saw that it was possible to make this type of Canadian Cross building using 4.1.0 or 4.1.1 package. I have done this test (modifying accordingly some specific cfg and bset files) but the same error is encountered.

My questions :

  • Is it possible to perfom a Canadian Cross Build in the context I’m describing ?
  • How can I fix this problem ?
  • Do you have any alternatives or some hints to go ahead in my investigations ?

Thanks in advance for any help about this problem.

Thanks for the post and excellent detail.

What you are doing looks fine so I suspect there is either a bug in the build script for MPFR or something in MPFR.

The simplest approach is to add --trace to the command line of the RSB and once you hit the error find it in the log. Change to the MPFR build directory and copy the command line from the log and test the build by hand. You can then investigate if there is a configure and build command line for MPFR that works in cross build.

This is slow and bit painful to debug and I guess no one has been building CxC tools for a long time and something has broken. It would be great to see them working.