[systemd-devel] Systemd fails to compile on cross compiled arm enviroment.

Mikael Tomt mikael.tomt at gmail.com
Fri Nov 5 16:42:43 UTC 2021


Hello
Im trying to compile systemd in a qemu chroot environment.
The environment is built with cross compiler and using gcc 11.2.

meson is succeeded and the options is:
cd $BUILD_DIR/$name-$version/build && meson --prefix=/usr --sysconfdir=/etc
--localstatedir=/var --buildtype=release -Dblkid=true -Ddefault-dnssec=no
-Dfirstboot=false -Dinstall-tests=false -Dldconfig=false -Dman=false
-Dsysusers=false -Drpmmacrosdir=no -Db_lto=false -Dhomed=false
-Duserdb=false -Dmode=release -Dpamconfdir=/etc/pam.d -Defi=false
-Dgnu-efi=false -Dtpm=false

When running ninja it complains about assert.
Here are some of the failed:
[13/1524] Compiling C object src/udev/ata_id.p/ata_id_ata_id.c.o
FAILED: src/udev/ata_id.p/ata_id_ata_id.c.o
cc -Isrc/udev/ata_id.p -Isrc/udev -I../src/udev -Isrc/basic -I../src/basic
-Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I.
-I.. -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device
-I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb
-I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal
-I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network
-I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared
-fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch
-Wextra -std=gnu99 -O3 -Wno-format-signedness
-Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-result
-Wdate-time -Wendif-labels -Werror=format=2
-Werror=implicit-function-declaration -Werror=incompatible-pointer-types
-Werror=overflow -Werror=return-type -Werror=shift-count-overflow
-Werror=shift-overflow=2 -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 -Wwrite-strings -Wno-maybe-uninitialized
-Werror=missing-declarations -Werror=missing-prototypes
-fdiagnostics-show-option -ffast-math -fno-common -fno-strict-aliasing
-fstack-protector -fstack-protector-strong -fvisibility=hidden
--param=ssp-buffer-size=4 -ffunction-sections -fdata-sections
-Werror=shadow -include config.h -MD -MQ
src/udev/ata_id.p/ata_id_ata_id.c.o -MF
src/udev/ata_id.p/ata_id_ata_id.c.o.d -o
src/udev/ata_id.p/ata_id_ata_id.c.o -c ../src/udev/ata_id/ata_id.c
In file included from ../src/basic/macro.h:4,
                 from ../src/basic/fd-util.h:9,
                 from ../src/udev/ata_id/ata_id.c:27:
../src/fundamental/macro-fundamental.h:38:9: error: static assertion
failed: "STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1"
   38 |         static_assert(expr, #expr)
      |         ^~~~~~~~~~~~~
../src/basic/log.h:65:1: note: in expansion of macro 'assert_cc'
   65 | assert_cc(STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1);
      | ^~~~~~~~~

[14/1524] Compiling C object src/core/libcore.a.p/dbus-device.c.o
FAILED: src/core/libcore.a.p/dbus-device.c.o
cc -Isrc/core/libcore.a.p -Isrc/core -I../src/core -Isrc/basic
-I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd
-I../src/systemd -I. -I.. -I../src/libsystemd/sd-bus
-I../src/libsystemd/sd-device -I../src/libsystemd/sd-event
-I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128
-I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink
-I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared
-I../src/shared -I/usr/include/libmount -I/usr/include/blkid
-fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch
-Wextra -std=gnu99 -O3 -Wno-format-signedness
-Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-result
-Wdate-time -Wendif-labels -Werror=format=2
-Werror=implicit-function-declaration -Werror=incompatible-pointer-types
-Werror=overflow -Werror=return-type -Werror=shift-count-overflow
-Werror=shift-overflow=2 -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 -Wwrite-strings -Wno-maybe-uninitialized
-Werror=missing-declarations -Werror=missing-prototypes
-fdiagnostics-show-option -ffast-math -fno-common -fno-strict-aliasing
-fstack-protector -fstack-protector-strong -fvisibility=hidden
--param=ssp-buffer-size=4 -ffunction-sections -fdata-sections
-Werror=shadow -include config.h -fPIC -pthread -MD -MQ
src/core/libcore.a.p/dbus-device.c.o -MF
src/core/libcore.a.p/dbus-device.c.o.d -o
src/core/libcore.a.p/dbus-device.c.o -c ../src/core/dbus-device.c
In file included from ../src/basic/macro.h:4,
                 from ../src/basic/alloc-util.h:9,
                 from ../src/basic/hash-funcs.h:4,
                 from ../src/basic/hashmap.h:8,
                 from ../src/shared/fdset.h:6,
                 from ../src/shared/bpf-program.h:9,
                 from ../src/core/unit.h:10,
                 from ../src/core/device.h:4,
                 from ../src/core/dbus-device.c:4:
../src/fundamental/macro-fundamental.h:38:9: error: static assertion
failed: "STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1"
   38 |         static_assert(expr, #expr)
      |         ^~~~~~~~~~~~~
../src/basic/log.h:65:1: note: in expansion of macro 'assert_cc'
   65 | assert_cc(STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1);
      | ^~~~~~~~~

[9/1511] Compiling C object
src/libsystemd/libsystemd_static.a.p/sd-bus_bus-creds.c.o
FAILED: src/libsystemd/libsystemd_static.a.p/sd-bus_bus-creds.c.o
cc -Isrc/libsystemd/libsystemd_static.a.p -Isrc/libsystemd
-I../src/libsystemd -Isrc/basic -I../src/basic -Isrc/fundamental
-I../src/fundamental -Isrc/systemd -I../src/systemd -I. -I..
-I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device
-I../src/libsystemd/sd-event
-I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128
-I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink
-I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve
-fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch
-Wextra -std=gnu99
-O3 -Wno-format-signedness -Wno-missing-field-initializers
-Wno-unused-parameter -Wno-unused-result -Wdate-time -Wendif-labels
-Werror=format=2 -Werror=implicit-function-declaration
-Werror=incompatible-pointer-types -Werror=overflow -Werror=return-type
-Werror=shift-c
ount-overflow -Werror=shift-overflow=2 -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 -Wwrite-strings
-Wno-maybe-uninitialized -Werror=missing-declarations
-Werror=missing-prototypes -fdiagnostics-show-option -ffast-math
-fno-common -fno-strict-aliasing -fstack-protector -fstack-protector-strong
-fvisibility=hidde
n --param=ssp-buffer-size=4 -ffunction-sections -fdata-sections
-Werror=shadow -include config.h -fPIC -pthread -fvisibility=default -MD
-MQ src/libsystemd/libsystemd_static.a.p/sd-bus_bus-creds.c.o -MF
src/libsystemd/libsystemd_static.a.p/sd-bus_bus-creds.c.o.d -o src/
libsystemd/libsystemd_static.a.p/sd-bus_bus-creds.c.o -c
../src/libsystemd/sd-bus/bus-creds.c
In file included from ../src/basic/macro.h:11,
                from ../src/basic/alloc-util.h:9,
                from ../src/libsystemd/sd-bus/bus-creds.c:6:
../src/fundamental/macro-fundamental.h:42:22: error: size of array 'x' is
negative
  42 |                 char x[(expr) ? 0 : -1];
                               \
     |                      ^
../src/basic/log.h:65:1: note: in expansion of macro 'assert_cc'
  65 | assert_cc(STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1);
     | ^~~~~~~~~



Im not very experienced in cross compiling and got some info from
https://www.linuxfromscratch.org/lfs/view/stable-systemd/ and
https://github.com/LeeKyuHyuk/PiCLFS/

/Mikael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20211105/5c2ef4ae/attachment.htm>


More information about the systemd-devel mailing list