我正在尝试构建 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.
安装pg
postgresql 并设置 pg_config 路径后安装工作
`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
如错误消息中所述 - “检查 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)'
typedef bool (*mbcharacter_incrementer) (unsigned char *mbstr, int len);
是的,我可以通过并尝试修复它,但我认为这不是正确的方法
我完全不知道该去哪里。因此,如果有人可以提供帮助,我将不胜感激。
ps:我用的是mac os mavericks