Created attachment 5540 [details] build log I'm trying to build Systemd for a Raspberry Pi. Attaching the build log. Please let me know if you need more infos about my buildroot config.
Tried a recent git snapshot too (2b49732c3d511007ae2c413997e56c40f678d79a) and had the same error.
Created attachment 5546 [details] buildroot config
Testing using the defconfig: Setting glibc and systemd and then -O{1,2,3} (not -O{s,1}), I get build errors very similar (probably the same but jumbled due to multithreading).
Testing using the defconfig: Setting glibc and systemd and then -O{1,2,3} (not -O{s,1}), I get build errors very similar (probably the same but jumbled due to multithreading).(In reply to comment #3) > Testing using the defconfig: Setting glibc and systemd and then -O{1,2,3} (not > -O{s,1}), I get build errors very similar (probably the same but jumbled due to > multithreading). that should be "not -O{s,0}"
The build fails because systemd is configured with the --enable-compat-libs option. This option has been added because since systemd 209, some libraries have been merged into libsystemd.so: - libsystemd-daemon.so - libsystemd-id128.so - libsystemd-journal.so - libsystemd-login.so When this option is enabled, the deprecated libraries will be built, so external programs, which depend on them and have not yet migrated to libsystemd, can still compile. But these libs will refer to the parts used to build libsystemd. For example, if we look at libsystemd-journal.so, we can see that is built from libsystemd-journal.c. This file is generated from: - src/compat-libs/linkwarning.h - src/compat-libs/libsystemd-journal.sym Via some macros in linkwarning.h the symbols will be compiled as an unallocated section and linking to them will cause a warning to be printed. From the build log, we can see that GCC complains the symbol is being defined twice: {{ /tmp/ccEK7EwW.ltrans13.ltrans.o: In function `sd_journal_reliable_fd': ccEK7EwW.ltrans13.o:(.text+0x784): multiple definition of `sd_journal_reliable_fd' libsystemd_journal_internal_la-sd-journal.o (symbol from plugin):(.text+0x0): first defined here }} In the attached Buildroot config file, we have "BR2_OPTIMIZE_2=y", which adds "-Wp,-D_FORTIFY_SOURCE=2" to CPPFLAGS and "-flto -ffat-lto-objects" to CFLAGS. I tried the attached configuration with ccache disabled and "BR2_OPTIMIZE_S=y", which cause the aforementioned options to be dropped, and the build is successful. In the configure script, there is a check for these options, but it seems to only print a warning message...
So what would be the approach to fix this issue then? Ensuring the CPPFLAGS and CFLAGS don't contain these options when building systemd?
Created attachment 5552 [details] Workaround by disabling link time optimization Here is a workaround which disable link time optimization for systemd.
Eric, is this the fix we should apply for 2014.08 or should something else be done? In the first case, could you send the patch to the list? In the second case, could you give more details about what you think should be done? Thanks, Thomas
The bug was reported upstream (https://bugs.freedesktop.org/show_bug.cgi?id=78923) but has been marked as rejected, as it is likely to be a compiler/linker issue (though the last comment says the issue is not raised when using GCC 4.8.3, which is the version precisely used in our case!). Comments in another bug report (https://bugzilla.redhat.com/show_bug.cgi?id=1067245#c13) suggest testing with GCC 4.9. Anyway, the patch is now in patchwork: http://patchwork.ozlabs.org/patch/379472/. I suggest applying it.
Fixed by http://git.buildroot.net/buildroot/commit/?id=d9054017cfc25c8f89225e1d18c71f112d25f9a0. Closing bug. Thanks!