
Hi! I am trying to build Ruby bindings for libvirt 0.4.1. I have checked out ruby-libvirt from mercurial repository, but it fails during the build: # rake build (in /home/lord/tmp/ruby-libvirt) make gcc -I. -I/usr/lib/ruby/1.8/i386-linux -I/usr/lib/ruby/1.8/i386-linux - I. -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions - fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 - mtune=generic -fasynchronous-unwind-tables -Wall -fPIC -c _libvirt.c _libvirt.c:165: error: expected Б─≤,Б─≥ or Б─≤;Б─≥ before Б─≤{Б─≥ token make: *** [_libvirt.o] Error 1 rake aborted! Command failed with status (2): [make...] /home/lord/tmp/ruby-libvirt/Rakefile:52 (See full trace by running task with --trace) The offending line is: NORETURN(static void vir_error(virConnectPtr conn, const char *fn)) { rb_raise(rb_eSystemCallError, "libvir call %s failed", fn); } removing NORETURN macro around function definition eliminates the error and all tests pass: # rake test (in /home/lord/tmp/ruby-libvirt) Loaded suite /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/ rake_test_loader Started ..... Finished in 0.006453 seconds. 5 tests, 58 assertions, 0 failures, 0 errors Here is some information about my system: # gcc --version gcc (GCC) 4.1.2 20070626 (Red Hat 4.1.2-14) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # cat /etc/redhat-release CentOS release 5 (Final) # arch i686 Sincerely, Vadim

On Wed, 2008-03-26 at 14:53 -0700, Vadim Zaliva wrote:
The offending line is:
NORETURN(static void vir_error(virConnectPtr conn, const char *fn)) { rb_raise(rb_eSystemCallError, "libvir call %s failed", fn); }
This is very strange since the NORETURN macro is defined by ruby-devel (for gcc it amounts to __attribute__((noreturn)) ) I just checked in my RHEL5 build root, and it's set to a noop in ruby.h if it is not defined by config.h This is with ruby-devel-1.8.5-5.el5 .. which version of ruby-devel are you using ? Can you grep for NORETURN in ruby.h and config.h ? They are in /usr/lib/ruby/1.8/i386-linux David

On Mar 26, 2008, at 16:24, David Lutterkort wrote:
This is very strange since the NORETURN macro is defined by ruby-devel (for gcc it amounts to __attribute__((noreturn)) )
I just checked in my RHEL5 build root, and it's set to a noop in ruby.h if it is not defined by config.h
This is with ruby-devel-1.8.5-5.el5 .. which version of ruby-devel are you using ? Can you grep for NORETURN in ruby.h and config.h ? They are in /usr/lib/ruby/1.8/i386-linux
# rpm -q ruby-devel ruby-devel-1.8.5-5.el5_1.1 # grep NORETURN /usr/lib/ruby/1.8/i386-linux/ruby.h /usr/lib/ruby/1.8/ i386-linux/config.h /usr/lib/ruby/1.8/i386-linux/ruby.h:#define NORETURN_STYLE_NEW 1 /usr/lib/ruby/1.8/i386-linux/ruby.h:#ifndef NORETURN /usr/lib/ruby/1.8/i386-linux/ruby.h:# define NORETURN(x) x /usr/lib/ruby/1.8/i386-linux/ruby.h:NORETURN(void rb_raise __((VALUE, const char*, ...))); /usr/lib/ruby/1.8/i386-linux/ruby.h:NORETURN(void rb_fatal __((const char*, ...))); /usr/lib/ruby/1.8/i386-linux/ruby.h:NORETURN(void rb_bug __((const char*, ...))); /usr/lib/ruby/1.8/i386-linux/ruby.h:NORETURN(void rb_sys_fail _((const char*))); /usr/lib/ruby/1.8/i386-linux/ruby.h:NORETURN(void rb_iter_break _((void))); /usr/lib/ruby/1.8/i386-linux/ruby.h:NORETURN(void rb_exit _((int))); /usr/lib/ruby/1.8/i386-linux/ruby.h:NORETURN(void rb_notimplement _((void))); /usr/lib/ruby/1.8/i386-linux/ruby.h:NORETURN(void rb_throw _((const char*,VALUE))); /usr/lib/ruby/1.8/i386-linux/ruby.h:NORETURN(void ruby_run _((void))); /usr/lib/ruby/1.8/i386-linux/config.h:#define NORETURN(x) x __attribute__ ((noreturn)) Sincerely, Vadim

On Wed, 2008-03-26 at 16:42 -0700, Vadim Zaliva wrote:
On Mar 26, 2008, at 16:24, David Lutterkort wrote:
This is very strange since the NORETURN macro is defined by ruby-devel (for gcc it amounts to __attribute__((noreturn)) )
It seems that gcc-4.1.1/gcc-4.1.2 don't like __attribute__((noreturn)) after the function declaration if that's also the function definition; I checked a fix into the mercurial repo. David
participants (2)
-
David Lutterkort
-
Vadim Zaliva