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

Can't install on OS X #357

Closed
Kapeli opened this issue Mar 12, 2014 · 7 comments
Closed

Can't install on OS X #357

Kapeli opened this issue Mar 12, 2014 · 7 comments

Comments

@Kapeli
Copy link

Kapeli commented Mar 12, 2014

Xcode 5.1 seems to have updated clang, which turned a bunch of previous warnings into errors.

Other gems seem to have this problem, like rmagick/rmagick#96.

This is the error I get:

~ » sudo gem install redcarpet
Fetching: redcarpet-3.1.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing redcarpet:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling autolink.c
compiling buffer.c
buffer.c:104: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) == 0) {
                                                   ^~~
buffer.c:53: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
compiling rc_markdown.c
compiling rc_render.c
compiling stack.c
linking shared-object redcarpet.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [redcarpet.bundle] Error 1

make failed, exit code 2
@sharvilshah
Copy link

From Apple's Xcode/Clang release notes:

The Apple LLVM compiler in Xcode 5.1 treats unrecognized command-line options as errors. This issue has been seen when building both Python native extensions and Ruby Gems, where some invalid compiler options are currently specified.
Projects using invalid compiler options will need to be changed to remove those options. To help ?ease that transition, the compiler will temporarily accept an option to downgrade the error to a warning:

-Wno-error=unused-command-line-argument-hard-error-in-future

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install GemName

@mattr-
Copy link
Collaborator

mattr- commented Mar 18, 2014

Thanks for reporting. I haven't upgraded XCode to 5.1 yet because of these issues, but I'll upgrade it and give it a try and see if we can't ship a new version that somehow works around this.

@robin850
Copy link
Collaborator

@mattr- : Maybe we can simply set the ARCHFLAGS as pointed by @sharvilshah if the current platform is OS X in the extconf.rb file:

ENV['ARCHFLAGS']= "-Wno-error=unused-command-line-argument-hard-error-in-future"

But I'm not sure that this will work and that this is our responsibility. Maybe we should mention it in the README until RubyGems workaround this or a new Ruby version is released, what do you think ?

Anyway, the problem has already been reported to the ruby tracker.

@mattr-
Copy link
Collaborator

mattr- commented Mar 19, 2014

that's what i was thinking in the short term. I love how Apple adding this in the latest version of XCode actually broke their own software. 😉

I'm hoping I can find some time to work on this stuff by the end of the week. so busy.

@benzado
Copy link

benzado commented Mar 31, 2014

I'm trying to install the gem and also encountering the error. I don't think unrecognized command line arguments are the problem. If you read the output @Kapeli posted, it is failing because of a type mismatch issue in buffer.c. If anything the warning to disable should be -Wno-incompatible-pointer-types-discards-qualifiers, however I think it would be better to simply fix the code by changing the type or inserting a cast.

@benzado
Copy link

benzado commented Mar 31, 2014

Oops, nevermind, I see both of them now.

@robin850
Copy link
Collaborator

Ok, I guess we can close this one. At least this is not really our call ; according to this comment, you should rebuild Ruby or install another version (let's say through Rbenv or Chruby for instance).

I guess the problem has been reported enough to let people know the workaround.

@mattr- : Feel free to reopen if you disagree.

Thank you guys! :-)

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

5 participants