当我试图运行一个简单的代码

# A Postgres connection:
DataMapper.setup(:default, 'postgres://localhost/the_database_name')

在win7 x86-64计算机上,出现以下错误:
D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': 193: %1 n?est pas une application Win32 valide.   - D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/do_postgres-0.10.8-x86-mingw32/lib/do_postgres/1.9/do_postgres.so (LoadError)
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/do_postgres-0.10.8-x86-mingw32/lib/do_postgres.rb:30:in `rescue in <top (required)>'
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/do_postgres-0.10.8-x86-mingw32/lib/do_postgres.rb:25:in `<top (required)>'
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-postgres-adapter-1.2.0/lib/dm-postgres-adapter/adapter.rb:1:in `<top (required)>'
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-postgres-adapter-1.2.0/lib/dm-postgres-adapter.rb:1:in `<top (required)>'
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:163:in `load_adapter'
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:133:in `adapter_class'
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:13:in `new'
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core.rb:228:in `setup'
    from D:/dev/workspace/ruby/training/bin/pg/main.rb:8:in `<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'

我已经安装了每个gem依赖项和postgreSQL的二进制版本(在他们的站点上找到的一键安装程序)
我怀疑是x86-64体系结构导致了这个错误,因为在x86机器上同样的安装非常有效。
有什么想法?谢谢
注:这是this one之后的一个问题(没有得到真正的回答),但由于这个错误是另一个,我又问了一个新问题。

最佳答案

派对有点晚了,但如果有人在谷歌搜索后来到这里,我发现这是可行的:
将这些文件从Postgres安装目录复制到..\Ruby\bin:
lib\libpq.dll
bin\libeay32.dll
bin\libintl-8.dll
bin\libiconv-2.dll
bin\krb5_32.dll
bin\comerr32.dll文件
bin\k5sprt32.dll
bin\gssapi32.dll
有些可能已经存在,所以不需要重写。
路易斯·拉维纳的功劳:https://groups.google.com/forum/#!topic/datamapper/3fz5MeB-frM

关于ruby - 在AMD64上的ruby postgreSQL适配器,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9517394/

10-13 09:41