[systemd-devel] Compilation with gcc-4.9 fails
poma
pomidorabelisima at gmail.com
Fri Apr 18 18:16:13 PDT 2014
On 03.03.2014 07:51, Jan Engelhardt wrote:
>
> Just informing you…
>
> When building with GCC 4.9.0 [svn r208221], then the following happens:
>
> $ make
> [...]
> make --no-print-directory all-recursive
> Making all in .
> CC src/libsystemd/sd-bus/libsystemd_la-sd-bus.lo
> CC src/libsystemd/sd-bus/libsystemd_la-bus-control.lo
> CC src/libsystemd/sd-bus/libsystemd_la-bus-error.lo
> [...]
>
> $ nm src/libsystemd/sd-bus/.libs/libsystemd_la-sd-bus.o
> 0000000000000001 C __gnu_lto_slim
> 0000000000000001 C __gnu_lto_v1
>
> systemd enables -flto by default, but the actual symbols are no
> longer generated with gcc-4.9. They were in gcc-4.8, but perhaps LTO
> was not effective in that version.
>
> As a result, the "-export-symbols-regex" option passed to libtool
> (see Makefile.am for it) yields no results as it relies on nm output.
> Therefore, file .libs/libgudev-1.0.ver that is generated by
> "-export-symbols-regex" is empty and causes further linker errors
> down the road.
>
> $ make
> CCLD libgudev-1.0.la
> /usr/bin/ld.gold: error: .libs/libgudev-1.0.ver:2:1: syntax error, unexpected LOCAL, expecting STRING or QUOTED_STRING or EXTERN
> /usr/bin/ld.gold: fatal error: unable to parse version script file .libs/libgudev-1.0.ver
> collect2: error: ld returned 1 exit status
>
> (Problem 2 (which has been reported): libtool should have warned about
> an empty .ver, but it does not, leading to an undescriptive error.)
>
> Further down one may spot, but that is just a result of the previous ones.
>
> CCLD systemd-cgls
> src/cgls/cgls.c:131: error: undefined reference to 'log_parse_environment'
> src/cgls/cgls.c:132: error: undefined reference to 'log_open'
> src/cgls/cgls.c:214: error: undefined reference to 'pager_close'
Jan, thanks for the tip!
Apropos Link Time Optimization,
gcc (GCC) 4.9.0 20140411 (Red Hat 4.9.0-0.10),
Rawhide
systemd build(gitcommit a606871) vulgaris is OK,
configure.ac:
AS_CASE([$CFLAGS], [*-O[[12345\ ]]*],
[CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-flto])],
...
$ ./autogen.sh
$ ./configure CFLAGS='-g -O0 -ftrapv' --enable-compat-libs
--enable-kdbus --sysconfdir=/etc --localstatedir=/var
--libdir=/usr/lib64 --enable-gtk-doc
...
skipping -flto, optimization not enabled
...
However to build RPM packages i.e. 'rpmbuild',
it is necessary one of the following:
1. Replace "-flto" with "-fno-lto" i.e.
configure.ac:
AS_CASE([$CFLAGS], [*-O[[12345\ ]]*],
[CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-fno-lto])],
...
or
2. Append x2 'CFLAGS="${CFLAGS} -fno-lto"' to the 'systemd.spec'
'make' line i.e.
make ... CFLAGS="${CFLAGS} -fno-lto"
Otherwise the build process would stuck with the following error,
...
make --no-print-directory all-recursive
Making all in .
CCLD libgudev-1.0.la
/usr/bin/ld.gold: error: .libs/libgudev-1.0.ver:2:1: syntax error,
unexpected LOCAL, expecting STRING or QUOTED_STRING or EXTERN
/usr/bin/ld.gold: fatal error: unable to parse version script file
.libs/libgudev-1.0.ver
collect2: error: ld returned 1 exit status
make[2]: *** [libgudev-1.0.la] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
cat .libs/libgudev-1.0.ver
{ global:
local: *; };
~~~~~~~~~~~~
Unlike the expected(1. & 2.),
$ cat .libs/libgudev-1.0.ver
{ global:
g_udev_client_get_type;
g_udev_client_new;
g_udev_client_query_by_device_file;
g_udev_client_query_by_device_number;
g_udev_client_query_by_subsystem;
g_udev_client_query_by_subsystem_and_name;
g_udev_client_query_by_sysfs_path;
g_udev_device_get_action;
g_udev_device_get_device_file;
g_udev_device_get_device_file_symlinks;
g_udev_device_get_device_number;
g_udev_device_get_device_type;
g_udev_device_get_devtype;
g_udev_device_get_driver;
g_udev_device_get_is_initialized;
g_udev_device_get_name;
g_udev_device_get_number;
g_udev_device_get_parent;
g_udev_device_get_parent_with_subsystem;
g_udev_device_get_property;
g_udev_device_get_property_as_boolean;
g_udev_device_get_property_as_double;
g_udev_device_get_property_as_int;
g_udev_device_get_property_as_strv;
g_udev_device_get_property_as_uint64;
g_udev_device_get_property_keys;
g_udev_device_get_seqnum;
g_udev_device_get_subsystem;
g_udev_device_get_sysfs_attr;
g_udev_device_get_sysfs_attr_as_boolean;
g_udev_device_get_sysfs_attr_as_double;
g_udev_device_get_sysfs_attr_as_int;
g_udev_device_get_sysfs_attr_as_strv;
g_udev_device_get_sysfs_attr_as_uint64;
g_udev_device_get_sysfs_attr_keys;
g_udev_device_get_sysfs_path;
g_udev_device_get_tags;
g_udev_device_get_type;
g_udev_device_get_usec_since_initialized;
g_udev_device_has_property;
g_udev_device_has_sysfs_attr;
g_udev_device_type_get_type;
g_udev_enumerator_add_match_is_initialized;
g_udev_enumerator_add_match_name;
g_udev_enumerator_add_match_property;
g_udev_enumerator_add_match_subsystem;
g_udev_enumerator_add_match_sysfs_attr;
g_udev_enumerator_add_match_tag;
g_udev_enumerator_add_nomatch_subsystem;
g_udev_enumerator_add_nomatch_sysfs_attr;
g_udev_enumerator_add_sysfs_path;
g_udev_enumerator_execute;
g_udev_enumerator_get_type;
g_udev_enumerator_new;
g_udev_marshal_VOID__STRING_OBJECT;
local: *; };
http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
These brief instructions are intended especially for the Rawhide
enthusiasts.
We always gotta have the latest and greatest! :)
My build:
systemd-212-45.fc21.x86_64 19-Apr-2014
Rawhide build:
systemd-212-1.fc21.x86_64 25-Mar-2014
poma
More information about the systemd-devel
mailing list