<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>7473</bug_id>
          
          <creation_ts>2015-03-18 06:04:23 +0000</creation_ts>
          <short_desc>systemd: fails to compile with GCC 4.8</short_desc>
          <delta_ts>2015-08-28 11:55:20 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>1.8</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.9</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jonathan Liu">net147</reporter>
          <assigned_to name="Khem Raj">raj.khem</assigned_to>
          <cc>bogdanx.a.voiculescu</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>raj.khem</cc>
          
          <qa_contact name="Bogdan Alexandru Voiculescu">bogdanx.a.voiculescu</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>Regression (Used to work)</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>49510</commentid>
    <comment_count>0</comment_count>
    <who name="Jonathan Liu">net147</who>
    <bug_when>2015-03-18 06:04:23 +0000</bug_when>
    <thetext>Using poky master df0672b038e6942c97d266af9ca175a06f2b0423 with the following added to local.conf:
DISTRO_FEATURES_append = &quot; systemd&quot;
DISTRO_FEATURES_BACKFILL_CONSIDERED += &quot;sysvinit&quot;
VIRTUAL-RUNTIME_init_manager = &quot;systemd&quot;
PACKAGE_CLASSES = &quot;package_ipk&quot;
GCCVERSION = &quot;4.8%&quot;

Run the following to build systemd:
bitbake systemd

Build Configuration:
BB_VERSION        = &quot;1.25.0&quot;
BUILD_SYS         = &quot;x86_64-linux&quot;
NATIVELSBSTRING   = &quot;Arch-rolling&quot;
TARGET_SYS        = &quot;i586-poky-linux&quot;
MACHINE           = &quot;qemux86&quot;
DISTRO            = &quot;poky&quot;
DISTRO_VERSION    = &quot;1.7+snapshot-20150318&quot;
TUNE_FEATURES     = &quot;m32 i586&quot;
TARGET_FPU        = &quot;&quot;
meta              
meta-yocto        
meta-yocto-bsp    = &quot;master:df0672b038e6942c97d266af9ca175a06f2b0423&quot;

./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 &apos;bus_poll&apos;:
/home/net147/git/poky/build/tmp/sysroots/qemux86/usr/include/bits/poll2.h:71:2: warning: call to &apos;__ppoll_chk_warn&apos; 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 &apos;image_clone&apos;:
/home/net147/git/poky/build/tmp/work/i586-poky-linux/systemd/1_219+gitAUTOINC+a88abde721-r0/git/src/shared/util.h:673:13: warning: &apos;t&apos; 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: &apos;t&apos; 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: &apos;crtime&apos; 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: &apos;crtime&apos; 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 &apos;bus_poll&apos;:
/home/net147/git/poky/build/tmp/sysroots/qemux86/usr/include/bits/poll2.h:71:2: warning: call to &apos;__ppoll_chk_warn&apos; 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&apos;:
/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&apos;
/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&apos;
/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&apos;
collect2: error: ld returned 1 exit status
Makefile:9895: recipe for target &apos;libnss_mymachines.la&apos; failed</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49511</commentid>
    <comment_count>1</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2015-03-18 06:09:09 +0000</bug_when>
    <thetext>Can you try passing -fno-lto in CFLAGS and see if that helps ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49512</commentid>
    <comment_count>2</comment_count>
    <who name="Jonathan Liu">net147</who>
    <bug_when>2015-03-18 06:14:38 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; 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 = &quot; --with-rootprefix=${rootprefix} \
 EXTRA_OECONF_append_libc-uclibc = &quot; --disable-myhostname &quot;
 
 do_configure_prepend() {
+       export CFLAGS=&quot;-fno-lto&quot;
        export CPP=&quot;${HOST_PREFIX}cpp ${TOOLCHAIN_OPTIONS} ${HOST_CC_ARCH}&quot;
        export NM=&quot;${HOST_PREFIX}gcc-nm&quot;
        export AR=&quot;${HOST_PREFIX}gcc-ar&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49513</commentid>
    <comment_count>3</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2015-03-18 06:18:55 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; (In reply to comment #1)
&gt; &gt; Can you try passing -fno-lto in CFLAGS and see if that helps ?
&gt; 
&gt; It compiles successfully with the following change:
&gt; --- a/meta/recipes-core/systemd/systemd_219.bb
&gt; +++ b/meta/recipes-core/systemd/systemd_219.bb
&gt; @@ -111,6 +111,7 @@ EXTRA_OECONF = &quot; --with-rootprefix=${rootprefix} \
&gt;  EXTRA_OECONF_append_libc-uclibc = &quot; --disable-myhostname &quot;
&gt;  
&gt;  do_configure_prepend() {
&gt; +       export CFLAGS=&quot;-fno-lto&quot;
&gt;         export CPP=&quot;${HOST_PREFIX}cpp ${TOOLCHAIN_OPTIONS} ${HOST_CC_ARCH}&quot;
&gt;         export NM=&quot;${HOST_PREFIX}gcc-nm&quot;
&gt;         export AR=&quot;${HOST_PREFIX}gcc-ar&quot;

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 &quot;sd-bus.h&quot;
 #include &quot;bus-error.h&quot;
 
+char dummy_bus_error_map[0] __attribute__ ((__section__(&quot;BUS_ERROR_MAP&quot;)));
+
 BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = {
         SD_BUS_ERROR_MAP(&quot;org.freedesktop.DBus.Error.Failed&quot;,                           EACCES),
         SD_BUS_ERROR_MAP(&quot;org.freedesktop.DBus.Error.NoMemory&quot;,                         ENOMEM),</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49514</commentid>
    <comment_count>4</comment_count>
    <who name="Jonathan Liu">net147</who>
    <bug_when>2015-03-18 06:24:59 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; (In reply to comment #1)
&gt; &gt; &gt; Can you try passing -fno-lto in CFLAGS and see if that helps ?
&gt; &gt; 
&gt; &gt; It compiles successfully with the following change:
&gt; &gt; --- a/meta/recipes-core/systemd/systemd_219.bb
&gt; &gt; +++ b/meta/recipes-core/systemd/systemd_219.bb
&gt; &gt; @@ -111,6 +111,7 @@ EXTRA_OECONF = &quot; --with-rootprefix=${rootprefix} \
&gt; &gt;  EXTRA_OECONF_append_libc-uclibc = &quot; --disable-myhostname &quot;
&gt; &gt;  
&gt; &gt;  do_configure_prepend() {
&gt; &gt; +       export CFLAGS=&quot;-fno-lto&quot;
&gt; &gt;         export CPP=&quot;${HOST_PREFIX}cpp ${TOOLCHAIN_OPTIONS} ${HOST_CC_ARCH}&quot;
&gt; &gt;         export NM=&quot;${HOST_PREFIX}gcc-nm&quot;
&gt; &gt;         export AR=&quot;${HOST_PREFIX}gcc-ar&quot;
&gt; 
&gt; OK
&gt; 
&gt; another thing you could try is in systemd itself see if this works
&gt; 
&gt; diff --git a/src/libsystemd/sd-bus/bus-error.c
&gt; b/src/libsystemd/sd-bus/bus-error.c
&gt; index 3bf0c5d..d96259e 100644
&gt; --- a/src/libsystemd/sd-bus/bus-error.c
&gt; +++ b/src/libsystemd/sd-bus/bus-error.c
&gt; @@ -32,6 +32,8 @@
&gt;  #include &quot;sd-bus.h&quot;
&gt;  #include &quot;bus-error.h&quot;
&gt;  
&gt; +char dummy_bus_error_map[0] __attribute__ ((__section__(&quot;BUS_ERROR_MAP&quot;)));
&gt; +
&gt;  BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = {
&gt;          SD_BUS_ERROR_MAP(&quot;org.freedesktop.DBus.Error.Failed&quot;,              
&gt; EACCES),
&gt;          SD_BUS_ERROR_MAP(&quot;org.freedesktop.DBus.Error.NoMemory&quot;,            
&gt; 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__(&quot;BUS_ERROR_MAP&quot;)));
      ^
/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: &apos;bus_standard_errors&apos; was declared here
 BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = {
                                                   ^
Makefile:14974: recipe for target &apos;src/libsystemd/sd-bus/libsystemd_internal_la-bus-error.lo&apos; failed</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49518</commentid>
    <comment_count>5</comment_count>
    <who name="Jonathan Liu">net147</who>
    <bug_when>2015-03-18 08:21:16 +0000</bug_when>
    <thetext>It seems that -Wl,--gc-sections is causing the BUS_ERROR_MAP section to be removed...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50837</commentid>
    <comment_count>6</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2015-05-07 06:56:32 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; It seems that -Wl,--gc-sections is causing the BUS_ERROR_MAP section to be
&gt; 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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50838</commentid>
    <comment_count>7</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2015-05-07 06:59:09 +0000</bug_when>
    <thetext>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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53526</commentid>
    <comment_count>8</comment_count>
    <who name="Bogdan Alexandru Voiculescu">bogdanx.a.voiculescu</who>
    <bug_when>2015-08-28 11:55:20 +0000</bug_when>
    <thetext>wontfix</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>