Ruby on rails 钢轨s->;dyld:惰性符号绑定失败:找不到符号:\u rb\u intern2

Ruby on rails 钢轨s->;dyld:惰性符号绑定失败:找不到符号:\u rb\u intern2,ruby-on-rails,Ruby On Rails,所以rails s不能与rails generate一起工作。我以为问题出在heroku工具带上,所以我把它取了下来,但这并没有奏效。然后我检查了我的.zshrc文件,发现它在路径中调用了不同版本的ruby,所以我更新了它。然而,这并没有起作用。我没有主意了。有人能帮忙吗 #(05/06)/13@10:凌晨一时(admin@Administrators-MacBook Pro):~/desktop/scratch 轨道s dyld:惰性符号绑定失败:找不到符号:\u rb\u intern2 引

所以rails s不能与rails generate一起工作。我以为问题出在heroku工具带上,所以我把它取了下来,但这并没有奏效。然后我检查了我的.zshrc文件,发现它在路径中调用了不同版本的ruby,所以我更新了它。然而,这并没有起作用。我没有主意了。有人能帮忙吗

#(05/06)/13@10:凌晨一时(admin@Administrators-MacBook Pro):~/desktop/scratch 轨道s dyld:惰性符号绑定失败:找不到符号:\u rb\u intern2 引用自:/Users/admin/.rvm/gems/ruby-1.9.3-p392/gems/sqlite3-1.3.7/lib/sqlite3/sqlite3_native.bundle 应为:平面命名空间

dyld: Symbol not found: _rb_intern2
  Referenced from: /Users/admin/.rvm/gems/ruby-1.9.3-p392/gems/sqlite3-1.3.7/lib/sqlite3/sqlite3_native.bundle
  Expected in: flat namespace

[1]    69741 trace trap  rails s
#(05/06)/13@10:凌晨2时(admin@Administrators-MacBook Pro):~/desktop/scratch rvm列表默认值

Default Ruby (for new shells)

   ruby-1.9.3-p392 [ x86_64 ]
#(05/06)/13@10:上午11时(admin@Administrators-MacBook Pro):~/desktop/scratch ruby-v

ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
Rails 3.2.12
#(05/06)/13@10:上午11时(admin@Administrators-MacBook Pro):~/desktop/scratch 轨道-v

ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
Rails 3.2.12
gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.12'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'
# gem 'pg'
gem "bootstrap-sass", ">= 2.3.0.0"

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="junkfood"

# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"

# Comment this out to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"

# Uncomment to change how many often would you like to wait before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13

# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"

# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git)

source $ZSH/oh-my-zsh.sh

# Customize to your needs...
export PATH=//opt/local/bin:/opt/local/sbin://usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/opt/local/bin:/opt/local/sbin:/Users/admin/.rvm/gems/ruby-1.9.3-p392/bin:/Users/admin/.rvm/gems/ruby-1.9.3-p392@global/bin:/Users/admin/.rvm/rubies/ruby-1.9.3-p392/bin:/Users/admin/.rvm/bin:/usr/local/mysql/bin:/Users/admin/.rvm/bin

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
.zshrc文件:

source 'https://rubygems.org'

gem 'rails', '3.2.12'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'
# gem 'pg'
gem "bootstrap-sass", ">= 2.3.0.0"

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="junkfood"

# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"

# Comment this out to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"

# Uncomment to change how many often would you like to wait before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13

# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"

# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git)

source $ZSH/oh-my-zsh.sh

# Customize to your needs...
export PATH=//opt/local/bin:/opt/local/sbin://usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/opt/local/bin:/opt/local/sbin:/Users/admin/.rvm/gems/ruby-1.9.3-p392/bin:/Users/admin/.rvm/gems/ruby-1.9.3-p392@global/bin:/Users/admin/.rvm/rubies/ruby-1.9.3-p392/bin:/Users/admin/.rvm/bin:/usr/local/mysql/bin:/Users/admin/.rvm/bin

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

如果您使用rvm,应该让它将其路径添加到$PATH,而不是自己添加。事实上,看起来您使用了rvm的一半:您正在选择为安装了rvm的ruby安装的gems,但是由于rvm ruby路径位于$PATH的末尾,因此运行
ruby
的ruby正在选择通过其他方法安装的ruby(可能是系统提供的方法)


因此,ruby 1.8.7试图加载为ruby 1.9.3编译的扩展,但该扩展不起作用

Symbol not found: {some-symbol}
Referenced from: /path/to/some/file.bundle
Expected in: flat namespace
似乎有很多宝石

潜在的问题似乎是不兼容的C扩展库(在上面的例子中是sqlite3_native.bundle)。无论出于什么原因,gem似乎是为一个较旧版本的ruby安装的,而当前的ruby版本没有扩展库所寻找的导出C方法

有两种方法可以解决这个问题

  • 卸载并重新安装该软件包(正如Shawn Balestracci在上面的评论中指出的)。在上述情况下,我们可以推断包是sqlite3:

    gem卸载{package};gem安装{package}

或者(不太可取,但如果上述方法因某种原因失败,则可能有用):

  • 删除捆绑包文件并重新安装软件包。查看错误消息: 引用自:/Users/admin/.rvm/gems/ruby-1.9.3-p392/gems/sqlite3-1.3.7/lib/sqlite3/sqlite3_native.bundle,我们只需要:

    rm{捆绑文件的路径};gem安装{package}


更改C编译器对我很有用。我收到了其中一个关于gpgme gem的错误。我的gcc二进制文件指向我安装的gcc-4.9.2的安装。我将此更改为在Mac OS 10.10(Yosemite)上使用本机clang编译器,在卸载并重新安装gem后,rails服务器工作正常。

我在尝试运行
rails服务器时遇到了这个错误,但是,当我运行bundle exec rails server时,没有出现错误。

这是Ruby安装的问题,而不是实际页面的问题。我是如何解决的:

我在用RVM。首先,我将Ruby从2.1.1更新为2.2:

rvm install 2.2
rvm use 2.2
现在您必须重新安装所有gems:

gem install bundler
bundle install
下一次更新nginx.conf:

passenger_root /usr/local/opt/passenger/libexec/src/ruby_supportlib/phusion_passenger/locations.ini;
    passenger_ruby /Users/admin/.rvm/gems/ruby-2.2.4/wrappers/ruby;
您的这些值可能不同


然后重新启动Nginx。错误消失。

尝试重新加载rvm。然后尝试gem卸载sqlite3和gem安装sqlite3omfg!!!成功了!!!!非常感谢你,肖恩。如果可能的话,你能解释一下它为什么会起作用吗?rvm重新加载让你脱离了1/21.8.7/1.9.3状态(见张弗雷德里克的回答)。我不确定这是否损坏了sqlite3 gem安装,所以我让你重新安装它(这是给你带来错误的原因)。我最终再次收到错误,但我重新加载了rvm,之后效果很好。删除捆绑文件并重新安装包对我有帮助。非常感谢!我使用的外部gem(gemfile中的路径)是用不同版本的ruby编译的。这让我意识到了这一点。