rmagick / rmagick

Ruby bindings for ImageMagick
https://rmagick.github.io/
MIT License
696 stars 140 forks source link

gem fails install, clang: error: unknown argument: '-multiply_definedsuppress' #59

Closed bf4 closed 8 years ago

bf4 commented 9 years ago

Issue by mattneub Tuesday Jan 21, 2014 at 04:07 GMT Originally opened as https://github.com/rmagick/rmagick/issues/96


Before we start, you might want to know my clang version:

gromit:~ mattneuburg$ clang --version
Apple LLVM version 5.1 (clang-503.0.9) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

Okay, here we go:

gromit:~ mattneuburg$ sudo gem install rmagick
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
[... pardon me for a skipping a whole bunch of "yes" answers here! ...]
creating extconf.h
creating Makefile

======================================================================
Mon 20Jan14 19:54:06
This installation of RMagick 2.13.2 is configured for
Ruby 2.0.0 (universal.x86_64-darwin13) and ImageMagick 6.8.7 Q16 
======================================================================

make "DESTDIR="
compiling rmagick.c
compiling rmdraw.c
rmdraw.c:315:15: warning: comparison of constant 100 with expression of type 'WeightType' is always true [-Wtautological-constant-out-of-range-compare]
        if (w < 100 || w > 900)
            ~ ^ ~~~
rmdraw.c:315:26: warning: comparison of constant 900 with expression of type 'WeightType' is always false [-Wtautological-constant-out-of-range-compare]
        if (w < 100 || w > 900)
                       ~ ^ ~~~
2 warnings generated.
compiling rmenum.c
rmenum.c:450:13: warning: 4 enumeration values not handled in switch: 'DivideSrcCompositeOp', 'MinusSrcCompositeOp', 'DarkenIntensityCompositeOp'... [-Wswitch]
    switch (op)
            ^
rmenum.c:565:13: warning: enumeration values 'LZMACompression', 'JBIG1Compression', and 'JBIG2Compression' not handled in switch [-Wswitch]
    switch (ct)
            ^
rmenum.c:674:12: warning: 9 enumeration values not handled in switch: 'SincFastFilter', 'LanczosSharpFilter', 'Lanczos2Filter'... [-Wswitch]
    switch(type)
           ^
rmenum.c:922:12: warning: 5 enumeration values not handled in switch: 'Average9InterpolatePixel', 'Average16InterpolatePixel', 'BlendInterpolatePixel'... [-Wswitch]
    switch(interpolate)
           ^
4 warnings generated.
compiling rmfill.c
compiling rmilist.c
rmilist.c:448:12: warning: 'MapImages' is deprecated [-Wdeprecated-declarations]
    (void) MapImages(new_images, map, dither);
           ^
/usr/local/Cellar/imagemagick/6.8.7-7/include/ImageMagick-6/magick/deprecate.h:203:3: note: 'MapImages' declared here
  MapImages(Image *,const Image *,const MagickBooleanType)
  ^
1 warning generated.
compiling rmimage.c
rmimage.c:8159:12: warning: 'MapImage' is deprecated [-Wdeprecated-declarations]
    (void) MapImage(new_image, map, dither);
           ^
/usr/local/Cellar/imagemagick/6.8.7-7/include/ImageMagick-6/magick/deprecate.h:201:3: note: 'MapImage' declared here
  MapImage(Image *,const Image *,const MagickBooleanType)
  ^
rmimage.c:10705:17: warning: 'RecolorImage' is deprecated [-Wdeprecated-declarations]
    new_image = RecolorImage(image, order, matrix, &exception);
                ^
/usr/local/Cellar/imagemagick/6.8.7-7/include/ImageMagick-6/magick/deprecate.h:143:4: note: 'RecolorImage' declared here
  *RecolorImage(const Image *,const size_t,const double *,ExceptionInfo *)
   ^
2 warnings generated.
compiling rminfo.c
compiling rmmain.c
compiling rmmontage.c
compiling rmpixel.c
compiling rmstruct.c
compiling rmutil.c
rmutil.c:1612:43: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
    rb_raise(Class_FatalImageMagickError, GetLocaleExceptionMessage(severity, reason));
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rmutil.c:1652:20: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
        rb_warning(msg);
                   ^~~
2 warnings generated.
linking shared-object RMagick2.bundle
clang: error: unknown argument: '-multiply_definedsuppress'
make: *** [RMagick2.bundle] Error 1
bf4 commented 9 years ago

Comment by dazzaroonie Monday Feb 10, 2014 at 07:35 GMT


I'm having the same problem. Did you ever resolve this?

bf4 commented 9 years ago

Comment by mattneub Monday Feb 10, 2014 at 16:27 GMT


I "resolved" it by giving up on rmagick. This gem has "unsupported" written all over it. It's easy enough, in ruby, to form and execute command-line commands to ImageMagick directly (though I suppose it is slower than using the C API as the gem does).

bf4 commented 9 years ago

Comment by dazzaroonie Tuesday Feb 11, 2014 at 19:58 GMT


There is that option! However, I found that if I installed ImageMagick and Phusion Passenger using home-brew (making sure that the correct Ruby was being pointed to by Passenger), rmagick finally worked. Crazy really and a few hours of time lost with no real understanding of why it didn't work before ... but my two-penneth above.

bf4 commented 9 years ago

Comment by mattneub Tuesday Feb 11, 2014 at 20:11 GMT


That's nuts. My ImageMagick installation was certainly done thru Homebrew. But what on earth is this supposed to have to do with Passenger? There is no web server in this story. I'm not using rails even. I'm not even interested yet in the question of whether the gem works. I'm just trying to get the gem to compile (install) in the first place.

bf4 commented 9 years ago

Comment by dazzaroonie Tuesday Feb 11, 2014 at 22:05 GMT


Passenger was just causing issues for me as well. But primarily due to rmagick not being able to find stuff. The only way I could solve it was using homebrew ... obviously my help wasn't much help ;)

bf4 commented 9 years ago

Comment by mattneub Thursday Feb 13, 2014 at 19:35 GMT


Okay, I solved this problem. @dazzaroonie I don't know if this will be useful to you. But the clang: error: unknown argument: '-multiply_definedsuppress' problem turns out to be due to my use of Xcode 5.1 beta.

The problem here turns out to be that a whole bunch of clang unknown argument warnings have now been turned into errors, as mentioned for example here: http://clang-developers.42468.n3.nabble.com/error-unknown-argument-ffoo-gt-reason-td4037260.html

Thus, unknown arguments that previously could slide by, can no longer slide by. So this still needs to be fixed in the rmagick build process. However, in the meantime, the solution is to revert to earlier clang. This is quite easy to do:

bf4 commented 9 years ago

Comment by mattneub Wednesday Feb 19, 2014 at 01:26 GMT


Here's an update on the change in clang that is preventing the gem from being installed.

I submitted a bug report to the clang people. They were very nice to me, but they were also very clear that this change is not going to be rolled back, and they closed the bug.

I also submitted a bug to Apple, against Xcode 5.1, on the grounds that it should not be adopting a version of clang that breaks the ability of existing packages (such as the rmagick gem) to build. They immediately closed my bug (radar number 16064551), again with a clear statement that this change is not going to be rolled back.

I am thus able to say with near certainty that unless changes are made in the clang build settings that are part of the rmagick gem, virtually no Mac OS X user will be able to install the rmagick gem after Xcode 5.1 goes final and is widely adopted.

bf4 commented 9 years ago

Comment by sharvilshah Wednesday Mar 12, 2014 at 06:19 GMT


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

bf4 commented 9 years ago

Comment by davidperrenoud Wednesday Mar 12, 2014 at 10:42 GMT


It should be obvious from the previous comment, but if you are using Bundler, you can use the following workaround in the meantime:

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future bundle install
bf4 commented 9 years ago

Comment by mattneub Wednesday Mar 12, 2014 at 16:12 GMT


This may or may not be relevant: see now also http://llvm.org/bugs/show_bug.cgi?id=18831#c6

According to that, the whole problem arises from a problem in the way Ruby 2.0 was built (by Apple!). Thus, in theory, by building a fresh copy of Ruby under the new version of Clang (in Xcdoe 5.1), and using that as one's Ruby, the problem should go away henceforth. But I have not tried it.

bf4 commented 9 years ago

Comment by paterson Friday Mar 14, 2014 at 18:46 GMT


@mattneub Indeed, this works nicely. Thanks for the heads up.

bf4 commented 9 years ago

Comment by mattneub Friday Mar 14, 2014 at 21:54 GMT


By the way, I submitted this idea as a new bug to Apple, i.e. their Mavericks system build of Ruby 2.0 is incompatible with Xcode 5.1 and should be rebuilt - and they immediately closed it as a duplicate, suggesting that they are aware this is an issue.

bf4 commented 9 years ago

Comment by paterson Saturday Mar 15, 2014 at 10:19 GMT


Great. I've looked into this a little more - this fixes any bundler issues, but doesn't fix issues with Rake. Makes sense really. I'm looking into it.

bf4 commented 9 years ago

Comment by AdamLenda Wednesday Apr 02, 2014 at 15:21 GMT


Thank to all of your for your efforts on this issue.