[libvirt] [PATCH] mingw: Fix symbol export

In commit 98fb83ce25f46e0236706fa6e0943032d921935f I changed the version script handling. But it seems that I didn't test this properly and broke it. The .def file is passed to the compiler directly, but it should get passed to the linker instead. Set VERSION_SCRIPT_FLAGS to -Wl, to pass the .def file correctly to the linker. This fixes the undefined symbol errors while linking virsh. --- configure.ac | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index f25e173..6ee5b90 100644 --- a/configure.ac +++ b/configure.ac @@ -78,7 +78,6 @@ AM_PROG_LD VERSION_SCRIPT_FLAGS=-Wl,--version-script= `$LD --help 2>&1 | grep -- --version-script >/dev/null` || \ VERSION_SCRIPT_FLAGS="-Wl,-M -Wl," -AC_SUBST(VERSION_SCRIPT_FLAGS) LIBVIRT_COMPILE_WARNINGS([maximum]) @@ -1824,10 +1823,11 @@ case "$host" in # from libvirt.syms and passes libvirt.def instead of libvirt.syms to the linker LIBVIRT_SYMBOL_FILE=libvirt.def # mingw's ld has the --version-script parameter, but it requires a .def file - # instead to work properly, therefore clear --version-script here + # instead to work properly, therefore clear --version-script here and use + # -Wl, to pass the .def file to the linker # cygwin's ld has the --version-script parameter too, but for some reason # it's working there as expected - VERSION_SCRIPT_FLAGS= + VERSION_SCRIPT_FLAGS="-Wl," ;; esac AC_SUBST([CYGWIN_EXTRA_LDFLAGS]) @@ -1836,6 +1836,7 @@ AC_SUBST([CYGWIN_EXTRA_PYTHON_LIBADD]) AC_SUBST([MINGW_EXTRA_LDFLAGS]) AC_SUBST([WIN32_EXTRA_CFLAGS]) AC_SUBST([LIBVIRT_SYMBOL_FILE]) +AC_SUBST([VERSION_SCRIPT_FLAGS]) dnl Look for windres to build a Windows icon resource. -- 1.7.0.4

On 05/03/2010 12:55 PM, Matthias Bolte wrote:
In commit 98fb83ce25f46e0236706fa6e0943032d921935f I changed the version script handling. But it seems that I didn't test this properly and broke it. The .def file is passed to the compiler directly, but it should get passed to the linker instead.
Set VERSION_SCRIPT_FLAGS to -Wl, to pass the .def file correctly to the linker.
This fixes the undefined symbol errors while linking virsh.
ACK. I'm still getting some other errors using autobuild.sh, but they are independent of this one and shouldn't hold up this one from going in: CCLD libvirt.la Info: resolving _xmlFree by linking to __imp__xmlFree (auto-import) Creating library file: .libs/libvirt.dll.a /usr/lib/gcc/i686-pc-mingw32/4.4.1/../../../../i686-pc-mingw32/bin/ld: warning: auto-importing has been activated without --enable-auto-import specified on the command line. This should work unless it involves constant data structures referencing symbols from auto-imported DLLs. Cannot export linuxDomainInterfaceStats: symbol not defined Cannot export virCondWaitUntil: symbol not defined Cannot export virPipeReadUntilEOF: symbol not defined Cannot export xenLinuxDomainBlockStats: symbol not defined collect2: ld returned 1 exit status -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

2010/5/3 Eric Blake <eblake@redhat.com>:
On 05/03/2010 12:55 PM, Matthias Bolte wrote:
In commit 98fb83ce25f46e0236706fa6e0943032d921935f I changed the version script handling. But it seems that I didn't test this properly and broke it. The .def file is passed to the compiler directly, but it should get passed to the linker instead.
Set VERSION_SCRIPT_FLAGS to -Wl, to pass the .def file correctly to the linker.
This fixes the undefined symbol errors while linking virsh.
ACK.
Thanks, pushed.
I'm still getting some other errors using autobuild.sh, but they are independent of this one and shouldn't hold up this one from going in:
I never used autobuild.sh, but it shouldn't do any thing different than a manual build.
CCLD libvirt.la Info: resolving _xmlFree by linking to __imp__xmlFree (auto-import) Creating library file: .libs/libvirt.dll.a /usr/lib/gcc/i686-pc-mingw32/4.4.1/../../../../i686-pc-mingw32/bin/ld: warning: auto-importing has been activated without --enable-auto-import specified on the command line. This should work unless it involves constant data structures referencing symbols from auto-imported DLLs. Cannot export linuxDomainInterfaceStats: symbol not defined Cannot export virCondWaitUntil: symbol not defined Cannot export virPipeReadUntilEOF: symbol not defined
I know of this two symbols (virCondWaitUntil and virPipeReadUntilEOF) and am right now preparing a patch to fix that. Previously I just removed virCondWaitUntil and virPipeReadUntilEOF from the symbol files.
Cannot export xenLinuxDomainBlockStats: symbol not defined collect2: ld returned 1 exit status
I never had problems with the other two symbols: linuxDomainInterfaceStats and xenLinuxDomainBlockStats I build directly on Windows instead of cross-compiling from Fedora, maybe that makes a difference. Matthias
participants (2)
-
Eric Blake
-
Matthias Bolte