[Libvir] libvirt on OS X Leopard 10.5.1

Schley Andrew Kutz akutz at lostcreations.com
Mon Jan 21 22:50:29 UTC 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I spent the weekend attempting to get libvirt working on OS X Leopard  
10.5.1. I was able to get it to compile, but not connect to libvirtd  
running on either my KVM or Xen servers. Here are the instructions for  
getting it to compile:

1. Download libvirt-0.4.0 from the mirrors.

2. Use macports to install pkgconfig and gnutls

3. Configure your source:

./configure --without-xen --without-qemu

4. Replace instances of 'hyper' in qemu/remote_protocol.x with 'long'  
and then follow the instructions on http://libvirt.org/windows.html to  
regen XDR structures.

5. Edit '/usr/include/net/if.h' and add the following include:

   #include <net/if_var.h>
   #include <sys/types.h>

   //
   // EDIT: akutz
   //
   #include <sys/socket.h>

6. Create a symlink for 'malloc.h' so the libvirt source can find it:

sudo ln -s /usr/include/malloc/malloc.h /usr/include/malloc.h

7. Add a header to "src/remote_internal.c":

   //
   // EDIT: akutz
   //
   #include <sys/un.h>

8. The version-script parameter of ld is not portable to OS X. Edit  
'src/Makefile':

   #
   # EDIT: akutz
   #
   #libvirt_la_LDFLAGS = -Wl,--version-script=$(srcdir)/ 
libvirt_sym.version \
   #                     -version-info 4:0:4 \
   #                    $(COVERAGE_CFLAGS:-f%=-Wc,-f%) \

   libvirt_la_LDFLAGS = -Wl, \
                        -version-info 4:0:4 \
                       $(COVERAGE_CFLAGS:-f%=-Wc,-f%) \

9. Replace the distribution copy of libread.dylib with the one from  
Macports or else you will get errors about missing symbols (thread  
starts here http://www.mail-archive.com/macports-dev@lists.macosforge.org/msg00729.html) 
:

sudo mv /usr/lib/libreadline.dylib /usr/lib/libreadline.dylib.dist
sudo ln -s /opt/local/lib/libreadline.dylib /usr/lib/libreadline.dylib

10. The sources should now build and install.

At this point any attempt to connect to a remote host results in the  
thread dying and OS X catching the exception with the following report:

<beginReport>
Process:         Python [57356]
Path:            /System/Library/Frameworks/Python.framework/Versions/ 
2.5/Resources/Python.app/Contents/MacOS/Python
Identifier:      Python
Version:         ??? (???)
Code Type:       X86 (Native)
Parent Process:  bash [59098]

Date/Time:       2008-01-21 16:48:52.228 -0600
OS Version:      Mac OS X 10.5.1 (9B18)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000004
Crashed Thread:  0

Thread 0 Crashed:
0   libvirt.0.dylib               	0x00412911 remoteAuthenticate +  
1345 (remote_internal.c:3062)
1   libvirt.0.dylib               	0x00414869 doRemoteOpen + 3593  
(remote_internal.c:753)
2   libvirt.0.dylib               	0x00415499 remoteOpen + 137  
(remote_internal.c:860)
3   libvirt.0.dylib               	0x00401438 do_open + 392 (libvirt.c: 
579)
4   libvirtmod.so                 	0x000c0e06 libvirt_virConnectOpen +  
102 (libvirt-py.c:1026)
5   org.python.python             	0x0018d826 PyEval_EvalFrameEx + 17116
6   org.python.python             	0x0018da08 PyEval_EvalFrameEx + 17598
7   org.python.python             	0x0018f47b PyEval_EvalCodeEx + 1638
8   org.python.python             	0x0018f568 PyEval_EvalCode + 87
9   org.python.python             	0x001a6a0c PyErr_Display + 1896
10  org.python.python             	0x001a7036 PyRun_FileExFlags + 135
11  org.python.python             	0x001a89a2 PyRun_SimpleFileExFlags  
+ 421
12  org.python.python             	0x001b3c23 Py_Main + 3095
13  org.python.pythonapp          	0x00001fca 0x1000 + 4042

Thread 0 crashed with X86 Thread State (32-bit):
   eax: 0x00000000  ebx: 0x004123e1  ecx: 0xbfffe826  edx: 0x00000000
   edi: 0x00000000  esi: 0xbfffe92c  ebp: 0xbfffea48  esp: 0xbfffe860
    ss: 0x0000001f  efl: 0x00010202  eip: 0x00412911   cs: 0x00000017
    ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
   cr2: 0x00000004

Binary Images:
     0x1000 -     0x1ffe  org.python.pythonapp 2.5.0 (2.5.0a0)  
<a2ccf04a940c23b34c33d7fe108d773e> /System/Library/Frameworks/ 
Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python
    0x49000 -    0x4bfff +libgpg-error.0.dylib ??? (???) /opt/local/ 
lib/libgpg-error.0.dylib
    0xbb000 -    0xc2ff3 +libvirtmod.so ??? (???)  
<20dea38de64927c9e8b50a1fa240e067> /usr/local/lib/python2.5/site- 
packages/libvirtmod.so
   0x118000 -   0x1e3ffb  org.python.python 2.5 (2.5)  
<9786e5d8790a594bb7b3cdcf9a9d0b49> /System/Library/Frameworks/ 
Python.framework/Versions/2.5/Python
   0x2f0000 -   0x2f7ff3 +libintl.8.dylib ??? (???) /opt/local/lib/ 
libintl.8.dylib
   0x400000 -   0x424fef +libvirt.0.dylib ??? (???)  
<70af9029fa4c7accc04377f0f65c53ae> /usr/local/lib/libvirt.0.dylib
   0x43b000 -   0x49bfff +libgnutls.26.dylib ??? (???) /opt/local/lib/ 
libgnutls.26.dylib
   0x4b5000 -   0x4c2fe2 +libtasn1.3.dylib ??? (???) /opt/local/lib/ 
libtasn1.3.dylib
   0x4c7000 -   0x528ff3 +libgcrypt.11.dylib ??? (???)  
<76bad0ad90909bf99f422f8bbfd61124> /opt/local/lib/libgcrypt.11.dylib
   0x540000 -   0x637ff0 +libiconv.2.dylib ??? (???) /opt/local/lib/ 
libiconv.2.dylib
   0x644000 -   0x654ffd +libz.1.dylib ??? (???) /opt/local/lib/libz. 
1.dylib
   0x65f000 -   0x661ffc  apop.so ??? (???)  
<8e5cbfa49bbed80ed34f03e008e3e086> /usr/lib/sasl2/apop.so
   0x665000 -   0x67dfe2  dhx.so ??? (???)  
<0831cf2893deaa2b5525ea7bfda17404> /usr/lib/sasl2/dhx.so
   0x68c000 -   0x694fff  digestmd5WebDAV.so ??? (???)  
<42e13c06e037f02eee71a43324169f62> /usr/lib/sasl2/digestmd5WebDAV.so
   0x698000 -   0x69afff  libanonymous.2.so ??? (???)  
<161902c9ed78dce78b61125c7c155f0f> /usr/lib/sasl2/libanonymous.2.so
   0x69e000 -   0x6a0ffc  libcrammd5.2.so ??? (???)  
<c917c89eefddcfcacf48c939c3af12aa> /usr/lib/sasl2/libcrammd5.2.so
   0x6a4000 -   0x6adffb  libdigestmd5.2.so ??? (???)  
<c8595204acd0e7cb362b33d008693019> /usr/lib/sasl2/libdigestmd5.2.so
   0x6b1000 -   0x6b5fff  libgssapiv2.2.so ??? (???)  
<a47ee23249e7c36aee418a6e7fd3a502> /usr/lib/sasl2/libgssapiv2.2.so
   0x6bb000 -   0x6bdffc  login.so ??? (???)  
<03d28ec908a6ed9abee1b25fe87716ef> /usr/lib/sasl2/login.so
   0x6c1000 -   0x6c8ffc  libotp.2.so ??? (???)  
<0b7c8cd165835331c586e49465ef1186> /usr/lib/sasl2/libotp.2.so
   0x6d2000 -   0x6d4ffc  libplain.2.so ??? (???)  
<5992f1149ff6cc7fadafa2bfd4ecc00a> /usr/lib/sasl2/libplain.2.so
   0x6d8000 -   0x6ddffc  libpps.so ??? (???)  
<ae02d7b23951bddb4db705b2d632c6ac> /usr/lib/sasl2/libpps.so
   0x6e3000 -   0x6e6fff  mschapv2.so ??? (???)  
<8d5951f3d3a0565fd772ebec4d2054fb> /usr/lib/sasl2/mschapv2.so
   0x6ea000 -   0x6ecffc  shadow_auxprop.so ??? (???)  
<5137115453406a92cf514b65046a6b28> /usr/lib/sasl2/shadow_auxprop.so
   0x6f2000 -   0x6f4ffd  smb_lm.so ??? (???)  
<e9ad275441e15388bf580b1cdf55b430> /usr/lib/sasl2/smb_lm.so
   0x6f8000 -   0x6faffc  smb_nt.so ??? (???)  
<a7144a88919b4aea313caf6c4e86353a> /usr/lib/sasl2/smb_nt.so
   0x6fe000 -   0x701ff0  smb_ntlmv2.so ??? (???)  
<ccfa6d0eafa992db95ad309e32c6d400> /usr/lib/sasl2/smb_ntlmv2.so
0x8fe00000 - 0x8fe2d883  dyld 95.3 (???)  
<81592e798780564b5d46b988f7ee1a6a> /usr/lib/dyld
0x90d29000 - 0x90e5bfe7  com.apple.CoreFoundation 6.5 (476)  
<8bfebc0dbad6fc33bea0fa00a1b9ec37> /System/Library/Frameworks/ 
CoreFoundation.framework/Versions/A/CoreFoundation
0x90e5c000 - 0x90e7aff3  com.apple.DirectoryService.Framework 3.5  
(3.5) <899d8c9ee31b004a6ff73dab88982b1a> /System/Library/Frameworks/ 
DirectoryService.framework/Versions/A/DirectoryService
0x922a3000 - 0x92353fff  edu.mit.Kerberos 6.0.11 (6.0.11)  
<33c25789baedcd70a7e24881775dd9ad> /System/Library/Frameworks/ 
Kerberos.framework/Versions/A/Kerberos
0x9244f000 - 0x924acffb  libstdc++.6.dylib ??? (???)  
<04b812dcec670daa8b7d2852ab14be60> /usr/lib/libstdc++.6.dylib
0x92510000 - 0x926d9fef  com.apple.security 5.0.1 (32736)  
<8c9eda0fcc1d8a571543025ac900715f> /System/Library/Frameworks/ 
Security.framework/Versions/A/Security
0x92f62000 - 0x92f80fff  libresolv.9.dylib ??? (???)  
<54e6a08c2f108bdf5916fb483d51961b> /usr/lib/libresolv.9.dylib
0x93661000 - 0x9366fffd  libz.1.dylib ??? (???)  
<5ddd8539ae2ebfd8e7cc1c57525385c7> /usr/lib/libz.1.dylib
0x936a2000 - 0x93783ff7  libxml2.2.dylib ??? (???)  
<450ec38b57fb46013847cce851001a2f> /usr/lib/libxml2.2.dylib
0x93d28000 - 0x93d2ffe9  libgcc_s.1.dylib ??? (???)  
<f53c808e87d1184c0f9df63aef53ce0b> /usr/lib/libgcc_s.1.dylib
0x94a5b000 - 0x94b93ff7  libicucore.A.dylib ??? (???)  
<afcea652ff2ec36885b2c81c57d06d4c> /usr/lib/libicucore.A.dylib
0x95a7f000 - 0x95b5efff  libobjc.A.dylib ??? (???)  
<5eda47fec2d0e7853b3506aa1fd2dafa> /usr/lib/libobjc.A.dylib
0x9631e000 - 0x963d0ffb  libcrypto.0.9.7.dylib ??? (???)  
<330b0e48e67faffc8c22dfc069ca7a47> /usr/lib/libcrypto.0.9.7.dylib
0x9642c000 - 0x9643bfff  libsasl2.2.dylib ??? (???)  
<b9e1ca0b6612e280b6cbea6df0eec5f6> /usr/lib/libsasl2.2.dylib
0x9643c000 - 0x96466fef  libauto.dylib ??? (???)  
<d468bc4a8a69343f1748c293db1b57fb> /usr/lib/libauto.dylib
0x96d8c000 - 0x96d8dfef  libmathCommon.A.dylib ??? (???) /usr/lib/ 
system/libmathCommon.A.dylib
0x96d9a000 - 0x96ef4fe3  libSystem.B.dylib ??? (???)  
<8ecc83dc0399be3946f7a46e88cf4bbb> /usr/lib/libSystem.B.dylib
0xfffe8000 - 0xfffebfff  libobjc.A.dylib ??? (???) /usr/lib/ 
libobjc.A.dylib
0xffff0000 - 0xffff1780  libSystem.B.dylib ??? (???) /usr/lib/ 
libSystem.B.dylib
</beginReport>

Anyway, hopefully someone on the list can make heads or tails of why  
this is not working on OS X. I sure would love to be able to use  
libvirt instead of xenapi. Thanks!

- --
- -a


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iD8DBQFHlSG1Tg8lceyAqqQRAiD1AJ99NZC23AheQl36oGYU/mmjqILbtwCg07+i
/TT0j27cGU7krDDMk+hVX/k=
=P+Cg
-----END PGP SIGNATURE-----




More information about the libvir-list mailing list