Sorry about uploading a large attachment.
And the build log link is:
https://app.box.com/s/gbjihylb3gvvh89xbn5m
----- Original Message -----
From: "Jincheng Miao" <jmiao(a)redhat.com>
To: "Eric Blake" <eblake(a)redhat.com>
Cc: libvir-list(a)redhat.com
Sent: Thursday, August 1, 2013 4:03:29 PM
Subject: Re: [libvirt] [PATCH] Fix test case qemuagenttest compilation.
hi Eric,
Bad luck, I test qemuagenttest build in rhel7.0, no error like this. Maybe it is a good
new to libvirt.
And the gcc version is:
# rpm -q gcc libtool
gcc-4.8.0-2.el7.x86_64
libtool-2.4.2-14.el7.x86_64
And its compile cmdline likes:
gcc -std=gnu99 -Dabs_builddir=\"/root/software/libvirt/tests\"
-I/usr/include/libxml2 -I/usr/include/p11-kit-1 -DGCRYPT_NO_DEPRECATED -W -Waddress
-Waggressive-loop-optimizations -Wall -Warray-bounds -Wattributes -Wbad-function-cast
-Wbuiltin-macro-redefined -Wcast-align -Wchar-subscripts -Wclobbered -Wcomment -Wcomments
-Wcoverage-mismatch -Wcpp -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero
-Wdouble-promotion -Wempty-body -Wendif-labels -Wextra -Wformat-contains-nul
-Wformat-extra-args -Wformat-security -Wformat-y2k -Wformat-zero-length
-Wfree-nonheap-object -Wignored-qualifiers -Wimplicit -Wimplicit-function-declaration
-Wimplicit-int -Winit-self -Winline -Wint-to-pointer-cast -Winvalid-memory-model
-Winvalid-pch -Wjump-misses-init -Wlogical-op -Wmain -Wmaybe-uninitialized
-Wmissing-braces -Wmissing-declarations -Wmissing-field-initializers
-Wmissing-include-dirs -Wmissing-parameter-type -Wmissing-prototypes -Wmudflap -Wmultichar
-Wnarrowing -Wnested-externs -Wnonnull -Wnormalized=nfc -Wold-style-declaration
-Wold-style-definition -Woverflow -Woverride-init -Wpacked-bitfield-compat -Wparentheses
-Wpointer-arith -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wreturn-local-addr
-Wreturn-type -Wsequence-point -Wshadow -Wsizeof-pointer-memaccess -Wstrict-aliasing
-Wstrict-prototypes -Wsuggest-attribute=const -Wsuggest-attribute=format
-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wswitch -Wsync-nand -Wtrampolines
-Wtrigraphs -Wtype-limits -Wuninitialized -Wunknown-pragmas -Wunused
-Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-function -Wunused-label
-Wunused-local-typedefs -Wunused-parameter -Wunused-result -Wunused-value
-Wunused-variable -Wvarargs -Wvariadic-macros -Wvector-operation-performance
-Wvolatile-register-var -Wwrite-strings -Wno-sign-compare -Wjump-misses-init
-Wno-format-nonliteral -Wframe-larger-than=4096 -fstack-protector-all
--param=ssp-buffer-size=4 -Wno-unused-command-line-argument -fexceptions
-fasynchronous-unwind-tables -fdiagnostics-show-option -funit-at-a-time -fipa-pure-const
-Wno-suggest-attribute=pure -Wno-suggest-attribute=const -Werror -g2 -O0 -o
.libs/qemuagenttest qemuagenttest.o testutils.o testutilsqemu.o
../src/libvirt_qemu_probes.o ../src/libvirt_probes.o -g2 -O0
../src/.libs/libvirt_driver_qemu_impl.a ../src/.libs/libvirt_driver_network_impl.a
../src/.libs/libvirt.so -L/lib64 -lcap-ng -lyajl -lnl-route-3 -lnl-3 -laudit -ldevmapper
-lxml2 -lnuma -lavahi-common -lavahi-client -ldbus-1 -lgnutls -lgcrypt -lsasl2 -lssh2
-lcurl -lselinux ../gnulib/lib/.libs/libgnu.a -lpthread -lutil
./.libs/libqemumonitortestutils.a -ldl -Wl,-rpath -Wl,/root/software/libvirt-inst/lib
But error in my fedora 19, the cmdline likes:
gcc -std=gnu99 -Dabs_builddir=\"/home/ryan/libvirt/tests\"
-I/usr/include/libxml2 -W -Waddress -Waggressive-loop-optimizations -Wall -Warray-bounds
-Wattributes -Wbad-function-cast -Wbuiltin-macro-redefined -Wcast-align -Wchar-subscripts
-Wclobbered -Wcomment -Wcomments -Wcoverage-mismatch -Wcpp -Wdeprecated-declarations
-Wdisabled-optimization -Wdiv-by-zero -Wdouble-promotion -Wempty-body -Wendif-labels
-Wextra -Wformat-contains-nul -Wformat-extra-args -Wformat-security -Wformat-y2k
-Wformat-zero-length -Wfree-nonheap-object -Wignored-qualifiers -Wimplicit
-Wimplicit-function-declaration -Wimplicit-int -Winit-self -Winline -Wint-to-pointer-cast
-Winvalid-memory-model -Winvalid-pch -Wjump-misses-init -Wlogical-op -Wmain
-Wmaybe-uninitialized -Wmissing-braces -Wmissing-declarations -Wmissing-field-initializers
-Wmissing-include-dirs -Wmissing-parameter-type -Wmissing-prototypes -Wmudflap -Wmultichar
-Wnarrowing -Wnested-externs -Wnonnull -Wnormalized=nfc -Wold-style-declaration
-Wold-style-definition -Woverflow -Woverride-init -Wpacked-bitfield-compat -Wparentheses
-Wpointer-arith -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wreturn-local-addr
-Wreturn-type -Wsequence-point -Wshadow -Wsizeof-pointer-memaccess -Wstrict-aliasing
-Wstrict-prototypes -Wsuggest-attribute=const -Wsuggest-attribute=format
-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wswitch -Wsync-nand -Wtrampolines
-Wtrigraphs -Wtype-limits -Wuninitialized -Wunknown-pragmas -Wunused
-Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-function -Wunused-label
-Wunused-local-typedefs -Wunused-parameter -Wunused-result -Wunused-value
-Wunused-variable -Wvarargs -Wvariadic-macros -Wvector-operation-performance
-Wvolatile-register-var -Wwrite-strings -Wno-sign-compare -Wjump-misses-init
-Wno-format-nonliteral -Wframe-larger-than=4096 -fstack-protector-all
--param=ssp-buffer-size=4 -Wno-unused-command-line-argument -fexceptions
-fasynchronous-unwind-tables -fdiagnostics-show-option -funit-at-a-time -fipa-pure-const
-Wno-suggest-attribute=pure -Wno-suggest-attribute=const -Werror -g2 -O0 -o
.libs/qemuagenttest qemuagenttest.o testutils.o testutilsqemu.o
../src/.libs/libvirt_driver_qemu_impl.a ../src/.libs/libvirt_driver_network_impl.a
../src/.libs/libvirt.so -lnl -ldevmapper -lxml2 -lselinux ../gnulib/lib/.libs/libgnu.a
-lpthread -lutil ./.libs/libqemumonitortestutils.a -ldl -Wl,-rpath
-Wl,/root/software/libvirt-inst/lib
And the attachment is the build log in my fedora 19.
So why cause this?
----- Original Message -----
From: "Jincheng Miao" <jmiao(a)redhat.com>
To: "Eric Blake" <eblake(a)redhat.com>
Cc: libvir-list(a)redhat.com
Sent: Thursday, August 1, 2013 11:50:18 AM
Subject: Re: [libvirt] [PATCH] Fix test case qemuagenttest compilation.
On 08/01/2013 05:48 AM, Eric Blake wrote:
> When compiling qemuagenttest, a link error occurs like:
> ./.libs/libqemumonitortestutils.a(qemumonitortestutils.o): In function
`qemuMonitorTestFree':
> libvirt/tests/qemumonitortestutils.c:346: undefined reference to
`qemuMonitorClose'
> ./.libs/libqemumonitortestutils.a(qemumonitortestutils.o): In function
`qemuMonitorTestNew':
> libvirt/tests/qemumonitortestutils.c:870: undefined reference to
`qemuMonitorOpen'
> collect2: error: ld returned 1 exit status
What platform was this on? Some distros are set up to be tolerant of
lazy resolution, which masks issues like this (hence, I'm _not_ seeing
this error on Fedora).
Actually I am using fedora 19 too.
And the toolchain is:
gcc-4.8.1-1.fc19.x86_64
libtool-2.4.2-16.fc19.x86_64
>
> And I checked this error, it caused by the position of
> libqemumonitortestutils.a in gcc arguments.
>
> If libqemumonitortestutils.a before libvirt_driver_qemu_impl.a
> and libvirt_driver_network_impl.a, the compilation passed.
> Otherwise, failed.
>
> I think this should be a gcc's bug, but nevermind,
> just fix it in libvirt.
No, it's not a bug in gcc, but an actual bug in libvirt. If you can't
rely on lazy resolution (such as on platforms like mingw, except that
mingw doesn't build qemumonitortestutils in the first place), then
libraries MUST be listed in the order in which later libraries satisfy
symbols used by earlier libraries.
How do I check whether I am relying on lazy link?
ACK, although I'd like to touch up your commit message (and in
particular mention the platform where this matters) before pushing.
--
libvir-list mailing list
libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list