Skip to content

Fails to build on sparc64 on Linux due to unsupported bit rates #3163

@glaubitz

Description

@glaubitz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Debian Linux ecosystemDebian, Ubuntu, Proxmox... (DEB packaging)bugimpacts-release-2.7.4Issues reported against NUT release 2.7.4 (maybe vanilla or with minor packaging tweaks)packagingportabilityWe want NUT to build and run everywhere possibleserial port

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions