[libvirt] [PATCH] build: fix linking libqemutestdriver with LTO enabled

Jim Fehlig jfehlig at suse.com
Thu May 30 14:44:05 UTC 2019


On 5/30/19 3:08 AM, Michal Privoznik wrote:
> On 5/29/19 7:44 PM, Jim Fehlig wrote:
>> openSUSE Factory is in the process of enabling Link Time Optimization [0]
>> and stumbled upon missing symbols when linking libqemutestdriver
>>
>> libtool: link: gcc -shared  -fPIC -DPIC  ../src/libvirt_qemu_probes.o  \
>> -Wl,--whole-archive ../src/.libs/libvirt_driver_qemu_impl.a \
>> ../src/.libs/libvirt_driver_network_impl.a \
>> ../src/.libs/libvirt_driver_storage_impl.a -Wl,--no-whole-archive  \
>> -lcap-ng -lgnutls -lnl-route-3 -lnl-3 -ldbus-1 -lselinux -lapparmor \
>> /usr/lib/libxml2.so -ldl -lz -llzma -lm -lblkid -ltirpc  \
>> -fstack-protector-strong -O2 -fstack-protector-strong -flto=16 -g -O2 \
>> -fstack-protector-strong -flto=16 -g \
>> -Wl,-soname -Wl,libqemutestdriver.so -o .libs/libqemutestdriver.so
>> ...
>> /usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: 
>> ./.libs/libqemutestdriver.so: undefined reference to `mdir_name'
>> /usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: 
>> ./.libs/libqemutestdriver.so: undefined reference to `rpl_ioctl'
>> /usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: 
>> ./.libs/libqemutestdriver.so: undefined reference to `rpl_pipe2'
>> /usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: 
>> ./.libs/libqemutestdriver.so: undefined reference to `recvfd'
>> /usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: 
>> ./.libs/libqemutestdriver.so: undefined reference to `c_strcasecmp'
>>
>> The missing symbols are provided by GNUlib. Add it when linking
>> libqemutestdriver.
>>
>> [0] https://en.opensuse.org/openSUSE:LTO
>>
>> Signed-off-by: Jim Fehlig <jfehlig at suse.com>
>> ---
>>   tests/Makefile.am | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/Makefile.am b/tests/Makefile.am
>> index 46d94d2236..1d80647c9f 100644
>> --- a/tests/Makefile.am
>> +++ b/tests/Makefile.am
>> @@ -557,7 +557,7 @@ endif WITH_DTRACE_PROBES
>>   libqemutestdriver_la_SOURCES =
>>   libqemutestdriver_la_LDFLAGS = $(DRIVERLIB_LDFLAGS)
>> -libqemutestdriver_la_LIBADD = $(qemu_LDADDS)
>> +libqemutestdriver_la_LIBADD = $(qemu_LDADDS) $(GNULIB_LIBS)
>>   qemucpumock_la_SOURCES = \
>>       qemucpumock.c testutilshostcpus.h
> 
> ACK and safe for freeze to this hunk. Alternatively, we might go with $(LDADDS) 
> which includes $(GNULIB_LIBS).

Do you have a preference? LDADDS includes some other things which AFAIK are not 
needed.

> 
>> @@ -729,7 +729,7 @@ lxcconf2xmltest_SOURCES = \
>>   lxcconf2xmltest_LDADD = $(lxc_LDADDS)
>>   else ! WITH_LXC
>>   EXTRA_DIST += lxcxml2xmltest.c testutilslxc.c testutilslxc.h
>> -endif ! WITH_LXC
>> +-endif ! WITH_LXC
>>   if WITH_OPENVZ
>>   openvzutilstest_SOURCES = \
>>
> 
> Not so for this one ;-)

Not sure how that got in there :-).

Regards,
Jim




More information about the libvir-list mailing list