Fails to build on sparc64 on Linux due to unsupported bit rates
On Linux on sparc64, the build fails with:
nhs_ser.c:99:11: error: ‘B2500000’ undeclared here (not in a function); did you mean ‘B1500000’?
99 | { B2500000, 2500000, "2.5 Mbps" },
| ^~~~~~~~
| B1500000
nhs_ser.c:100:11: error: ‘B3000000’ undeclared here (not in a function); did you mean ‘B1000000’?
100 | { B3000000, 3000000, "3 Mbps" },
| ^~~~~~~~
| B1000000
nhs_ser.c:101:11: error: ‘B3500000’ undeclared here (not in a function); did you mean ‘B1500000’?
101 | { B3500000, 3500000, "3.5 Mbps" },
| ^~~~~~~~
| B1500000
nhs_ser.c:102:11: error: ‘B4000000’ undeclared here (not in a function); did you mean ‘B1000000’?
102 | { B4000000, 4000000, "4 Mbps" },
| ^~~~~~~~
| B1000000
This is because not all baud rates are defined on all architectures in glibc.
On Debian amd64, the contents of /usr/include/x86_64-linux-gnu/bits/termios-baud.h are:
glaubitz@paradis:~$ uname -a
Linux paradis 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64 GNU/Linux
glaubitz@paradis:~$ cat /usr/include/x86_64-linux-gnu/bits/termios-baud.h
/* termios baud rate selection definitions. Linux/generic version.
Copyright (C) 2019-2022 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
<https://www.gnu.org/licenses/>. */
#ifndef _TERMIOS_H
# error "Never include <bits/termios-baud.h> directly; use <termios.h> instead."
#endif
#ifdef __USE_MISC
# define CBAUD 000000010017 /* Baud speed mask (not in POSIX). */
# define CBAUDEX 000000010000 /* Extra baud speed mask, included in CBAUD.
(not in POSIX). */
# define CIBAUD 002003600000 /* Input baud rate (not used). */
# define CMSPAR 010000000000 /* Mark or space (stick) parity. */
# define CRTSCTS 020000000000 /* Flow control. */
#endif
/* Extra output baud rates (not in POSIX). */
#define B57600 0010001
#define B115200 0010002
#define B230400 0010003
#define B460800 0010004
#define B500000 0010005
#define B576000 0010006
#define B921600 0010007
#define B1000000 0010010
#define B1152000 0010011
#define B1500000 0010012
#define B2000000 0010013
#define B2500000 0010014
#define B3000000 0010015
#define B3500000 0010016
#define B4000000 0010017
#define __MAX_BAUD B4000000
glaubitz@paradis:~$
On Debian sparc64, the contents of /usr/include/sparc64-linux-gnu/bits/termios-baud.h are:
glaubitz@stadler:~$ uname -a
Linux stadler 6.17.0-rc5+ #1 SMP Fri Sep 12 20:37:32 UTC 2025 sparc64 GNU/Linux
glaubitz@stadler:~$ cat /usr/include/sparc64-linux-gnu/bits/termios-baud.h
/* termios baud rate selection definitions. Linux/sparc version.
Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
<https://www.gnu.org/licenses/>. */
#ifndef _TERMIOS_H
# error "Never include <bits/termios-baud.h> directly; use <termios.h> instead."
#endif
#ifdef __USE_MISC
# define CBAUD 0x0000100f
# define CBAUDEX 0x00001000
# define CIBAUD 0x100f0000 /* input baud rate (not used) */
# define CMSPAR 0x40000000 /* mark or space (stick) parity */
# define CRTSCTS 0x80000000 /* flow control */
#endif
#define B57600 0x00001001
#define B115200 0x00001002
#define B230400 0x00001003
#define B460800 0x00001004
#define B76800 0x00001005
#define B153600 0x00001006
#define B307200 0x00001007
#define B614400 0x00001008
#define B921600 0x00001009
#define B500000 0x0000100a
#define B576000 0x0000100b
#define B1000000 0x0000100c
#define B1152000 0x0000100d
#define B1500000 0x0000100e
#define B2000000 0x0000100f
#define __MAX_BAUD B2000000
glaubitz@stadler:~$
Full build log available at: https://buildd.debian.org/status/fetch.php?pkg=nut&arch=sparc64&ver=2.8.4%2Breally-2&stamp=1762552686&raw=0
Access to a SPARC machine running either Solaris or Linux for testing can be obtained through the GCC Compile Farm: https://gcc.gnu.org/wiki/CompileFarm
Thanks for the heads-up and for the links. I've actually talked to someone at FOSDEM about the GCC Farm, but then it somehow stalled (on my side probably), as NUT CI farm dedicated VMs and a selection of FOSS-friendly vendors also offers a large footprint for different OSes and a few CPU architectures. But this one did slip through.
I suppose with these baud rates being macros, at least here, adding some #ifdef fencing would make sense in the driver code.
I've posted the commit 392d69c9d2c which I hope should fix your build (probably as a patch file to be added into the 2.8.4 release based recipe). If the idea works, it will be part of 2.8.5 release eventually.
Thanks, builds fine now and testsuite passes without any issues:
============================================================================
Testsuite summary for nut 2.8.4.754
============================================================================
# TOTAL: 5
# PASS: 5
# SKIP: 0
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
============================================================================
Oddly enough I couldn't cherry-pick your patch after adding your repository as an additional remote so that I had to download the patch manually from GitHub.
Anyway, it works. Thanks a lot for the very quick fix!
Oddly, I have more automake standardized TAP tests typically running, possibly your build did not include some options like C++? There were some test programs about string manipulation and bit/byte layout in larger words (for USB etc. conversions of wire/CPU encoding), I hope those were among what passed :)
Also a make check-NIT can be interesting (it actually runs the built programs to see how they behave).
If you have a chance to run ./ci_build.sh there, at least with its default (developer-oriented) activity, it should try to enable everything it can (except heavy docs by default), including the tests and parallel builds where possible.
Funny, I just reported another instance of this bug in different project. ;-)