Cha*_*aka 7 ruby gem rails-postgresql ruby-datamapper heroku-postgres
我正在尝试构建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.
Run Code Online (Sandbox Code Playgroud)
安装pg postgresql并设置pg_config路径后安装工作
`bundle config build.pg --with-pg-config=/usr/local/Cellar/postgresql/9.3.1/bin/pg_config`
Run Code Online (Sandbox Code Playgroud)
我被绝对困惑的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
Run Code Online (Sandbox Code Playgroud)
我之前用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 */
Run Code Online (Sandbox Code Playgroud)
但...
这个
/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' ...
Run Code Online (Sandbox Code Playgroud)
找到pg_wchar.h !!!! 是啊!但等待有一个错误.
修好了
typedef uint32_t uint32; // added in pg_wchat.h
Run Code Online (Sandbox Code Playgroud)
但接下来是
/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);
Run Code Online (Sandbox Code Playgroud)
是的,我可以通过尝试修复它,但我不认为这是正确的方法
我完全不知道该往哪里去.所以,如果有人可以提供帮助,我会很感激.
ps:我正在使用mac os mavericks
我修好了这个。
我希望我能给出具体的步骤,但事情是这样的:
从苹果开发者网站手动更新命令行工具。
卸载所有宝石
使用brew安装了rbenv、ruby-build、rbenv-bundler
使用brew安装了apple-gcc42
使用 rbenv 安装 ruby 2.1
设置使用 rbenv 的 ruby 的路径。
放rbenv global 2.1.0
已卸载的捆绑包
已安装的捆绑包
跑rbenv rehash
跑sudo bundle install成功了。
| 归档时间: |
|
| 查看次数: |
1275 次 |
| 最近记录: |