복붙노트

[RUBY-ON-RAILS] 우분투에 레일을 설치하는 보석을 사용하는 방법

RUBY-ON-RAILS

우분투에 레일을 설치하는 보석을 사용하는 방법

오류 메시지 :

Building native extensions.  This could take a while...
ERROR:  Error installing rails:
  ERROR: Failed to build gem native extension.

    /usr/bin/ruby2.1 -r ./siteconf20150328-1540-hff2f0.rb extconf.rb
checking if the C compiler accepts ... *** 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
  --without-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=/usr/bin/ruby2.1
  --help
  --clean
/usr/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
  from /usr/lib/ruby/2.1.0/mkmf.rb:571:in `block in try_compile'
  from /usr/lib/ruby/2.1.0/mkmf.rb:522:in `with_werror'
  from /usr/lib/ruby/2.1.0/mkmf.rb:571:in `try_compile'
  from extconf.rb:80:in `nokogiri_try_compile'
  from extconf.rb:87:in `block in add_cflags'
  from /usr/lib/ruby/2.1.0/mkmf.rb:621:in `with_cflags'
  from extconf.rb:86:in `add_cflags'
  from extconf.rb:337:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.1.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/nokogiri-1.6.6.2/gem_make.out

구성 :

해결법

  1. ==============================

    1.우분투 14.04에 레일 4.2.4로 업그레이드 한 후 사용 RVM 나는이 작업을 수행하는 데 필요한 :

    우분투 14.04에 레일 4.2.4로 업그레이드 한 후 사용 RVM 나는이 작업을 수행하는 데 필요한 :

    sudo apt-get install libgmp-dev
    

    또는

    sudo apt-get install libgmp3-dev
    

    전체 스택 트레이스 : http://ruby-on-rails-eq8.blogspot.co.uk/2015/10/solving-ubuntu-1404-ruby-c-dependancy.html

  2. ==============================

    2.당신은 몇 가지 루비 요구 사항을 누락 될 것으로 보인다. 당신이 RVM을 사용하는 경우, 시도 :

    당신은 몇 가지 루비 요구 사항을 누락 될 것으로 보인다. 당신이 RVM을 사용하는 경우, 시도 :

    rvm requirements
    

    종속성 목록을 얻고 수동으로 설치합니다.

    그렇지 않으면 사용하여 직접 알려진 기본 요구 사항을 설치합니다 :

    sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev autoconf libc6-dev ncurses-dev automake libtool
    
  3. ==============================

    3.루비의 개발 의존성이 없기 때문에이 오류가 발생합니다.

    루비의 개발 의존성이 없기 때문에이 오류가 발생합니다.

    난 당신이 설치하고이 문제를 해결하기 위해 RVM을 사용, 여기에 https://rvm.io/rvm/install 공식 업데이트 지침을 확인하는 것이 좋습니다

    당시 나는 다음 단계를 따라이 질문에 대답 할 때 :

    gpg --keyserver hkp://keys.gnupg.net --recv-keys
    409B6B1796C275462A1703113804BB82D39DC0E3
    
    \curl -sSL https://get.rvm.io | bash
    

    이 경고를받을 경우

      * WARNING: You have '~/.profile' file, you might want to load it,
        to do that add the following line to '/home/mao/.bash_profile':
    
      source ~/.profile
    

    이 명령을 실행 :

    echo source ~/.profile >> ~/.bash_profile
    

    그런 다음, 다시로드는 / 당신은 그냥이를 실행하여 업데이트하는 bash_profile을 적용

    source ~/.bash_profile
    

    마지막으로 요구 사항을 설치하려면이 실행 :

    rvm requirements
    

    이것은 우분투, 페도라, 데비안, 레드햇, 슬랙웨어 등의 리눅스 배포판에 대해 작동합니다.

  4. ==============================

    4.CentOS의 7의 7 레드햇 :

    CentOS의 7의 7 레드햇 :

    yum -y install gcc ruby-dev
    
  5. from https://stackoverflow.com/questions/29317640/how-to-use-gem-to-install-rails-on-ubuntu by cc-by-sa and MIT license