JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-6199

JRuby is hardcoded to use '-mmacos-version-min=10.4' which is not compatible with '-rpath' being used

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6.5
    • Fix Version/s: JRuby 1.6.6, JRuby 1.7.0.pre1
    • Component/s: C Extensions
    • Labels:
      None
    • Environment:
    • Number of attachments :
      0

      Description

      I installed JRuby 1.6.5 using rvm and then tried to do 'gem install mysql2'. Unfortunately as I'm running an up-to-date XCode the native extension cannot be built because of '-rpath' being used. The full output is included after this description.

      The problem is due to '-mmacos-version-min=10.4' being set in the JRuby source code. I've forked the git repo and submitted a pull request (https://github.com/jruby/jruby/pull/98) that simply updates the value of this to 10.5. I have compiled JRuby using this change and managed to install the mysql2 gem with it. It might not be the ideal solution but it certainly solves this problem.

      The full error from 'gem install mysql2':

      Building native extensions.  This could take a while...
      ERROR:  Error installing mysql2:
      	ERROR: Failed to build gem native extension.
      
              /Users/matt/.rvm/rubies/jruby-1.6.5/bin/jruby extconf.rb
      WARNING: JRuby does not support native extensions or the `mkmf' library very well.
      Check http://kenai.com/projects/jruby/pages/Home for alternatives.
      checking for rb_thread_blocking_region()... checking for rb_wait_for_single_fd()... no
      checking for mysql.h... yes
      checking for errmsg.h... yes
      checking for mysqld_error.h... yes
      creating Makefile
      
      make
      cc -I. -I. -I/Users/matt/.rvm/rubies/jruby-1.6.5/lib/native/include/ruby -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE        -I/usr/local/mysql/include  -Os -g -fno-common -fno-strict-aliasing -arch x86_64 -fPIC -DTARGET_RT_MAC_CFM=0  -fno-omit-frame-pointer -fno-strict-aliasing  -fexceptions   -Wall -funroll-loops  -arch x86_64 -c client.c
      cc -I. -I. -I/Users/matt/.rvm/rubies/jruby-1.6.5/lib/native/include/ruby -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE        -I/usr/local/mysql/include  -Os -g -fno-common -fno-strict-aliasing -arch x86_64 -fPIC -DTARGET_RT_MAC_CFM=0  -fno-omit-frame-pointer -fno-strict-aliasing  -fexceptions   -Wall -funroll-loops  -arch x86_64 -c mysql2_ext.c
      cc -I. -I. -I/Users/matt/.rvm/rubies/jruby-1.6.5/lib/native/include/ruby -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE        -I/usr/local/mysql/include  -Os -g -fno-common -fno-strict-aliasing -arch x86_64 -fPIC -DTARGET_RT_MAC_CFM=0  -fno-omit-frame-pointer -fno-strict-aliasing  -fexceptions   -Wall -funroll-loops  -arch x86_64 -c result.c
      cc -dynamic -bundle -undefined dynamic_lookup  -o mysql2.bundle client.o mysql2_ext.o result.o -L"." -L"/Users/matt/.rvm/rubies/jruby-1.6.5/lib" -bundle -framework JavaVM -Wl,-syslibroot, -mmacosx-version-min=10.4  -Wl,-rpath,/usr/local/mysql/lib  -arch x86_64  -L/usr/local/mysql/lib -lmysqlclient_r   -lpthread   
      ld: -rpath can only be used when targeting Mac OS X 10.5 or later
      collect2: ld returned 1 exit status
      make: *** [mysql2.bundle] Error 1
      
      
      Gem files will remain installed in /Users/matt/.rvm/gems/jruby-1.6.5/gems/mysql2-0.3.8 for inspection.
      Results logged to /Users/matt/.rvm/gems/jruby-1.6.5/gems/mysql2-0.3.8/ext/mysql2/gem_make.out
      

        Activity

        Hide
        Hiro Asari added a comment - - edited

        For one thing, you shouldn't use mysql2 gem. If you need database connections, you should try jdbc-mysql. (And if you need it for ActiveRecord, activerecord-jdbcmysql-adapter.)

        For another, it might be better to have a more general solution, where these flags can be overridden. Namely, we should perhaps look at environment variables instead of hardcoding them.

        Show
        Hiro Asari added a comment - - edited For one thing, you shouldn't use mysql2 gem. If you need database connections, you should try jdbc-mysql . (And if you need it for ActiveRecord, activerecord-jdbcmysql-adapter .) For another, it might be better to have a more general solution, where these flags can be overridden. Namely, we should perhaps look at environment variables instead of hardcoding them.
        Hide
        Hiro Asari added a comment -

        I pushed a more general fix for this issue to master and the 1.6 branch, where environment variables, if set, can override values in RbConfig::MAKEFILE_CONFIG.

        However, maybe I should revert this... MRI ignores environment variables. Comments are welcome.

        Show
        Hiro Asari added a comment - I pushed a more general fix for this issue to master and the 1.6 branch, where environment variables, if set, can override values in RbConfig::MAKEFILE_CONFIG . However, maybe I should revert this... MRI ignores environment variables. Comments are welcome.
        Hide
        Hiro Asari added a comment -

        Reverted the commit on the 1.6 branch, since MRI doesn't allow it.

        This requires further discussion on the master.

        Show
        Hiro Asari added a comment - Reverted the commit on the 1.6 branch, since MRI doesn't allow it. This requires further discussion on the master.
        Hide
        Hiro Asari added a comment -

        Upon further consideration, I merged this to the master (a71fafd) and the 1.6 branch (f9e5bcd).

        The general behavior that I wanted is unnecessary.

        Show
        Hiro Asari added a comment - Upon further consideration, I merged this to the master (a71fafd) and the 1.6 branch (f9e5bcd). The general behavior that I wanted is unnecessary.

          People

          • Assignee:
            Hiro Asari
            Reporter:
            Matthew Denner
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: