Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

ruby_sourceline missing from C API #1988

Quintus opened this Issue Nov 5, 2012 · 3 comments


None yet
3 participants

Quintus commented Nov 5, 2012

Hi there,

I just tried to install the gtk2 gem, but installation fails like this:

(1025) [12:59:13 quintus@roma] ~
% sudo gem install gtk2
[sudo] password for quintus: 
Fetching: pkg-config-1.1.4.gem (100%)
Fetching: glib2-1.1.5.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing gtk2:
    ERROR: Failed to build gem native extension.

        /opt/rubies/rubinius/bin/rbx extconf.rb
compiling rbglib_int64.c
compiling rbgobj_paramspecs.c
compiling rbglib_messages.c
rbglib_messages.c: In function ‘rbglib_log_handler’:
rbglib_messages.c:66:37: error: ‘ruby_sourcefile’ undeclared (first use in this function)
rbglib_messages.c:66:37: note: each undeclared identifier is reported only once for each function it appears in
rbglib_messages.c:66:54: error: ‘ruby_sourceline’ undeclared (first use in this function)
make: *** [rbglib_messages.o] Error 1

Gem files will remain installed in /opt/rubies/rubinius/gems/1.9/gems/glib2-1.1.5 for inspection.
Results logged to /opt/rubies/rubinius/gems/1.9/gems/glib2-1.1.5/ext/glib2/gem_make.out

Here’s the full content of the gem_make.out file: https://gist.github.com/4016907

It appears that Rubinius doesn’t define ruby_sourceline publicely. Here’s the definition in MRI’s 1.9.3-p286: https://github.com/ruby/ruby/blob/a251302038d8b4c98d220c4f9843786fb9d8dd10/include/ruby/intern.h#L541

Rubinius version in use:

% ruby -v
rubinius 2.0.0rc1 (1.9.3 d19e086d 2012-11-02 JI) [x86_64-unknown-linux-gnu]



brixen commented Nov 5, 2012

ruby_sourceline is a C global variable and probably will not be supported in the C-API.

Quintus commented Nov 9, 2012

Hm, OK. Is there an equivalent to getting __LINE__ from Rubinius’ C API?

Here’s the issue I’ve reported against ruby-gnome2: ruby-gnome2/ruby-gnome2#117



dbussink commented Nov 9, 2012

Well, there is rb_sourceline() which is a function that the extension uses when available. We can support that function then:


The problem is that the glib2 gem probably has a whole bunch of other methods too that we don't have yet.

@dbussink dbussink closed this in 8ebf4a7 Nov 28, 2012

This was referenced Dec 29, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment