问题描述
sudo gem install dm-postgres-适配器
构建本机扩展。这可能需要一段时间...
错误:安装dm-postgres-adapter错误:
错误:无法构建gem本机扩展。
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
在-lpq中检查main()...是
检查libpq-fe.h ...是
检查libpq / libpq-fs.h ...是
检查postgres.h ...是
检查mb / pg_wchar.h ... no
*** extconf.rb失败***
由于某种原因无法创建Makefile,可能缺少必要的
库和/或头文件。检查mkmf.log文件以获取更多详细信息。您可能
需要配置选项。
安装 pg
安装postgresql并设置后pg_config path
`bundle config build.pg --with-pg-config = / usr / local / Cellar / postgresql / 9.3 .1 / bin / pg_config`
我非常困惑的是找到postgres.h
,但不是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端口并用自制软件安装了postgresql。我也试过postgresql包 Postgres.app
但我总是得到这个错误。
正如我在安装前所说pg(gem)有效。
mkmf.log
h2>
如错误信息中所述 - 检查mkmf.log文件以获取更多详细信息。
- 确定,放手!
这对我来说绝对没有意义。
conftest.c:5:57:错误:使用未声明的标识符'main'
int t(void){void((* volatile p)()) ; p =(void((*)()))main;返回0; }
1生成的错误。
检查程序是:
/ * begin * /
1:#includeruby.h
2:
3: / * top * /
4:extern int t(void);
5:int t(void){void((* volatile p)()); p =(void((*)()))main;返回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
无法返回函数类型'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:错误:未知类型
名称'uint32'
...和很多未知类型名称uint32'...
发生了可怕的错误
pg_wchar.h被发现!!!!是啊!但是等一下有错误。
使用
typedef uint32_t uint32; //添加在pg_wchat.h中
但是接下来是
/usr/local/Cellar/postgresql/9.3.1/include/server/mb/pg_wchar.h:364:14:error:function
can not return function type 'int(unsigned char *,int)'
typedef bool(* mbcharacter_incrementer)(unsigned char * mbstr,int len);
是的,我可以通过并试图解决它,但我不认为这是正确的方式。
我绝对不知道该往哪里走,所以如果有的话dy可以帮助我感激它。
ps:我正在使用mac os mavericks
我希望我可以给出确切的步骤,但它是这样的:
-
手动更新来自Apple开发者网站的命令行工具。
-
卸载所有宝石
-
使用brew安装rbenv,ruby-build,rbenv-bundler使用brew安装apple-gcc42使用rbenv安装ruby 2.1
使用rbenv的ruby设置路径 / b> -
设置
rbenv global 2.1.0
-
已卸载的软件包
-
已安装的软件包
-
> rbenv rehash
-
Ran
>sudo bundle install
已成功。
i'm trying to build dm-postgres-adapter but get this error.
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.
installing pg
worked after installing postgresql and setting pg_config path
`bundle config build.pg --with-pg-config=/usr/local/Cellar/postgresql/9.3.1/bin/pg_config`
what i am absolutly confused about is that postgres.h
is found, but not pg_wchar.h which is in the same directory /usr/local/Cellar/postgresql/9.3.1/include
setting configuration options doesnt help
--with-pgsql-server-include=/usr/local/Cellar/postgresql/9.3.1/include
i've tried this with macports postgresql before. after having the same error i've completly uninstalled mac ports and install postgresql with homebrew. I also tried the postgresql package Postgres.app
but i get always the this error.
as i said before installing pg (gem) worked.
mkmf.log
as said in error message - "Check the mkmf.log file for more details."
- ok, lets go!
this makes absolutely no sense to me.
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 */
but...
this one
/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' ...
"Something went horribly wrong"
pg_wchar.h is found!!!! yeah! but wait there is an error.
fixed it with
typedef uint32_t uint32; // added in pg_wchat.h
but then comes the next
/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)'
typedef bool (*mbcharacter_incrementer) (unsigned char *mbstr, int len);
yes, i could go this through and trying to fix it, but i don't think that this is the right way
i have absolutely no idea where to go on. So if somebody could help i would appreciate it.
ps: i am using mac os mavericks
I fixed this.
I wish I could give exact steps, but it was something like this:
Manually updated Command Line Tools from the apple developer site.
Uninstalled all gems
Installed rbenv, ruby-build, rbenv-bundler using brew
Installed apple-gcc42 using brew
Installed ruby 2.1 using rbenv
Set path to use rbenv's ruby.
Set
rbenv global 2.1.0
Uninstalled bundle
Installed bundle
ran
rbenv rehash
Ran
sudo bundle install
successfully.
这篇关于gem安装dm-postgres-adapter构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!