mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] Busybox hwclock failing to build with musl RISC-V 32-bit: SYS_settimeofday undefined
@ 2024-04-07 17:18 Thomas Petazzoni
  2024-04-07 17:37 ` Markus Wichmann
  2024-04-08  2:18 ` Rich Felker
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2024-04-07 17:18 UTC (permalink / raw)
  To: busybox, musl; +Cc: Waldemar Brodkorb

Hello,

The recently released musl 1.2.5 includes 32-bit RISC-V support. Turns
out that building Busybox 1.36.1 with this new musl version, on 32-bit
RISC-V, fails with:

util-linux/hwclock.c: In function 'set_kernel_tz':
util-linux/hwclock.c:142:27: error: 'SYS_settimeofday' undeclared (first use in this function); did you mean 'xsettimeofday'?
  142 |         int ret = syscall(SYS_settimeofday, NULL, tz);
      |                           ^~~~~~~~~~~~~~~~
      |                           xsettimeofday
util-linux/hwclock.c:142:27: note: each undeclared identifier is reported only once for each function it appears in

Busybox already includes some slightly convoluted sorcery to deal with
musl:

static void set_kernel_tz(const struct timezone *tz)
{
#if LIBC_IS_MUSL
	/* musl libc does not pass tz argument to syscall
	 * because "it's deprecated by POSIX, therefore it's fine
	 * if we gratuitously break stuff" :(
	 */
#if !defined(SYS_settimeofday) && defined(SYS_settimeofday_time32)
# define SYS_settimeofday SYS_settimeofday_time32
#endif
	int ret = syscall(SYS_settimeofday, NULL, tz);
#else
	int ret = settimeofday(NULL, tz);
#endif
	if (ret)
		bb_simple_perror_msg_and_die("settimeofday");
}

I am not sure whether this is a Busybox problem or a musl problem,
which is why I'm cross-posting on both mailing lists.

Thanks a lot in advance for your feedback,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [musl] Busybox hwclock failing to build with musl RISC-V 32-bit: SYS_settimeofday undefined
@ 2024-03-03 14:36 Thomas Petazzoni
  2024-03-03 15:17 ` Rich Felker
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2024-03-03 14:36 UTC (permalink / raw)
  To: busybox, musl; +Cc: Waldemar Brodkorb

Hello,

The recently released musl 1.2.5 includes 32-bit RISC-V support. Turns
out that building Busybox 1.36.1 with this new musl version, on 32-bit
RISC-V, fails with:

util-linux/hwclock.c: In function 'set_kernel_tz':
util-linux/hwclock.c:142:27: error: 'SYS_settimeofday' undeclared (first use in this function); did you mean 'xsettimeofday'?
  142 |         int ret = syscall(SYS_settimeofday, NULL, tz);
      |                           ^~~~~~~~~~~~~~~~
      |                           xsettimeofday
util-linux/hwclock.c:142:27: note: each undeclared identifier is reported only once for each function it appears in

Busybox already includes some slightly convoluted sorcery to deal with
musl:

static void set_kernel_tz(const struct timezone *tz)
{
#if LIBC_IS_MUSL
	/* musl libc does not pass tz argument to syscall
	 * because "it's deprecated by POSIX, therefore it's fine
	 * if we gratuitously break stuff" :(
	 */
#if !defined(SYS_settimeofday) && defined(SYS_settimeofday_time32)
# define SYS_settimeofday SYS_settimeofday_time32
#endif
	int ret = syscall(SYS_settimeofday, NULL, tz);
#else
	int ret = settimeofday(NULL, tz);
#endif
	if (ret)
		bb_simple_perror_msg_and_die("settimeofday");
}

I am not sure whether this is a Busybox problem or a musl problem,
which is why I'm cross-posting on both mailing lists.

Thanks a lot in advance for your feedback,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-08  2:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-07 17:18 [musl] Busybox hwclock failing to build with musl RISC-V 32-bit: SYS_settimeofday undefined Thomas Petazzoni
2024-04-07 17:37 ` Markus Wichmann
2024-04-07 19:50   ` Markus Wichmann
2024-04-08  2:18 ` Rich Felker
  -- strict thread matches above, loose matches on Subject: below --
2024-03-03 14:36 Thomas Petazzoni
2024-03-03 15:17 ` Rich Felker
2024-03-05 20:30   ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).