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

Unable to compile native extensions in OS X "El Capitan" #523

Closed
mstahl opened this issue Oct 21, 2015 · 9 comments
Closed

Unable to compile native extensions in OS X "El Capitan" #523

mstahl opened this issue Oct 21, 2015 · 9 comments

Comments

@mstahl
Copy link

mstahl commented Oct 21, 2015

Hi! I got the following output when I tried to gem install redcarpet -v '3.3.3' on my macbook running OS X 10.11.

/usr/local/opt/rbenv/versions/2.1.5/bin/ruby extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling autolink.c
compiling buffer.c
buffer.c:110:45: warning: passing 'const struct buf *' to parameter of type 'struct buf *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        if (buf->size + 1 <= buf->asize || bufgrow(buf, buf->size + 1) == BUF_OK) {
                                                   ^~~
buffer.c:59:21: note: passing argument to parameter 'buf' here
bufgrow(struct buf *buf, size_t neosz)
                    ^
1 warning generated.
compiling houdini_href_e.c
compiling houdini_html_e.c
compiling html.c
compiling html_smartypants.c
compiling markdown.c
markdown.c:2838:43: warning: passing 'const uint8_t *' (aka 'const unsigned char *') to parameter of type 'uint8_t *' (aka 'unsigned char *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
                if (codefences_enabled && (is_codefence(document + beg, doc_size - beg, NULL) != 0))
                                                        ^~~~~~~~~~~~~~
markdown.c:1391:23: note: passing argument to parameter 'data' here
is_codefence(uint8_t *data, size_t size, struct buf *syntax)
                      ^
1 warning generated.
compiling rc_markdown.c
compiling rc_render.c
compiling stack.c
linking shared-object redcarpet.bundle
ld: library not found for -lgmp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [redcarpet.bundle] Error 1

make failed, exit code 2

In particular, the line ld: library not found for -lgmp seemed odd to me. I didn't think that GMP was a dependency, so I poked around in the ext/ directory and discovered that extconf added -lgmp to my cflags for some reason even though it's not mentioned in extconf.rb or anywhere.... Now that I've written this much, is this maybe an extconf bug? Not sure. I've already written this much already so....

@im-kulikov
Copy link

try this Homebrew/legacy-homebrew#20041 (comment)

Try brew uninstall gmp; brew install gmp and/or brew unlink gmp; brew link gmp.

@mstahl
Copy link
Author

mstahl commented Oct 27, 2015

That worked. Thanks!

@mstahl mstahl closed this as completed Oct 27, 2015
@im-kulikov
Copy link

well, fine 👍🏻

27 окт. 2015 г., в 5:17, max thom stahl notifications@github.com написал(а):

That worked. Thanks!


Reply to this email directly or view it on GitHub #523 (comment).

@robin850
Copy link
Collaborator

Hi!

Do you guys have this problem with installing 3.3.2 without gmp please ? This seems pretty strange that this problem is only spotted now!

@pex
Copy link

pex commented Oct 28, 2015

I ran into this same issue using

  • OS X 10.11.1
  • Ruby 2.2.3p173 (installed via Rbenv)
  • gmp-6.0.0a (installed via Homebrew)

Reinstalling gmp did not help.

@pex
Copy link

pex commented Oct 28, 2015

@robin850 I tried installing 3.3.2 as well and got the same error (if that was your question)

@pex
Copy link

pex commented Oct 28, 2015

Reinstalling Ruby worked for me.

@robin850
Copy link
Collaborator

Okay, I don't think this problem is related to Redcarpet ; this is certainly a larger problem with C extensions in general. I honestly don't know GMP at all but it is a required dependency for Ruby on my computer (running Arch Linux) so I think it's involved during the compilation process of native extensions.

Feel free to ask to reopen if I'm wrong, thanks for reporting everyone! :-)

@mstahl
Copy link
Author

mstahl commented Nov 7, 2015

Yeah I was suspicious about it actually because it's hard for me to believe that GMP is a dependency of Redcarpet. I'm not sure why you'd need arbitrary-precision math to parse markdown files. Was posting here thinking it might be something else. Thanks for responding so quickly!

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