Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 920576 - sys-apps/systemd-255.1 fails to build on mips (stage1 builds, o32 abi, -Werror=incompatible-pointer-types)
Summary: sys-apps/systemd-255.1 fails to build on mips (stage1 builds, o32 abi, -Werro...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo systemd Team
URL: https://github.com/systemd/systemd/is...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-23 16:52 UTC by Andreas K. Hüttel
Modified: 2024-06-29 18:19 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build log (sys-apps_systemd-255.1.log.xz,41.88 KB, application/x-xz)
2023-12-23 16:58 UTC, Andreas K. Hüttel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas K. Hüttel archtester gentoo-dev 2023-12-23 16:52:27 UTC
FAILED: systemd-storagetm.p/src_storagetm_storagetm.c.o 
mips-softfloat-linux-gnu-gcc -Isystemd-storagetm.p -I. -I../systemd-stable-255.1 -Isrc/basic -I../systemd-stable-255.1/src/basic -Isrc/fundamental -I../systemd-stable-255.1/src/fundamental -Isrc/systemd -I../systemd-stable-255.1/src/systemd -I../systemd-stable-255.1/src/libsystemd/sd-bus -I../systemd-stable-255.1/src/libsystemd/sd-device -I../systemd-stable-255.1/src/libsystemd/sd-event -I../systemd-stable-255.1/src/libsystemd/sd-hwdb -I../systemd-stable-255.1/src/libsystemd/sd-id128 -I../systemd-stable-255.1/src/libsystemd/sd-journal -I../systemd-stable-255.1/src/libsystemd/sd-netlink -I../systemd-stable-255.1/src/libsystemd/sd-network -I../systemd-stable-255.1/src/libsystemd/sd-resolve -Isrc/shared -I../systemd-stable-255.1/src/shared -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -Wno-missing-field-initializers -Wno-unused-parameter -Warray-bounds -Warray-bounds=2 -Wdate-time -Wendif-labels -Werror=format=2 -Werror=format-signedness -Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=missing-declarations -Werror=missing-prototypes -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=strict-flex-arrays -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wzero-length-bounds -fdiagnostics-show-option -fno-common -fstack-protector -fstack-protector-strong -fstrict-flex-arrays --param=ssp-buffer-size=4 -Wno-maybe-uninitialized -Wno-unused-result -ftrivial-auto-var-init=zero -Werror=shadow -O2 -march=mips2 -mabi=32 -mplt -msoft-float -pipe -fno-strict-aliasing -fstrict-flex-arrays=1 -fvisibility=hidden -ffunction-sections -fdata-sections -include config.h -MD -MQ systemd-storagetm.p/src_storagetm_storagetm.c.o -MF systemd-storagetm.p/src_storagetm_storagetm.c.o.d -o systemd-storagetm.p/src_storagetm_storagetm.c.o -c ../systemd-stable-255.1/src/storagetm/storagetm.c
../systemd-stable-255.1/src/storagetm/storagetm.c: In function ‘device_added’:
../systemd-stable-255.1/src/storagetm/storagetm.c:953:42: error: passing argument 2 of ‘sd_device_get_devnum’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  953 |         r = sd_device_get_devnum(device, &lookup_key.st_rdev);
      |                                          ^~~~~~~~~~~~~~~~~~~
      |                                          |
      |                                          long unsigned int *
In file included from ../systemd-stable-255.1/src/shared/blockdev-util.h:6,
                 from ../systemd-stable-255.1/src/storagetm/storagetm.c:8:
../systemd-stable-255.1/src/systemd/sd-device.h:78:52: note: expected ‘dev_t *’ {aka ‘long long unsigned int *’} but argument is of type ‘long unsigned int *’
   78 | int sd_device_get_devnum(sd_device *device, dev_t *devnum);
      |                                             ~~~~~~~^~~~~~
../systemd-stable-255.1/src/storagetm/storagetm.c: In function ‘device_removed’:
../systemd-stable-255.1/src/storagetm/storagetm.c:1009:42: error: passing argument 2 of ‘sd_device_get_devnum’ from incompatible pointer type [-Werror=incompatible-pointer-types]
 1009 |         r = sd_device_get_devnum(device, &lookup_key.st_rdev);
      |                                          ^~~~~~~~~~~~~~~~~~~
      |                                          |
      |                                          long unsigned int *
../systemd-stable-255.1/src/systemd/sd-device.h:78:52: note: expected ‘dev_t *’ {aka ‘long long unsigned int *’} but argument is of type ‘long unsigned int *’
   78 | int sd_device_get_devnum(sd_device *device, dev_t *devnum);
      |                                             ~~~~~~~^~~~~~
cc1: some warnings being treated as errors
Comment 1 Andreas K. Hüttel archtester gentoo-dev 2023-12-23 16:58:35 UTC
Created attachment 880259 [details]
build log
Comment 2 Andreas K. Hüttel archtester gentoo-dev 2023-12-23 18:02:31 UTC
No relevant changes in master as far as I can see, no issue upstream
Comment 3 Andreas K. Hüttel archtester gentoo-dev 2023-12-23 18:04:35 UTC
Correction: seems to affect only O32
Comment 4 Larry the Git Cow gentoo-dev 2023-12-24 22:34:39 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f68fcb408601d8c7b3aaba65fc588034ca50094a

commit f68fcb408601d8c7b3aaba65fc588034ca50094a
Author:     Andreas K. Hüttel <dilfridge@gentoo.org>
AuthorDate: 2023-12-24 22:33:26 +0000
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: 2023-12-24 22:34:28 +0000

    package.mask, mips o32: mask systemd-255*
    
    Bug: https://bugs.gentoo.org/920576
    Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>

 profiles/arch/mips/mipsel/o32/package.mask | 5 +++++
 profiles/arch/mips/o32/package.mask        | 5 +++++
 2 files changed, 10 insertions(+)
Comment 5 Andreas K. Hüttel archtester gentoo-dev 2023-12-28 16:43:33 UTC
Upstream would like a patch...
Comment 6 Fabian Groffen gentoo-dev 2023-12-29 10:02:17 UTC
But how is st_rdev defined on this system?  Adding a cast is trivial, but in this case it looks like either the member isn't defined as dev_t (as it should), or it uses a different definition than the systemd code uses.

On glibc it seems to be defined in /usr/include/bits/struct_stat.h.  There's an indirection of __dev_t to DEV_T to __UQUAD_TYPE.  musl defines it in /usr/include/bits/stat.h as dev_t and typedefs that to an unsigned _Int64.
Comment 7 Mike Gilbert gentoo-dev 2023-12-29 18:36:05 UTC
(In reply to Fabian Groffen from comment #6)

From the error message, it appears st_rdev is unsigned long, but dev_t is unsigned long long.
Comment 8 Fabian Groffen gentoo-dev 2023-12-29 18:41:34 UTC
... which is exactly why the struct stat definition would be interesting ...
Comment 9 Mike Gilbert gentoo-dev 2023-12-29 18:43:02 UTC
From glibc's struct_stat.h:

> #if _MIPS_SIM == _ABIO32
> ...
> struct stat
> ...
>     unsigned long int st_rdev;  /* Device number, if device.  */
> ...
Comment 10 Mike Gilbert gentoo-dev 2023-12-29 20:34:36 UTC
It's worth noting that musl uses separate types for userspace (struct stat) versus kernel calls (struct kstat). A translation is done in the fstatat_kstat function.
Comment 11 Mike Gilbert gentoo-dev 2024-06-29 18:19:01 UTC
Should be fixed upstream.