新手问题 Mac 安装 pg gem 失败,提示 “make: /usr/local/Cellar/coreutils/8.30/bin/gmkdir: No such file or directory”。

chriszou · 2019年05月12日 · 最后由 jasl 回复于 2019年05月15日 · 406 次阅读

我本地是安装了coreutils 8.31的

$ ls /usr/local/Cellar/coreutils/
8.31

不知道为什么在编译native extension的时候,好像代码里面写死了8.30版本。 完整的错误提示:

$ gem install pg
Building native extensions. This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    current directory: /Users/chris/.rvm/gems/ruby-2.6.0/gems/pg-1.1.4/ext
/Users/chris/.rvm/rubies/ruby-2.6.0/bin/ruby -I /Users/chris/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0 -r ./siteconf20190512-93337-1jm5hew.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQsetSingleRowMode()... yes
checking for PQconninfo()... yes
checking for PQsslAttribute()... yes
checking for PQencryptPasswordConn()... yes
checking for timegm()... yes
checking for rb_gc_adjust_memory_usage()... yes
checking for PG_DIAG_TABLE_NAME in libpq-fe.h... yes
checking for unistd.h... yes
checking for inttypes.h... yes
checking for C99 variable length arrays... yes
creating extconf.h
creating Makefile

current directory: /Users/chris/.rvm/gems/ruby-2.6.0/gems/pg-1.1.4/ext
make "DESTDIR=" clean

current directory: /Users/chris/.rvm/gems/ruby-2.6.0/gems/pg-1.1.4/ext
make "DESTDIR="
compiling gvl_wrappers.c
compiling pg.c
compiling pg_binary_decoder.c
compiling pg_binary_encoder.c
compiling pg_coder.c
pg_coder.c:206:34: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        res = this->dec_func(this, val, RSTRING_LEN(argv[0]), tuple, field, ENCODING_GET(argv[0]));
              ~~~~                      ^~~~~~~~~~~~~~~~~~~~
/Users/chris/.rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/ruby/ruby.h:1000:6: note: expanded from macro 'RSTRING_LEN'
     RSTRING_EMBED_LEN(str) : \
     ^~~~~~~~~~~~~~~~~~~~~~
/Users/chris/.rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/ruby/ruby.h:996:6: note: expanded from macro 'RSTRING_EMBED_LEN'
     (long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_coder.c:206:34: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        res = this->dec_func(this, val, RSTRING_LEN(argv[0]), tuple, field, ENCODING_GET(argv[0]));
              ~~~~                      ^~~~~~~~~~~~~~~~~~~~
/Users/chris/.rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/ruby/ruby.h:1001:28: note: expanded from macro 'RSTRING_LEN'
     RSTRING(str)->as.heap.len)
     ~~~~~~~~~~~~~~~~~~~~~~^~~
2 warnings generated.
compiling pg_connection.c
compiling pg_copy_coder.c
pg_copy_coder.c:225:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                                        strlen = RSTRING_LEN(subint);
                                               ~ ^~~~~~~~~~~~~~~~~~~
/Users/chris/.rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/ruby/ruby.h:1000:6: note: expanded from macro 'RSTRING_LEN'
     RSTRING_EMBED_LEN(str) : \
     ^~~~~~~~~~~~~~~~~~~~~~
/Users/chris/.rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/ruby/ruby.h:996:6: note: expanded from macro 'RSTRING_EMBED_LEN'
     (long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_copy_coder.c:225:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                                        strlen = RSTRING_LEN(subint);
                                               ~ ^~~~~~~~~~~~~~~~~~~
/Users/chris/.rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/ruby/ruby.h:1001:28: note: expanded from macro 'RSTRING_LEN'
     RSTRING(str)->as.heap.len)
     ~~~~~~~~~~~~~~~~~~~~~~^~~
pg_copy_coder.c:531:23: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                input_len = end_ptr - start_ptr;
                          ~ ~~~~~~~~^~~~~~~~~~~
3 warnings generated.
compiling pg_errors.c
compiling pg_result.c
compiling pg_text_decoder.c
compiling pg_text_encoder.c
pg_text_encoder.c:170:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                        len = out - start;
                            ~ ~~~~^~~~~~~
pg_text_encoder.c:289:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                return optr - out;
                ~~~~~~ ~~~~~^~~~~
pg_text_encoder.c:293:12: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                return 2 + RSTRING_LEN(*intermediate) * 2;
                ~~~~~~ ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_text_encoder.c:500:13: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        nr_elems = RARRAY_LEN(value);
                 ~ ^~~~~~~~~~~~~~~~~
/Users/chris/.rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/ruby/ruby.h:1058:23: note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN(a) rb_array_len(a)
                      ^~~~~~~~~~~~~~~
4 warnings generated.
compiling pg_tuple.c
pg_tuple.c:475:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        num_fields = RARRAY_LEN(values);
                   ~ ^~~~~~~~~~~~~~~~~~
/Users/chris/.rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/ruby/ruby.h:1058:23: note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN(a) rb_array_len(a)
                      ^~~~~~~~~~~~~~~
1 warning generated.
compiling pg_type_map.c
compiling pg_type_map_all_strings.c
compiling pg_type_map_by_class.c
compiling pg_type_map_by_column.c
pg_type_map_by_column.c:161:52: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        return dec_func( p_coder, RSTRING_PTR(field_str), RSTRING_LEN(field_str), 0, fieldno, enc_idx );
               ~~~~~~~~                                   ^~~~~~~~~~~~~~~~~~~~~~
/Users/chris/.rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/ruby/ruby.h:1000:6: note: expanded from macro 'RSTRING_LEN'
     RSTRING_EMBED_LEN(str) : \
     ^~~~~~~~~~~~~~~~~~~~~~
/Users/chris/.rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/ruby/ruby.h:996:6: note: expanded from macro 'RSTRING_EMBED_LEN'
     (long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_type_map_by_column.c:161:52: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        return dec_func( p_coder, RSTRING_PTR(field_str), RSTRING_LEN(field_str), 0, fieldno, enc_idx );
               ~~~~~~~~                                   ^~~~~~~~~~~~~~~~~~~~~~
/Users/chris/.rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/ruby/ruby.h:1001:28: note: expanded from macro 'RSTRING_LEN'
     RSTRING(str)->as.heap.len)
     ~~~~~~~~~~~~~~~~~~~~~~^~~
pg_type_map_by_column.c:230:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        conv_ary_len = RARRAY_LEN(conv_ary);
                     ~ ^~~~~~~~~~~~~~~~~~~~
/Users/chris/.rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/ruby/ruby.h:1058:23: note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN(a) rb_array_len(a)
                      ^~~~~~~~~~~~~~~
3 warnings generated.
compiling pg_type_map_by_mri_type.c
compiling pg_type_map_by_oid.c
compiling pg_type_map_in_ruby.c
compiling util.c
util.c:119:24: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        return (char*)out_ptr - out;
        ~~~~~~ ~~~~~~~~~~~~~~~^~~~~
1 warning generated.
linking shared-object pg_ext.bundle

current directory: /Users/chris/.rvm/gems/ruby-2.6.0/gems/pg-1.1.4/ext
make "DESTDIR=" install
make: /usr/local/Cellar/coreutils/8.30/bin/gmkdir: No such file or directory
make: *** [.sitearchdir.time] Error 1

make install failed, exit code 2

Gem files will remain installed in /Users/chris/.rvm/gems/ruby-2.6.0/gems/pg-1.1.4 for inspection.
Results logged to /Users/chris/.rvm/gems/ruby-2.6.0/extensions/x86_64-darwin-18/2.6.0/pg-1.1.4/gem_make.out

共收到 1 条回复

brew install postgresql 装一下pg,那个gem要链接pg的驱动,就算是 Linux 环境也要装 libpq-dev 也就是 pg 的驱动软件包(Linux 的软件包粒度比 Homebrew 的要细)

装了pg也不用担心浪费资源,因为默认不会启动服务

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册