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

impossible to install on ruby 2.2.9 #145

Open
MathieuDerelle opened this issue Sep 15, 2020 · 4 comments
Open

impossible to install on ruby 2.2.9 #145

MathieuDerelle opened this issue Sep 15, 2020 · 4 comments

Comments

@MathieuDerelle
Copy link

MathieuDerelle commented Sep 15, 2020

What's the problem ?
Which API is missing ?

$ gem install stackprof -v '0.2.15'
Building native extensions. This could take a while...
ERROR:  Error installing stackprof:
	ERROR: Failed to build gem native extension.

    current directory: /Users/mathieu/.rvm/gems/ruby-2.2.9/gems/stackprof-0.2.15/ext/stackprof
/Users/mathieu/.rvm/rubies/ruby-2.2.9/bin/ruby -I /Users/mathieu/.rvm/rubies/ruby-2.2.9/lib/ruby/site_ruby/2.2.0 -r ./siteconf20200915-36469-1mz31om.rb extconf.rb
checking for rb_postponed_job_register_one()... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/Users/mathieu/.rvm/rubies/ruby-2.2.9/bin/$(RUBY_BASE_NAME)
extconf.rb:8:in `<main>': missing API: are you using ruby 2.1+? (RuntimeError)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/mathieu/.rvm/gems/ruby-2.2.9/extensions/x86_64-darwin-16/2.2.0/stackprof-0.2.15/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/mathieu/.rvm/gems/ruby-2.2.9/gems/stackprof-0.2.15 for inspection.
Results logged to /Users/mathieu/.rvm/gems/ruby-2.2.9/extensions/x86_64-darwin-16/2.2.0/stackprof-0.2.15/gem_make.out

mkmf.log :

have_func: checking for rb_postponed_job_register_one()... -------------------- no

"gcc -o conftest -I/Users/mathieu/.rvm/rubies/ruby-2.2.9/include/ruby-2.2.0/x86_64-darwin16 -I/Users/mathieu/.rvm/rubies/ruby-2.2.9/include/ruby-2.2.0/ruby/backward -I/Users/mathieu/.rvm/rubies/ruby-2.2.9/include/ruby-2.2.0 -I.  -I/usr/local/opt/libyaml/include -I/usr/local/opt/libksba/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/opt/[email protected]/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens  -fno-common -pipe conftest.c  -L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/[email protected]/lib -L. -L/Users/mathieu/.rvm/rubies/ruby-2.2.9/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/[email protected]/lib      -lruby.2.2.0  -lpthread -lgmp -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"gcc -o conftest -I/Users/mathieu/.rvm/rubies/ruby-2.2.9/include/ruby-2.2.0/x86_64-darwin16 -I/Users/mathieu/.rvm/rubies/ruby-2.2.9/include/ruby-2.2.0/ruby/backward -I/Users/mathieu/.rvm/rubies/ruby-2.2.9/include/ruby-2.2.0 -I.  -I/usr/local/opt/libyaml/include -I/usr/local/opt/libksba/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/opt/[email protected]/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens  -fno-common -pipe conftest.c  -L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/[email protected]/lib -L. -L/Users/mathieu/.rvm/rubies/ruby-2.2.9/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/[email protected]/lib      -lruby.2.2.0  -lpthread -lgmp -ldl -lobjc "
conftest.c:13:57: error: use of undeclared identifier 'rb_postponed_job_register_one'
int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_postponed_job_register_one; return 0; }
                                                        ^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10: 
11:   return 0;
12: }
13: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_postponed_job_register_one; return 0; }
/* end */

"gcc -o conftest -I/Users/mathieu/.rvm/rubies/ruby-2.2.9/include/ruby-2.2.0/x86_64-darwin16 -I/Users/mathieu/.rvm/rubies/ruby-2.2.9/include/ruby-2.2.0/ruby/backward -I/Users/mathieu/.rvm/rubies/ruby-2.2.9/include/ruby-2.2.0 -I.  -I/usr/local/opt/libyaml/include -I/usr/local/opt/libksba/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/opt/[email protected]/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens  -fno-common -pipe conftest.c  -L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/[email protected]/lib -L. -L/Users/mathieu/.rvm/rubies/ruby-2.2.9/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/[email protected]/lib      -lruby.2.2.0  -lpthread -lgmp -ldl -lobjc "
conftest.c:13:15: error: implicit declaration of function 'rb_postponed_job_register_one' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
int t(void) { rb_postponed_job_register_one(); return 0; }
              ^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10: 
11:   return 0;
12: }
13: int t(void) { rb_postponed_job_register_one(); return 0; }
/* end */

--------------------
@MathieuDerelle MathieuDerelle changed the title impossible de install on ruby 2.2.9 impossible to install on ruby 2.2.9 Sep 15, 2020
@mehagar
Copy link

mehagar commented Sep 24, 2020

Seeing the same thing trying to install from ruby 2.1.10 as well.

@NickLaMuro
Copy link
Contributor

@mehagar for your case, greater than ruby 2.2 is required:

https://github.com/tmm1/stackprof#requirements

@NickLaMuro
Copy link
Contributor

@MathieuDerelle Sorry for the delay in my response. I decided to try reproducing this myself, but wasn't able to, but possibly some of the difficulties I had of trying to get Ruby 2.2 installed on a newer Mac might shed some light as to what the issue on your end might be.


To start, I had a couple failed attempts trying to get OpenSSL to work with Ruby properly. Turns out it was something as described here:

rbenv/ruby-build#1277

However, the steps suggested later in the post didn't work with the current state of Homebrew since they have deprecated [email protected], which Ruby needs:

rbenv/ruby-build#1353
https://github.com/rbenv/homebrew-tap

(Note: I currently use ruby-install, so I had to install that tap, but then run it a slightly different way then was suggested: ruby-install ruby-2.2.9 -- --with-openssl-dir=$(brew --prefix [email protected]))

That all said, none of this was an issue that you described, but while looking through said issues, it also seems like particular versions of clang might have issues with ruby installations:

rbenv/ruby-build#1353 (comment)

Completely guessing here, but it is possible that you installed ruby on a previous version of clang, and then upgraded and are now running into compatibility issues when trying to compile the Stackprof C extension.

Hope this helps,
-Nick

@MathieuDerelle
Copy link
Author

Indeed, there are now problems with openssl when installing ruby < 2.4
Using rvm, the command for me was rvm install 2.2.9 --with-openssl-dir='/usr/local/opt/[email protected]'

I had some issues with Command Line Tools recently.
Now that its fixed, I'll try again to install this gem and come back to you.

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

4 participants
@NickLaMuro @mehagar @MathieuDerelle and others