<div dir="ltr">Hello<div>Im trying to compile systemd in a qemu chroot environment.</div><div>The environment is built with cross compiler and using gcc 11.2.</div><div><br></div><div>meson is succeeded and the options is:</div><div>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<br></div><div><br></div><div>When running ninja it complains about assert.</div><div>Here are some of the failed:</div><div>[13/1524] Compiling C object src/udev/ata_id.p/ata_id_ata_id.c.o<br>FAILED: src/udev/ata_id.p/ata_id_ata_id.c.o <br>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<br>In file included from ../src/basic/macro.h:4,<br> from ../src/basic/fd-util.h:9,<br> from ../src/udev/ata_id/ata_id.c:27:<br>../src/fundamental/macro-fundamental.h:38:9: error: static assertion failed: "STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1"<br> 38 | static_assert(expr, #expr)<br> | ^~~~~~~~~~~~~<br>../src/basic/log.h:65:1: note: in expansion of macro 'assert_cc'<br> 65 | assert_cc(STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1);<br> | ^~~~~~~~~<br></div><div><br></div><div>[14/1524] Compiling C object src/core/libcore.a.p/dbus-device.c.o<br>FAILED: src/core/libcore.a.p/dbus-device.c.o <br>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<br>In file included from ../src/basic/macro.h:4,<br> from ../src/basic/alloc-util.h:9,<br> from ../src/basic/hash-funcs.h:4,<br> from ../src/basic/hashmap.h:8,<br> from ../src/shared/fdset.h:6,<br> from ../src/shared/bpf-program.h:9,<br> from ../src/core/unit.h:10,<br> from ../src/core/device.h:4,<br> from ../src/core/dbus-device.c:4:<br>../src/fundamental/macro-fundamental.h:38:9: error: static assertion failed: "STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1"<br> 38 | static_assert(expr, #expr)<br> | ^~~~~~~~~~~~~<br>../src/basic/log.h:65:1: note: in expansion of macro 'assert_cc'<br> 65 | assert_cc(STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1);<br> | ^~~~~~~~~<br></div><div><br></div><div><span style="font-family:monospace"><span style="color:rgb(0,0,0)">[9/1511] Compiling C object src/libsystemd/libsystemd_static.a.p/sd-bus_bus-creds.c.o
</span><br><span style="color:rgb(178,24,24)">FAILED: </span><span style="color:rgb(0,0,0)">src/libsystemd/libsystemd_static.a.p/sd-bus_bus-creds.c.o </span><br>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<br> -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<br> -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<br>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<br>-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<br>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/<br>libsystemd/libsystemd_static.a.p/sd-bus_bus-creds.c.o -c ../src/libsystemd/sd-bus/bus-creds.c
<br>In file included from <span style="font-weight:bold;color:rgb(0,0,0)">../src/basic/macro.h:11</span><span style="color:rgb(0,0,0)">,
</span><br> from <span style="font-weight:bold;color:rgb(0,0,0)">../src/basic/alloc-util.h:9</span><span style="color:rgb(0,0,0)">,
</span><br> from <span style="font-weight:bold;color:rgb(0,0,0)">../src/libsystemd/sd-bus/bus-creds.c:6</span><span style="color:rgb(0,0,0)">:
</span><br><span style="font-weight:bold;color:rgb(0,0,0)">../src/fundamental/macro-fundamental.h:42:22:</span><span style="color:rgb(0,0,0)"> </span><span style="font-weight:bold;color:rgb(255,84,84)">error: </span><span style="color:rgb(0,0,0)">size of array '</span><span style="font-weight:bold;color:rgb(0,0,0)">x</span><span style="color:rgb(0,0,0)">' is negative
</span><br> 42 | char <span style="font-weight:bold;color:rgb(255,84,84)">x</span><span style="color:rgb(0,0,0)">[(expr) ? 0 : -1]; \
</span><br> | <span style="font-weight:bold;color:rgb(255,84,84)">^</span><span style="color:rgb(0,0,0)">
</span><br><span style="font-weight:bold;color:rgb(0,0,0)">../src/basic/log.h:65:1:</span><span style="color:rgb(0,0,0)"> </span><span style="font-weight:bold;color:rgb(84,255,255)">note: </span><span style="color:rgb(0,0,0)">in expansion of macro '</span><span style="font-weight:bold;color:rgb(0,0,0)">assert_cc</span><span style="color:rgb(0,0,0)">'
</span><br> 65 | <span style="font-weight:bold;color:rgb(84,255,255)">assert_cc</span><span style="color:rgb(0,0,0)">(STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1);
</span><br> | <span style="font-weight:bold;color:rgb(84,255,255)">^~~~~~~~~</span><br><span style="color:rgb(0,0,0)">
</span><br></span></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace">Im not very experienced in cross compiling and got some info from </span><a href="https://www.linuxfromscratch.org/lfs/view/stable-systemd/">https://www.linuxfromscratch.org/lfs/view/stable-systemd/</a> and <a href="https://github.com/LeeKyuHyuk/PiCLFS/">https://github.com/LeeKyuHyuk/PiCLFS/</a></div><div><br></div><div>/Mikael</div><div><br></div></div>