Bug 1161338
| Summary: | ruby-libvirt: FTBS on Mac OS | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Community] Virtualization Tools | Reporter: | Mark Heily <mark.heily> | ||||||
| Component: | ruby-libvirt | Assignee: | Michal Privoznik <mprivozn> | ||||||
| Status: | ASSIGNED --- | QA Contact: | |||||||
| Severity: | unspecified | Docs Contact: | |||||||
| Priority: | unspecified | ||||||||
| Version: | unspecified | CC: | mark.heily, mprivozn, radek.simko, sebastian, victor.volle | ||||||
| Target Milestone: | --- | Keywords: | Reopened | ||||||
| Target Release: | --- | ||||||||
| Hardware: | x86_64 | ||||||||
| OS: | Mac OS | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | Environment: | ||||||||
| Last Closed: | 2025-10-17 00:10:15 UTC | Type: | Bug | ||||||
| Regression: | --- | Mount Type: | --- | ||||||
| Documentation: | --- | CRM: | |||||||
| Verified Versions: | Category: | --- | |||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||
| Embargoed: | |||||||||
| Attachments: |
|
||||||||
Created attachment 954697 [details]
workaround to fix the build
Here is a patch that fixes the build. It does not fix the underlying problem with extconf.rb
See below for the relevant portion of the ext/libvirt/mkmf.log logfile.
Note that the configuration test program does not include <libvirt/libvirt-qemu.h>, so clang throws an error.
---- snip -----
have_library: checking for virDomainQemuMonitorCommand() in -lvirt-qemu... -------------------- no
"xcrun clang -o conftest -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin14 -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/backward -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -g -Os -pipe -DHAVE_GCC_SYNC_BUILTINS -I/usr/local/Cellar/libvirt/1.2.8/include conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib -L. -L/usr/local/lib -L/usr/local/Cellar/libvirt/1.2.8/lib -arch x86_64 -arch i386 -lvirt -lruby.2.0.0 -lvirt-qemu -lvirt -lpthread -ldl -lobjc "
conftest.c:5:57: error: use of undeclared identifier 'virDomainQemuMonitorCommand'
int t(void) { void ((*volatile p)()); p = (void ((*)()))virDomainQemuMonitorCommand; return 0; }
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: extern int t(void);
5: int t(void) { void ((*volatile p)()); p = (void ((*)()))virDomainQemuMonitorCommand; return 0; }
6: int main(int argc, char **argv)
7: {
8: if (argc > 1000000) {
9: printf("%p", &t);
10: }
11:
12: return 0;
13: }
/* end */
Here's another failure to detect a valid symbol. This time, it points to a mismatch between i386 and x86_64.
have_func: checking for virStoragePoolIsActive() in libvirt/libvirt.h... -------------------- no
"xcrun clang -o conftest -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin14 -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/backward -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -g -Os -pipe -DHAVE_GCC_SYNC_BUILTINS -I/usr/local/Cellar/libvirt/1.2.8/include conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib -L. -L/usr/local/lib -L/usr/local/Cellar/libvirt/1.2.8/lib -arch x86_64 -arch i386 -lvirt -lruby.2.0.0 -lvirt -lpthread -ldl -lobjc "
ld: warning: ignoring file /usr/local/lib/libvirt.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libvirt.dylib
Undefined symbols for architecture i386:
"_virStoragePoolIsActive", referenced from:
_t in conftest-58b4f3.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Possible fix: When I run this, it appears to build correctly: ARCHFLAGS='-arch x86_64' gem install ruby-libvirt This should be against ruby-libvirt rather than libvirt itself. Mark, do you mind posting a patch? Sometimes it's the best way to get things moving. Created attachment 1002448 [details]
improved patch to fix the build
Here's a patch that works for me.
I'm able to run "rake build" and then "rake gem" to generate a gem on an OS/X 10.10 system.
I've proposed the patch upstream: https://www.redhat.com/archives/libvir-list/2015-March/msg00818.html Instead of the obsolete patch from comment 1 I would propose diff --git a/ext/libvirt/extconf.rb b/ext/libvirt/extconf.rb index d5f4d74..a87909f 100644 --- a/ext/libvirt/extconf.rb +++ b/ext/libvirt/extconf.rb @@ -479,7 +479,7 @@ libvirt_funcs.each { |f| have_func(f, "libvirt/libvirt.h") } libvirt_consts.each { |c| have_const(c, ["libvirt/libvirt.h"]) } virterror_consts.each { |c| have_const(c, ["libvirt/virterror.h"]) } if find_header("libvirt/libvirt-qemu.h") - have_library("virt-qemu", "virDomainQemuMonitorCommand") + have_library("virt-qemu", "virDomainQemuMonitorCommand", "libvirt/libvirt-qemu.h") libvirt_qemu_funcs.each { |f| have_func(f, "libvirt/libvirt-qemu.h") } libvirt_qemu_consts.each { |c| have_const(c, ["libvirt/libvirt-qemu.h"]) } end this should correctly determine if libvirt-qemu is available fully patched version at https://github.com/kontrafiktion/ruby-libvirt/tree/bug-1161338 1) the patch to extconf.rb to correctly determine whether libvirt-qemu is installed 2) the patch to Rakefile to correctly set the ARCH_FLAG on OS X Corrected patch to include one more line in Rakefile https://github.com/Grejeru/ruby-libvirt/commit/7f9e41d6599ce0e33aa56c42f83c5f58c5c46cd4 This product has been discontinued or is no longer tracked in Red Hat Bugzilla. Reopening because Virtualization Tools has not been discontinued. |
Description of problem: On Mac OS X 10.10, the ruby-libvirt gem fails to compile. Version-Release number of selected component (if applicable): 0.5.2 How reproducible: Always Steps to Reproduce: 1. git clone git://libvirt.org/ruby-libvirt.git 2. cd ruby-libvirt 3. rake build Actual results: The gem should build. Expected results: domain.c:5439:29: error: use of undeclared identifier 'VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK' INT2NUM(VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK)); ... followed by similar errors Additional info: