Matteo Concas created an issue: 
https://gitlab.rtems.org/rtems/tools/rtems_waf/-/issues/7



## Summary
<!--
Please provide as much information as possible such as error messages or 
attaching logs
-->
This is on GCC 16.1.0:
```bash
$ sparc-rtems7-gcc --version
sparc-rtems7-gcc (GCC) 16.1.0 20260430 (RTEMS 7, RSB 
b03c726e60e703b4a3d4e265cb8e9badc5235f0a, Newlib a0ccec7e)
Copyright (C) 2026 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```

A valid RTEMS SMP BSP will return "The configuration failed" even though 
nothing is wrong with the BSP itself.

## Steps to reproduce
Pick your favorite BSP in SMP configuration and run the Waf configure step:
```bash
$ ./waf -p configure --prefix=/opt/rtems/7 --rtems-bsps=sparc/gr740_smp
Setting top to                           : /home/matteo/dev/rtems/rtems-libbsd
Setting out to                           : 
/home/matteo/dev/rtems/rtems-libbsd/build
RTEMS Version                            : 7
Architectures                            : riscv-rtems7, sparc-rtems7
Board Support Package (BSP)              : sparc-rtems7-gr740_smp
Show commands                            : no
Long commands                            : no
Checking for program 'sparc-rtems7-gcc'  : /opt/rtems/7/bin/sparc-rtems7-gcc
Checking for program 'sparc-rtems7-g++'  : /opt/rtems/7/bin/sparc-rtems7-g++
Checking for program 'sparc-rtems7-gcc'  : /opt/rtems/7/bin/sparc-rtems7-gcc
Checking for program 'sparc-rtems7-ld'   : /opt/rtems/7/bin/sparc-rtems7-ld
Checking for program 'sparc-rtems7-ar'   : /opt/rtems/7/bin/sparc-rtems7-ar
Checking for program 'sparc-rtems7-nm'   : /opt/rtems/7/bin/sparc-rtems7-nm
Checking for program 'sparc-rtems7-objdump' : 
/opt/rtems/7/bin/sparc-rtems7-objdump
Checking for program 'sparc-rtems7-objcopy' : 
/opt/rtems/7/bin/sparc-rtems7-objcopy
Checking for program 'sparc-rtems7-readelf' : 
/opt/rtems/7/bin/sparc-rtems7-readelf
Checking for program 'sparc-rtems7-strip'   : 
/opt/rtems/7/bin/sparc-rtems7-strip
Checking for program 'sparc-rtems7-ranlib'  : 
/opt/rtems/7/bin/sparc-rtems7-ranlib
Checking for program 'rtems-ld'             : /opt/rtems/7/bin/rtems-ld
Checking for program 'rtems-tld'            : /opt/rtems/7/bin/rtems-tld
Checking for program 'rtems-syms'           : /opt/rtems/7/bin/rtems-syms
Checking for program 'rtems-bin2c'          : /opt/rtems/7/bin/rtems-bin2c
Checking for program 'tar'                  : /usr/bin/tar
Checking for program 'gcc, cc'              : /opt/rtems/7/bin/sparc-rtems7-gcc
Checking for program 'ar'                   : /opt/rtems/7/bin/sparc-rtems7-ar
Checking for program 'g++, c++'             : /opt/rtems/7/bin/sparc-rtems7-g++
Checking for program 'ar'                   : /opt/rtems/7/bin/sparc-rtems7-ar
Checking for program 'gas, gcc'             : /opt/rtems/7/bin/sparc-rtems7-gcc
Checking for program 'ar'                   : /opt/rtems/7/bin/sparc-rtems7-ar
Checking for c flags '-MMD'                 : yes
Checking for cxx flags '-MMD'               : yes
Compiler version (sparc-rtems7-gcc)         : 16.1.0 20260430 (RTEMS 7, RSB 
b03c726e60e703b4a3d4e265cb8e9badc5235f0a, Newlib a0ccec7e)
Checking for a valid RTEMS BSP installation : no
The configuration failed
(complete log in /home/matteo/dev/rtems/rtems-libbsd/build/config.log)
```

The checks fail when we try to compile and link a minimal RTEMS application:
```log
-------------------------------------------
Checking for a valid RTEMS BSP installation
==>
#include <rtems.h>
void Init(rtems_task_argument arg) { (void)arg; }
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
<==
[1/2] Compiling build/.conf_check_f1288dec71125f8a90f82dc0a53c5163/test.c

['/opt/rtems/7/bin/sparc-rtems7-gcc', '-mcpu=leon3', 
'-isystem/opt/rtems/7/sparc-rtems7/gr740_smp/lib/include', '-MMD', '../test.c', 
'-c', 
'-o/home/matteo/dev/rtems/rtems-libbsd/build/.conf_check_f1288dec71125f8a90f82dc0a53c5163/testbuild/test.c.1.o']
[2/2] Linking 
build/.conf_check_f1288dec71125f8a90f82dc0a53c5163/testbuild/testprog

['/opt/rtems/7/bin/sparc-rtems7-gcc', '-mcpu=leon3', 
'-isystem/opt/rtems/7/sparc-rtems7/gr740_smp/lib/include', '-MMD', 
'-mcpu=leon3', '-B/opt/rtems/7/sparc-rtems7/gr740_smp/lib', '-qrtems', 
'-Wl,--gc-sections', 'test.c.1.o', 
'-o/home/matteo/dev/rtems/rtems-libbsd/build/.conf_check_f1288dec71125f8a90f82dc0a53c5163/testbuild/testprog',
 '-Wl,-Bstatic', '-Wl,-Bdynamic']
err: 
/opt/rtems/7/bin/../lib/gcc/sparc-rtems7/16.1.0/../../../../sparc-rtems7/bin/ld:
  /opt/rtems/7/sparc-rtems7/gr740_smp/lib/start.o: in function `hard_reset':
....
```
I won't put the full error trace as I don't think it's very relevant.
Now if I try to run the exact same commands from the terminal I will run into 
the same errors which is expected.

To actually get the application to link I need to supply 
`-B/opt/rtems/7/sparc-rtems7/gr740_smp/lib` in the compile step and then 
everything is fine.

The "dirty" fix for this is to have:
```diff
diff --git a/rtems.py b/rtems.py
index c35b7d0..981a48b 100644
--- a/rtems.py
+++ b/rtems.py
@@ -268,7 +268,7 @@ def configure(conf, bsp_configure=None):
         cflags['cxxflags'] = copy.copy(cflags['cflags'])
         cflags['asflags'] = copy.copy(cflags['cflags'])

-        conf.env.CFLAGS = cflags['cflags']
+        conf.env.CFLAGS = cflags['cflags'] + ldflags['specs']
         conf.env.CXXFLAGS = cflags['cxxflags']
         conf.env.ASFLAGS = cflags['asflags']
         conf.env.WFLAGS = cflags['warnings']
```
I have only run into this trying to configure rtems-libbsd. I'm quite surprised 
I haven't seen this earlier.
<!-- Pre-set options
- milestone
-->

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/tools/rtems_waf/-/issues/7
You're receiving this email because of your account on gitlab.rtems.org.


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to