[libvirt] [PATCH] mac os x: don't compile failing example program on 32 bit mac os x

This addresses a compilation failure issue reported last year on OS X: https://www.redhat.com/archives/libvir-list/2009-May/msg00166.html In testing here, the compilation only fails on 32 bit OS X, but works on 64 bit, even when using exact same compile and linking flags. This commit surgically disables compilation of this one example program on 32 bit Mac OS X (only). Compilation still occurs, with a working executable produced, on 64 bit Mac OS X. --- examples/domain-events/events-c/event-test.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c index 74eabba..3dff13b 100644 --- a/examples/domain-events/events-c/event-test.c +++ b/examples/domain-events/events-c/event-test.c @@ -5,7 +5,7 @@ #include <string.h> #include <signal.h> -#if HAVE_SYS_POLL_H +#if HAVE_SYS_POLL_H && !(defined(__i386__) && defined(__APPLE__) && defined(__MACH__)) # include <sys/types.h> # include <sys/poll.h> # include <libvirt/libvirt.h> -- 1.7.3

[adding bug-gnulib] On 09/28/2010 06:36 AM, Justin Clift wrote:
This addresses a compilation failure issue reported last year on OS X:
https://www.redhat.com/archives/libvir-list/2009-May/msg00166.html
which in turn mentions:
gcc -Wall -Wformat -Wmissing-prototypes -Wnested-externs -Wpointer- arith -Wextra -Wshadow -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls -Wno-sign-compare -Wp,- D_FORTIFY_SOURCE=2 -fexceptions -fasynchronous-unwind-tables -g -O2 - o .libs/event-test event_test-event-test.o -L/opt/local/lib ../../../ src/.libs/libvirt.dylib -L/usr/lib /usr/lib/libxml2.dylib -licucore - lm /opt/local/lib/libgnutls.dylib /opt/local/lib/libtasn1.dylib -lz / opt/local/lib/libgcrypt.dylib /opt/local/lib/libgpg-error.dylib - lpthread /opt/local/lib/libintl.dylib /opt/local/lib/libiconv.dylib -lc
Undefined symbols: "_rpl_poll$UNIX2003", referenced from: _main in event_test-event-test.o ld: symbol(s) not found collect2: ld returned 1 exit status make[2]: *** [event-test] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2
The UNIX2003 symbol does not exist in 10.4, only in 10.5.
But the failed link mentions rpl_poll, not poll, which means this is most likely a gnulib bug in the poll module. Rather than skipping this test on just 32-bit MacOS in libvirt, I think the better thing to do is address why gnulib is triggering a link failure in the first place.
In testing here, the compilation only fails on 32 bit OS X, but works on 64 bit, even when using exact same compile and linking flags.
This commit surgically disables compilation of this one example program on 32 bit Mac OS X (only). Compilation still occurs, with a working executable produced, on 64 bit Mac OS X. --- examples/domain-events/events-c/event-test.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
-- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 09/29/2010 12:29 AM, Eric Blake wrote: <snip>
But the failed link mentions rpl_poll, not poll, which means this is most likely a gnulib bug in the poll module. Rather than skipping this test on just 32-bit MacOS in libvirt, I think the better thing to do is address why gnulib is triggering a link failure in the first place.
Went with the "surgical removal" approach here for time efficient, rather than going for the perfect world approach. :) Figured that on the balance of things, this is just an example program being disabled for now rather than something essential. Still trying to get other bits behaving place, and this compilation failure was more of a distraction than anything. :) But, if sometime has time in the very near future to give direction for solving this, them I'm happy to do my bit. ?

[replies can omit bug-gnulib] On 09/28/2010 08:29 AM, Eric Blake wrote:
[adding bug-gnulib]
which in turn mentions:
gcc -Wall -Wformat -Wmissing-prototypes -Wnested-externs -Wpointer- arith -Wextra -Wshadow -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls -Wno-sign-compare -Wp,- D_FORTIFY_SOURCE=2 -fexceptions -fasynchronous-unwind-tables -g -O2 - o .libs/event-test event_test-event-test.o -L/opt/local/lib ../../../ src/.libs/libvirt.dylib -L/usr/lib /usr/lib/libxml2.dylib -licucore - lm /opt/local/lib/libgnutls.dylib /opt/local/lib/libtasn1.dylib -lz / opt/local/lib/libgcrypt.dylib /opt/local/lib/libgpg-error.dylib - lpthread /opt/local/lib/libintl.dylib /opt/local/lib/libiconv.dylib -lc
Aha - I just realized the problem. The Makefile.am fails to link against the gnulib library that provides rpl_poll, even though the headers are pulling in the replacement definition.
But the failed link mentions rpl_poll, not poll, which means this is most likely a gnulib bug in the poll module. Rather than skipping this test on just 32-bit MacOS in libvirt, I think the better thing to do is address why gnulib is triggering a link failure in the first place.
In testing here, the compilation only fails on 32 bit OS X, but works on 64 bit, even when using exact same compile and linking flags.
That's because poll doesn't need gnulib replacement on the 64-bit OS X, just the 32-bit version. The real fix should be in examples/domain-events/events-c/Makefile.am to fix LDADD to mention libgnu.la. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Justin Clift