Using poky master df0672b038e6942c97d266af9ca175a06f2b0423 with the following added to local.conf: DISTRO_FEATURES_append = " systemd" DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit" VIRTUAL-RUNTIME_init_manager = "systemd" PACKAGE_CLASSES = "package_ipk" GCCVERSION = "4.8%" Run the following to build systemd: bitbake systemd Build Configuration: BB_VERSION = "1.25.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "Arch-rolling" TARGET_SYS = "i586-poky-linux" MACHINE = "qemux86" DISTRO = "poky" DISTRO_VERSION = "1.7+snapshot-20150318" TUNE_FEATURES = "m32 i586" TARGET_FPU = "" meta meta-yocto meta-yocto-bsp = "master:df0672b038e6942c97d266af9ca175a06f2b0423" ./i586-poky-linux-libtool --tag=CC --mode=link i586-poky-linux-gcc -m32 -march=i586 --sysroot=/home/net147/git/poky/build/tmp/sysroots/qemux86 -std=gnu99 -pipe -Wall -Wextra -Wno-inline -Wundef -Wformat=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wsign-compare -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-long-long -Wno-overlength-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -ffunction-sections -fdata-sections -fstack-protector -fPIE --param=ssp-buffer-size=4 -flto -ffat-lto-objects -O2 -pipe -g -feliminate-unused-debug-types -Wl,--as-needed -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,relro -Wl,-z,now -pie -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o bootctl src/boot/bootctl.o src/boot/boot-loader.o src/boot/boot-efi.o libsystemd-shared.la libsystemd-internal.la -ldl i586-poky-linux-libtool: link: i586-poky-linux-gcc -m32 -march=i586 --sysroot=/home/net147/git/poky/build/tmp/sysroots/qemux86 -std=gnu99 -pipe -Wall -Wextra -Wno-inline -Wundef -Wformat=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wsign-compare -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-long-long -Wno-overlength-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -ffunction-sections -fdata-sections -fstack-protector -fPIE --param=ssp-buffer-size=4 -flto -ffat-lto-objects -O2 -pipe -g -feliminate-unused-debug-types -Wl,--as-needed -Wl,--no-undefined -Wl,--gc-sections -Wl,-z -Wl,relro -Wl,-z -Wl,now -pie -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o bootctl src/boot/bootctl.o src/boot/boot-loader.o src/boot/boot-efi.o ./.libs/libsystemd-shared.a -lcap -lm ./.libs/libsystemd-internal.a -lrt -ldl -pthread libsystemd_internal_la-bus-message.o (symbol from plugin): warning: memset used with constant zero length parameter; this could be due to transposed parameters /home/net147/git/poky/build/tmp/sysroots/qemux86/usr/include/bits/poll2.h: In function 'bus_poll': /home/net147/git/poky/build/tmp/sysroots/qemux86/usr/include/bits/poll2.h:71:2: warning: call to '__ppoll_chk_warn' declared with attribute warning: ppoll called with fds buffer too small file nfds entries [enabled by default] return __ppoll_chk (__fds, __nfds, __timeout, __ss, __bos (__fds)); ^ /home/net147/git/poky/build/tmp/work/i586-poky-linux/systemd/1_219+gitAUTOINC+a88abde721-r0/git/src/shared/machine-image.c: In function 'image_clone': /home/net147/git/poky/build/tmp/work/i586-poky-linux/systemd/1_219+gitAUTOINC+a88abde721-r0/git/src/shared/util.h:673:13: warning: 't' may be used uninitialized in this function [-Wmaybe-uninitialized] free(*(void**) p); ^ /home/net147/git/poky/build/tmp/work/i586-poky-linux/systemd/1_219+gitAUTOINC+a88abde721-r0/git/src/shared/copy.c:393:30: note: 't' was declared here _cleanup_free_ char *t; ^ /home/net147/git/poky/build/tmp/work/i586-poky-linux/systemd/1_219+gitAUTOINC+a88abde721-r0/git/src/shared/util.c:7746:12: warning: 'crtime' may be used uninitialized in this function [-Wmaybe-uninitialized] le = htole64((uint64_t) usec); ^ /home/net147/git/poky/build/tmp/work/i586-poky-linux/systemd/1_219+gitAUTOINC+a88abde721-r0/git/src/shared/copy.c:418:16: note: 'crtime' was declared here usec_t crtime; ^ ./i586-poky-linux-libtool --tag=CC --mode=link i586-poky-linux-gcc -m32 -march=i586 --sysroot=/home/net147/git/poky/build/tmp/sysroots/qemux86 -std=gnu99 -pipe -Wall -Wextra -Wno-inline -Wundef -Wformat=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wsign-compare -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-long-long -Wno-overlength-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -ffunction-sections -fdata-sections -fstack-protector -fPIE --param=ssp-buffer-size=4 -flto -ffat-lto-objects -O2 -pipe -g -feliminate-unused-debug-types -Wl,--as-needed -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,relro -Wl,-z,now -pie -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o hostnamectl src/hostname/hostnamectl.o libsystemd-internal.la libsystemd-shared.la -ldl i586-poky-linux-libtool: link: i586-poky-linux-gcc -m32 -march=i586 --sysroot=/home/net147/git/poky/build/tmp/sysroots/qemux86 -std=gnu99 -pipe -Wall -Wextra -Wno-inline -Wundef -Wformat=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wsign-compare -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-long-long -Wno-overlength-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -ffunction-sections -fdata-sections -fstack-protector -fPIE --param=ssp-buffer-size=4 -flto -ffat-lto-objects -O2 -pipe -g -feliminate-unused-debug-types -Wl,--as-needed -Wl,--no-undefined -Wl,--gc-sections -Wl,-z -Wl,relro -Wl,-z -Wl,now -pie -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o hostnamectl src/hostname/hostnamectl.o ./.libs/libsystemd-internal.a -lrt ./.libs/libsystemd-shared.a -lcap -lm -ldl -pthread libsystemd_shared_la-hashmap.o (symbol from plugin): warning: memset used with constant zero length parameter; this could be due to transposed parameters /home/net147/git/poky/build/tmp/sysroots/qemux86/usr/include/bits/poll2.h: In function 'bus_poll': /home/net147/git/poky/build/tmp/sysroots/qemux86/usr/include/bits/poll2.h:71:2: warning: call to '__ppoll_chk_warn' declared with attribute warning: ppoll called with fds buffer too small file nfds entries [enabled by default] return __ppoll_chk (__fds, __nfds, __timeout, __ss, __bos (__fds)); ^ /tmp/cc4cB1Qi.ltrans26.ltrans.o: In function `bus_error_name_to_errno.16899': /home/net147/git/poky/build/tmp/work/i586-poky-linux/systemd/1_219+gitAUTOINC+a88abde721-r0/git/src/libsystemd/sd-bus/bus-error.c:112: undefined reference to `__start_BUS_ERROR_MAP' /home/net147/git/poky/build/tmp/work/i586-poky-linux/systemd/1_219+gitAUTOINC+a88abde721-r0/git/src/libsystemd/sd-bus/bus-error.c:112: undefined reference to `__stop_BUS_ERROR_MAP' /home/net147/git/poky/build/tmp/work/i586-poky-linux/systemd/1_219+gitAUTOINC+a88abde721-r0/git/src/libsystemd/sd-bus/bus-error.c:112: undefined reference to `__stop_BUS_ERROR_MAP' collect2: error: ld returned 1 exit status Makefile:9895: recipe for target 'libnss_mymachines.la' failed
Can you try passing -fno-lto in CFLAGS and see if that helps ?
(In reply to comment #1) > Can you try passing -fno-lto in CFLAGS and see if that helps ? It compiles successfully with the following change: --- a/meta/recipes-core/systemd/systemd_219.bb +++ b/meta/recipes-core/systemd/systemd_219.bb @@ -111,6 +111,7 @@ EXTRA_OECONF = " --with-rootprefix=${rootprefix} \ EXTRA_OECONF_append_libc-uclibc = " --disable-myhostname " do_configure_prepend() { + export CFLAGS="-fno-lto" export CPP="${HOST_PREFIX}cpp ${TOOLCHAIN_OPTIONS} ${HOST_CC_ARCH}" export NM="${HOST_PREFIX}gcc-nm" export AR="${HOST_PREFIX}gcc-ar"
(In reply to comment #2) > (In reply to comment #1) > > Can you try passing -fno-lto in CFLAGS and see if that helps ? > > It compiles successfully with the following change: > --- a/meta/recipes-core/systemd/systemd_219.bb > +++ b/meta/recipes-core/systemd/systemd_219.bb > @@ -111,6 +111,7 @@ EXTRA_OECONF = " --with-rootprefix=${rootprefix} \ > EXTRA_OECONF_append_libc-uclibc = " --disable-myhostname " > > do_configure_prepend() { > + export CFLAGS="-fno-lto" > export CPP="${HOST_PREFIX}cpp ${TOOLCHAIN_OPTIONS} ${HOST_CC_ARCH}" > export NM="${HOST_PREFIX}gcc-nm" > export AR="${HOST_PREFIX}gcc-ar" OK another thing you could try is in systemd itself see if this works diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c index 3bf0c5d..d96259e 100644 --- a/src/libsystemd/sd-bus/bus-error.c +++ b/src/libsystemd/sd-bus/bus-error.c @@ -32,6 +32,8 @@ #include "sd-bus.h" #include "bus-error.h" +char dummy_bus_error_map[0] __attribute__ ((__section__("BUS_ERROR_MAP"))); + BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = { SD_BUS_ERROR_MAP("org.freedesktop.DBus.Error.Failed", EACCES), SD_BUS_ERROR_MAP("org.freedesktop.DBus.Error.NoMemory", ENOMEM),
(In reply to comment #3) > (In reply to comment #2) > > (In reply to comment #1) > > > Can you try passing -fno-lto in CFLAGS and see if that helps ? > > > > It compiles successfully with the following change: > > --- a/meta/recipes-core/systemd/systemd_219.bb > > +++ b/meta/recipes-core/systemd/systemd_219.bb > > @@ -111,6 +111,7 @@ EXTRA_OECONF = " --with-rootprefix=${rootprefix} \ > > EXTRA_OECONF_append_libc-uclibc = " --disable-myhostname " > > > > do_configure_prepend() { > > + export CFLAGS="-fno-lto" > > export CPP="${HOST_PREFIX}cpp ${TOOLCHAIN_OPTIONS} ${HOST_CC_ARCH}" > > export NM="${HOST_PREFIX}gcc-nm" > > export AR="${HOST_PREFIX}gcc-ar" > > OK > > another thing you could try is in systemd itself see if this works > > diff --git a/src/libsystemd/sd-bus/bus-error.c > b/src/libsystemd/sd-bus/bus-error.c > index 3bf0c5d..d96259e 100644 > --- a/src/libsystemd/sd-bus/bus-error.c > +++ b/src/libsystemd/sd-bus/bus-error.c > @@ -32,6 +32,8 @@ > #include "sd-bus.h" > #include "bus-error.h" > > +char dummy_bus_error_map[0] __attribute__ ((__section__("BUS_ERROR_MAP"))); > + > BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = { > SD_BUS_ERROR_MAP("org.freedesktop.DBus.Error.Failed", > EACCES), > SD_BUS_ERROR_MAP("org.freedesktop.DBus.Error.NoMemory", > ENOMEM), Removing -fno-lto from CFLAGS and applying the above patch gives the following compile error: /home/net147/git/poky/build/tmp/work/i586-poky-linux/systemd/1_219+gitAUTOINC+a88abde721-r0/git/src/libsystemd/sd-bus/bus-error.c:35:6: error: dummy_bus_error_map causes a section type conflict with bus_standard_errors char dummy_bus_error_map[0] __attribute__ ((__section__("BUS_ERROR_MAP"))); ^ /home/net147/git/poky/build/tmp/work/i586-poky-linux/systemd/1_219+gitAUTOINC+a88abde721-r0/git/src/libsystemd/sd-bus/bus-error.c:37:51: note: 'bus_standard_errors' was declared here BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = { ^ Makefile:14974: recipe for target 'src/libsystemd/sd-bus/libsystemd_internal_la-bus-error.lo' failed
It seems that -Wl,--gc-sections is causing the BUS_ERROR_MAP section to be removed...
(In reply to comment #5) > It seems that -Wl,--gc-sections is causing the BUS_ERROR_MAP section to be > removed... since gcc 4.8 will be removed from 1.9 as soon as 5.0 comes in. I would like to leave this as wont fix. and for folks who use gcc 4.8, the fix is already mentioned to disable LTO
gcc 4.9 is default on 1.8, and if users are defaulting to gcc 4.8 then they have a fix here to disable LTO, but I would not like to degrade systemd build by disabling LTO system-wide when it works ok with gcc 4.9
wontfix