Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gem fails to compile #55

Open
dnebdal opened this issue Apr 24, 2021 · 8 comments
Open

Gem fails to compile #55

dnebdal opened this issue Apr 24, 2021 · 8 comments

Comments

@dnebdal
Copy link

dnebdal commented Apr 24, 2021

Hi. Using ruby 2.7.2 on Fedora 33, both "gem install lmdb" and a git clone / bundle exec rake fails with very similar errors:

gcc -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I../../../../ext/lmdb_ext -I../../../../ext/lmdb_ext/liblmdb -DRUBY_EXTCONF_H=\"extconf.h\"    -fPIC -std=c99 -Wall -g -m64 -o lmdb_ext.o -c ../../../../ext/lmdb_ext/lmdb_ext.c
../../../../ext/lmdb_ext/lmdb_ext.c: In function ‘call_with_transaction_helper’:
../../../../ext/lmdb_ext/lmdb_ext.c:172:10: error: #error "Not implemented"
  172 |         #error "Not implemented"
      |          ^~~~~

As far as I can tell, this is this block in lmdb_ext.c , starting at line 169:

// Ruby 1.8.7 compatibility
#ifndef HAVE_RB_FUNCALL_PASSING_BLOCK
static VALUE call_with_transaction_helper(VALUE arg) {
        #error "Not implemented"
}
#else
static VALUE call_with_transaction_helper(VALUE arg) {
        HelperArgs* a = (HelperArgs*)arg;
        return rb_funcall_passing_block(a->self, rb_intern(a->name), a->argc, a->argv);
}
#endif

Just removing the entire ifdef and uncritically using the #else version seems to work for me, but I assume it's there for a reason.

@doriantaylor
Copy link
Collaborator

hmmm I'm gonna assume that's reeeally old. One moment, I haven't looked at this in a while.

@doriantaylor
Copy link
Collaborator

I just successfully compiled on 2.7.0 on Ubuntu 20.04 and 3.0.1 on macOS. It looks like your extconf.rb is not picking the presence of rb_funcall_passing_block. (or not being run at all?)

Is it possible to see what your extconf.h looks like, the one that gets generated when you try to bundle exec rake?

Also since I've taken over maintenance of this gem, can you try building my fork?

@dnebdal
Copy link
Author

dnebdal commented Apr 28, 2021

Same thing from your fork, I'm afraid. It's entirely possible that this is on me; I very rarely use Ruby and I'm going by guesswork and google for how to build gems.

Here's a log of what I did, how it failed, and what's in extconf.rb and extconf.h :
https://gist.github.com/dnebdal/1683fdbcc4deb777950aa5b8ba3a96f1

@doriantaylor
Copy link
Collaborator

hm, as predicted those defines are missing. eeeeeenteresting.

@dnebdal
Copy link
Author

dnebdal commented Apr 28, 2021

I can try to recreate it in a Fedora VM, just to rule out any weird local variations?

@doriantaylor
Copy link
Collaborator

If extconf.rb isn't setting those defines that probably means it can't see the header files, but if you can compile it otherwise it must necessarily be able to see them, so that is really weird. Can you double-check that you have the dev headers for ruby? Also is it possible that your environment variables are getting messed with?

@doriantaylor
Copy link
Collaborator

actually, what is -I/usr/include/ruby/backward ? are there old headers in there masking the new ones?

@doriantaylor
Copy link
Collaborator

Got somebody on Freenode to reproduce on Fedora with 3.0.1; inclined to chalk this up as a Fedora problem. Something is messing with the execution of that extconf.rb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants