【问题标题】:Why is there a "no such file or directory" error when the .so file does exist?当.so文件确实存在时,为什么会出现“没有这样的文件或目录”错误?
【发布时间】:2010-10-26 09:55:41
【问题描述】:

我正在尝试从 RHEL 5 上的 Ruby 1.8.7 连接到 MS SQL Server。我正在使用FreeTDStiny_tds RubyGem。

我让它在 OS X 上运行良好。

在 Linux 上我安装了 FreeTDS 并确认它可以从命令行连接到 SQL Server 没有问题。 gem install tiny_tds 一切顺利。

但是,当我部署到 Linux 并尝试打开 Rails 控制台时,我收到此错误:

$ script/console production
Loading production environment (Rails 2.3.5)
libsybdb.so.5: cannot open shared object file: No such file or directory - /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/tiny_tds-0.2.1/lib/tiny_tds/tiny_tds.so
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/tiny_tds-0.2.1/lib/tiny_tds/tiny_tds.so
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/opt/deployed_rails_apps/employeedata/releases/20101025214030/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/tiny_tds-0.2.1/lib/tiny_tds.rb:7
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'

etc...

我检查了这个它说它找不到的文件确实存在于文件系统上......

/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems \
    /tiny_tds-0.2.1/lib/tiny_tds/tiny_tds.so

任何想法如何让它工作?

【问题讨论】:

  • 疯狂猜测,但你确定它不是指向不存在的东西的符号链接吗?
  • 不是符号链接。 tiny_tds.so 文件位于预期位置。

标签: ruby-on-rails sql-server ruby freetds


【解决方案1】:

您是如何从源代码或发行版安装 FreeTDS 的?我发现很多基于分发的安装不会安装所需的头文件和开发文件,gem 使用它们来定位所需的库。如果您使用发行版,您可能会寻找 freetds-dev 或类似的东西,并安装它。

发行版安装也有可能文件未安装在与源安装相同的目录中。我已经用不同的软件包遇到过几次。 Tiny TDS gem 可能有一些配置选项,可以让您定义 FreeTDS 文件的隐藏位置。

tiny_tds 的 extconf.rb 文件正在寻找这些文件:

FREETDS_LIBRARIES = ['sybdb']
FREETDS_HEADERS = ['sqlfront.h', 'sybdb.h', 'syberror.h']

在您的主机上进行定位或查找以查看是否可以找到这些文件。根据 extconf.rb,库应基于 /lib/lib/freetds,并且标头应位于 /include/include/freetds

【讨论】:

  • 谢谢。我是从源代码构建的。
  • 我经常这样做。发行版很好,但是当您尝试构建它们时经常会混淆问题,然后我花了几个小时试图弄清楚如何挽救东西,最终要么添加 -dev 东西,要么全部卸载并使用源代码。跨度>
猜你喜欢
  • 1970-01-01
  • 2015-11-05
  • 1970-01-01
  • 2020-08-22
  • 1970-01-01
  • 1970-01-01
  • 2021-08-29
  • 2019-11-03
  • 2010-12-18
相关资源
最近更新 更多