ruby – gem安装dm-postgres-adapter构建错误

前端之家收集整理的这篇文章主要介绍了ruby – gem安装dm-postgres-adapter构建错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试构建dm-postgres-adapter但是得到了这个错误.
sudo gem install dm-postgres-adapter

Building native extensions.  This could take a while...
ERROR:  Error installing dm-postgres-adapter:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for main() in -lpq... yes
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for postgres.h... yes
checking for mb/pg_wchar.h... no
*** 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.

在安装postgresql并设置pg_config路径后安装pg工作

`bundle config build.pg --with-pg-config=/usr/local/Cellar/postgresql/9.3.1/bin/pg_config`

我绝对困惑的是postgres.his发现,但不是pg_wchar.h,它位于同一目录/usr/local/Cellar/postgresql/9.3.1/include

设置配置选项没有帮助

--with-pgsql-server-include=/usr/local/Cellar/postgresql/9.3.1/include

我之前用macports postgresql试过这个.有完全相同的错误后我完全卸载了mac ports并用homebrew安装postgresql.我也试过postgresql包Postgres.app,但我总是得到这个错误.

正如我在安装pg(gem)之前所说的那样.

mkmf.log

错误消息中所述 – “检查mkmf.log文件获取更多详细信息.”

>好的,放手吧!

这对我来说绝对毫无意义.

conftest.c:5:57: error: use of undeclared identifier 'main'
int t(void) { void ((*volatile p)()); p = (void ((*)()))main; return 0; }

1 error generated.

checked program was:

/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: extern int t(void);
5: int t(void) { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
6: int main(int argc,char **argv)
7: {
8:   if (argc > 1000000) {
9:     printf("%p",&t);
10:   }
11:
12:   return 0;
13: }
/* end */

但…

这个

/usr/local/Cellar/postgresql/9.3.1/include/server/mb/pg_wchar.h:363:14: error: function         
cannot return function type 'int (unsigned char *,int)'
typedef bool (*mbcharacter_incrementer) (unsigned char *mbstr,int len);
              ^
/usr/local/Cellar/postgresql/9.3.1/include/server/mb/pg_wchar.h:388:2: error: unknown type     
name 'uint32'

... and lot of "unknown type name 'uint32' ...

“事情发生了可怕的错误

找到pg_wchar.h !!!!是啊!但等待有错误.

修好了

typedef uint32_t uint32; // added in pg_wchat.h

但接下来是

/usr/local/Cellar/postgresql/9.3.1/include/server/mb/pg_wchar.h:364:14: error: function     
cannot return function type 'int (unsigned char *,int len);

是的,我可以通过尝试修复它,但我不认为这是正确的方法

我完全不知道该往哪里去.所以,如果有人可以提供帮助,我会很感激.

ps:我正在使用mac os mavericks

解决方法

我修好了.

我希望我能给出确切的步骤,但它是这样的:

>从Apple开发者网站手动更新的命令行工具.>卸载所有宝石>使用brew安装rbenv,ruby-build,rbenv-bundler>使用brew安装apple-gcc42>使用rbenv安装ruby 2.1>设置路径以使用rbenv的ruby.>设置rbenv global 2.1.0>卸载捆绑>已安装的捆绑包>跑了rbenv rehash> Ran sudo bundle install成功.

猜你在找的Ruby相关文章