Antonio Antonio - 3 months ago 136
Ruby Question

Bundle install results in: Gem::Ext::BuildError: ERROR: Failed to build gem native extension. ... make install failed, exit code 2

El Capitan 10.11.6

Ruby version 2.2.5

Trying to get a companies repo working on my development environment. I cloned the repo and

cd
ed into it and installed Ruby 2.2.5 using RVM (as per the
.ruby_version
file the company has in the repo). I first did
gem install bundler
then did a simple
bundle
command and this is my output.

JONDOE-MacBook-Pro:project_repo Doe$ bundle
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Using rake 11.2.2
Using aasm 4.11.0
Using i18n 0.7.0
Installing json 1.8.3 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/Doe/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160804-32763-19yidxi.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
linking shared-object json/ext/generator.bundle
ld: warning: directory not found for option '-L/Users/travis/.sm/pkg/active/lib'

make "DESTDIR=" install
make: /usr/local/bin/gmkdir: No such file or directory
make: *** [.RUBYARCHDIR.-.json.-.ext.time] Error 1

make install failed, exit code 2

Gem files will remain installed in /Users/Doe/.rvm/gems/ruby-2.2.5/gems/json-1.8.3 for inspection.
Results logged to /Users/Doe/.rvm/gems/ruby-2.2.5/extensions/x86_64-darwin-15/2.2.0-static/json-1.8.3/gem_make.out
Using minitest 5.9.0
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using pkg-config 1.1.7
Using rack 1.6.4
Using mime-types 2.99.2
Using arel 6.0.3
Using bundler 1.12.5
Using thor 0.19.1
Using concurrent-ruby 1.0.2
Using request_store 1.3.1
Using addressable 2.3.8
Using execjs 2.7.0
Using sass 3.4.22
Using normalize-rails 3.0.3
Using tilt 2.0.5
Using selectize-rails 0.12.2
Using american_date 1.1.1
Using ansi 1.5.0
Using ast 2.3.0
Using attribute_normalizer 1.2.0
Using awesome_print 1.7.0
Using json_pure 2.0.1
Using ice_nine 0.11.2
Installing bcrypt 3.1.11 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/Doe/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160804-32763-1fppkmh.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling bcrypt_ext.c
compiling crypt.c
compiling crypt_blowfish.c
compiling crypt_gensalt.c
compiling wrapper.c
linking shared-object bcrypt_ext.bundle
ld: warning: directory not found for option '-L/Users/travis/.sm/pkg/active/lib'

make "DESTDIR=" install
make: /usr/local/bin/gmkdir: No such file or directory
make: *** [.RUBYARCHDIR.time] Error 1

make install failed, exit code 2

Gem files will remain installed in /Users/Doe/.rvm/gems/ruby-2.2.5/gems/bcrypt-3.1.11 for inspection.
Results logged to /Users/Doe/.rvm/gems/ruby-2.2.5/extensions/x86_64-darwin-15/2.2.0-static/bcrypt-3.1.11/gem_make.out
Using coderay 1.1.1
Installing debug_inspector 0.0.2 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/Doe/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160804-32763-7xzs3j.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling debug_inspector.c
linking shared-object debug_inspector.bundle
ld: warning: directory not found for option '-L/Users/travis/.sm/pkg/active/lib'

make "DESTDIR=" install
make: /usr/local/bin/gmkdir: No such file or directory
make: *** [.RUBYARCHDIR.time] Error 1

make install failed, exit code 2

Gem files will remain installed in /Users/Doe/.rvm/gems/ruby-2.2.5/gems/debug_inspector-0.0.2 for inspection.
Results logged to /Users/Doe/.rvm/gems/ruby-2.2.5/extensions/x86_64-darwin-15/2.2.0-static/debug_inspector-0.0.2/gem_make.out
Using brakeman 3.3.2
Using uniform_notifier 1.10.0
Installing byebug 9.0.5 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/Doe/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160804-32763-1f0rueg.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling breakpoint.c
compiling byebug.c
compiling context.c
compiling locker.c
compiling threads.c
linking shared-object byebug/byebug.bundle
ld: warning: directory not found for option '-L/Users/travis/.sm/pkg/active/lib'

make "DESTDIR=" install
make: /usr/local/bin/gmkdir: No such file or directory
make: *** [.RUBYARCHDIR.-.byebug.time] Error 1

make install failed, exit code 2

Gem files will remain installed in /Users/Doe/.rvm/gems/ruby-2.2.5/gems/byebug-9.0.5 for inspection.
Results logged to /Users/Doe/.rvm/gems/ruby-2.2.5/extensions/x86_64-darwin-15/2.2.0-static/byebug-9.0.5/gem_make.out
Using cancancan 1.15.0
Using multi_json 1.12.1
Using multipart-post 2.0.0
Using choice 0.2.0
Using coffee-script-source 1.10.0
Using chunky_png 1.3.6
Using cliver 0.3.2
Using cocoon 1.2.9
Using docile 1.1.5
Using simplecov-html 0.10.0
Using ruby-rc4 0.1.5
Using connection_pool 2.2.0
Using safe_yaml 1.0.4
Using database_cleaner 1.5.3
Using decent_exposure 2.3.3
Using deep_merge 1.0.1
Using mimemagic 0.3.1
Using orm_adapter 0.5.0
Using diff-lcs 1.2.5
Installing unf_ext 0.0.7.2 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/Doe/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160804-32763-1lhzmsy.rb extconf.rb
checking for main() in -lstdc++... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling unf.cc
linking shared-object unf_ext.bundle
ld: warning: directory not found for option '-L/Users/travis/.sm/pkg/active/lib'

make "DESTDIR=" install
make: /usr/local/bin/gmkdir: No such file or directory
make: *** [.RUBYARCHDIR.time] Error 1

make install failed, exit code 2

Gem files will remain installed in /Users/Doe/.rvm/gems/ruby-2.2.5/gems/unf_ext-0.0.7.2 for inspection.
Results logged to /Users/Doe/.rvm/gems/ruby-2.2.5/extensions/x86_64-darwin-15/2.2.0-static/unf_ext-0.0.7.2/gem_make.out
Using dotenv 2.1.1
Using thread 0.2.2
Using rubyzip 1.2.0
Using table_print 1.5.6
Installing ruby-prof 0.15.9 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/Doe/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160804-32763-167f4f5.rb extconf.rb
checking for rb_gc_stat()... yes
checking for rb_gc_count()... yes
checking for rb_os_allocated_objects()... no
checking for rb_gc_allocated_size()... no
checking for rb_gc_collections()... no
checking for rb_gc_time()... no
checking for rb_gc_total_time()... no
checking for rb_gc_total_mallocs()... no
checking for rb_gc_total_malloced_bytes()... no
checking for rb_heap_total_mem()... no
checking for rb_gc_heap_info()... no
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling rp_call_info.c
compiling rp_measure.c
compiling rp_measure_allocations.c
compiling rp_measure_cpu_time.c
compiling rp_measure_gc_runs.c
compiling rp_measure_gc_time.c
compiling rp_measure_memory.c
compiling rp_measure_process_time.c
compiling rp_measure_wall_time.c
compiling rp_method.c
compiling rp_stack.c
compiling rp_thread.c
compiling ruby_prof.c
linking shared-object ruby_prof.bundle
ld: warning: directory not found for option '-L/Users/travis/.sm/pkg/active/lib'

make "DESTDIR=" install
make: /usr/local/bin/gmkdir: No such file or directory
make: *** [.RUBYARCHDIR.time] Error 1

make install failed, exit code 2

Gem files will remain installed in /Users/Doe/.rvm/gems/ruby-2.2.5/gems/ruby-prof-0.15.9 for inspection.
Results logged to /Users/Doe/.rvm/gems/ruby-2.2.5/extensions/x86_64-darwin-15/2.2.0-static/ruby-prof-0.15.9/gem_make.out
Using enum_help 0.0.15
Using equalizer 0.0.11
Using error_page_assets 0.4
Installing ffi 1.9.10 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/Doe/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160804-32763-1asj1a5.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... yes
checking for ffi_call() in -lffi... yes
checking for ffi_prep_closure()... yes
checking for ffi_raw_call()... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
checking for ffi_prep_cif_var()... no
creating extconf.h
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling AbstractMemory.c
compiling ArrayType.c
compiling Buffer.c
compiling Call.c
Call.c:368:5: warning: implicit declaration of function 'rb_thread_call_without_gvl' is invalid in C99 [-Wimplicit-function-declaration]
rbffi_thread_blocking_region(call_blocking_function, data, (void *) -1, NULL);
^
./Thread.h:78:39: note: expanded from macro 'rbffi_thread_blocking_region'
# define rbffi_thread_blocking_region rb_thread_call_without_gvl
^
1 warning generated.
compiling ClosurePool.c
compiling DataConverter.c
compiling DynamicLibrary.c
compiling ffi.c
compiling Function.c
Function.c:563:9: warning: implicit declaration of function 'rb_thread_call_without_gvl' is invalid in C99 [-Wimplicit-function-declaration]
rb_thread_call_without_gvl(async_cb_wait, &w, async_cb_stop, &w);
^
1 warning generated.
compiling FunctionInfo.c
compiling LastError.c
compiling LongDouble.c
compiling MappedType.c
compiling MemoryPointer.c
compiling MethodHandle.c
compiling Platform.c
compiling Pointer.c
compiling Struct.c
compiling StructByReference.c
compiling StructByValue.c
compiling StructLayout.c
compiling Thread.c
compiling Type.c
compiling Types.c
compiling Variadic.c
linking shared-object ffi_c.bundle
ld: warning: directory not found for option '-L/Users/travis/.sm/pkg/active/lib'

make "DESTDIR=" install
make: /usr/local/bin/gmkdir: No such file or directory
make: *** [.RUBYARCHDIR.time] Error 1

make install failed, exit code 2

Gem files will remain installed in /Users/Doe/.rvm/gems/ruby-2.2.5/gems/ffi-1.9.10 for inspection.
Results logged to /Users/Doe/.rvm/gems/ruby-2.2.5/extensions/x86_64-darwin-15/2.2.0-static/ffi-1.9.10/gem_make.out
Using flamegraph 0.9.5
Using formatador 0.2.5
Using rspec-support 3.5.0
Using ruby-progressbar 1.8.1
Using geocoder 1.3.7
Using gli 2.14.0
Using rb-fsevent 0.9.7
Using ruby_dep 1.3.1
Using lumberjack 1.0.10
Using nenv 0.3.0
Using shellany 0.0.1
Using method_source 0.8.2
Using slop 3.6.0
Using guard-compat 1.2.1
Using powerpack 0.1.1
Using rainbow 2.1.0
Using unicode-display_width 1.1.0
Using redis 3.3.0
Using hashdiff 0.3.0
Using highline 1.7.8
Using multi_xml 0.5.5
Using tins 1.6.0
Using terminal-table 1.6.0
Using turbolinks-source 5.0.0
Using netrc 0.11.0
Using ya2yaml 0.31
Using net-http-persistent 2.9.4
Using newrelic_rpm 3.16.0.318
Using pdf-core 0.4.0
Installing pg 0.18.4 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/Doe/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160804-32763-1itcpq8.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 PQconnectionUsedPassword()... yes
checking for PQisthreadsafe()... yes
checking for PQprepare()... yes
checking for PQexecParams()... yes
checking for PQescapeString()... yes
checking for PQescapeStringConn()... yes
checking for PQescapeLiteral()... yes
checking for PQescapeIdentifier()... yes
checking for PQgetCancel()... yes
checking for lo_create()... yes
checking for pg_encoding_to_char()... yes
checking for pg_char_to_encoding()... yes
checking for PQsetClientEncoding()... yes
checking for PQlibVersion()... yes
checking for PQping()... yes
checking for PQsetSingleRowMode()... yes
checking for PQconninfo()... yes
checking for rb_encdb_alias()... yes
checking for rb_enc_alias()... yes
checking for rb_thread_call_without_gvl()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_fd_select()... yes
checking for rb_w32_wrap_io_handle()... no
checking for rb_str_modify_expand()... yes
checking for rb_hash_dup()... yes
checking for PGRES_COPY_BOTH in libpq-fe.h... yes
checking for PGRES_SINGLE_TUPLE in libpq-fe.h... yes
checking for PG_DIAG_TABLE_NAME in libpq-fe.h... yes
checking for struct pgNotify.extra in libpq-fe.h... yes
checking for unistd.h... yes
checking for inttypes.h... yes
checking for ruby/st.h... yes
checking for C99 variable length arrays... yes
creating extconf.h
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling gvl_wrappers.c
compiling pg.c
compiling pg_binary_decoder.c
compiling pg_binary_encoder.c
compiling pg_coder.c
compiling pg_connection.c
pg_connection.c:2394:3: warning: implicit declaration of function 'gettimeofday' is invalid in C99 [-Wimplicit-function-declaration]
gettimeofday(&currtime, NULL);
^
1 warning generated.
compiling pg_copy_coder.c
compiling pg_errors.c
compiling pg_result.c
compiling pg_text_decoder.c
compiling pg_text_encoder.c
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
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
linking shared-object pg_ext.bundle
ld: warning: directory not found for option '-L/Users/travis/.sm/pkg/active/lib'

make "DESTDIR=" install
make: /usr/local/bin/gmkdir: No such file or directory
make: *** [.RUBYARCHDIR.time] Error 1

make install failed, exit code 2

Gem files will remain installed in /Users/Doe/.rvm/gems/ruby-2.2.5/gems/pg-0.18.4 for inspection.
Results logged to /Users/Doe/.rvm/gems/ruby-2.2.5/extensions/x86_64-darwin-15/2.2.0-static/pg-0.18.4/gem_make.out
Using websocket-extensions 0.1.2
Using ttfunk 1.4.0
Installing unicode 0.4.4.2 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/Doe/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160804-32763-x50qoa.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling unicode.c
compiling ustring.c
compiling wstring.c
linking shared-object unicode/unicode_native.bundle
ld: warning: directory not found for option '-L/Users/travis/.sm/pkg/active/lib'

make "DESTDIR=" install
make: /usr/local/bin/gmkdir: No such file or directory
make: *** [.RUBYARCHDIR.-.unicode.time] Error 1

make install failed, exit code 2

Gem files will remain installed in /Users/Doe/.rvm/gems/ruby-2.2.5/gems/unicode-0.4.4.2 for inspection.
Results logged to /Users/Doe/.rvm/gems/ruby-2.2.5/extensions/x86_64-darwin-15/2.2.0-static/unicode-0.4.4.2/gem_make.out
Installing puma 3.4.0 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/Doe/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160804-32763-qkpn4m.rb extconf.rb
checking for BIO_read() in -lcrypto... yes
checking for SSL_CTX_new() in -lssl... yes
checking for openssl/bio.h... no
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling http11_parser.c
compiling io_buffer.c
compiling mini_ssl.c
compiling puma_http11.c
linking shared-object puma/puma_http11.bundle
ld: warning: directory not found for option '-L/Users/travis/.sm/pkg/active/lib'

make "DESTDIR=" install
make: /usr/local/bin/gmkdir: No such file or directory
make: *** [.RUBYARCHDIR.-.puma.time] Error 1

make install failed, exit code 2

Gem files will remain installed in /Users/Doe/.rvm/gems/ruby-2.2.5/gems/puma-3.4.0 for inspection.
Results logged to /Users/Doe/.rvm/gems/ruby-2.2.5/extensions/x86_64-darwin-15/2.2.0-static/puma-3.4.0/gem_make.out
Using rack-rewrite 1.5.1
Using ruby-graphviz 1.2.2
Installing redcarpet 3.3.4 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/Doe/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160804-32763-13tpibh.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling autolink.c
compiling buffer.c
buffer.c:111:45: warning: passing 'const struct buf *' to parameter of type 'struct buf *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
if (buf->size + 1 <= buf->asize || bufgrow(buf, buf->size + 1) == BUF_OK) {
^~~
buffer.c:60:21: note: passing argument to parameter 'buf' here
bufgrow(struct buf *buf, size_t neosz)
^
1 warning generated.
compiling houdini_href_e.c
compiling houdini_html_e.c
compiling html.c
compiling html_smartypants.c
compiling markdown.c
markdown.c:2838:43: warning: passing 'const uint8_t *' (aka 'const unsigned char *') to parameter of type 'uint8_t *' (aka 'unsigned char *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
if (codefences_enabled && (is_codefence(document + beg, doc_size - beg, NULL) != 0))
^~~~~~~~~~~~~~
markdown.c:1391:23: note: passing argument to parameter 'data' here
is_codefence(uint8_t *data, size_t size, struct buf *syntax)
^
1 warning generated.
compiling rc_markdown.c
compiling rc_render.c
compiling stack.c
linking shared-object redcarpet.bundle
ld: warning: directory not found for option '-L/Users/travis/.sm/pkg/active/lib'

make "DESTDIR=" install
make: /usr/local/bin/gmkdir: No such file or directory
make: *** [.RUBYARCHDIR.time] Error 1

make install failed, exit code 2

Gem files will remain installed in /Users/Doe/.rvm/gems/ruby-2.2.5/gems/redcarpet-3.3.4 for inspection.
Results logged to /Users/Doe/.rvm/gems/ruby-2.2.5/extensions/x86_64-darwin-15/2.2.0-static/redcarpet-3.3.4/gem_make.out
Using shoulda-context 1.2.1
Using slack-notifier 1.5.1
Using temple 0.7.7
Using spring 1.7.2
Installing stackprof 0.2.9 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/Doe/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160804-32763-26t53s.rb extconf.rb
checking for rb_postponed_job_register_one()... yes
checking for rb_profile_frames()... yes
checking for rb_tracepoint_new()... yes
checking for RUBY_INTERNAL_EVENT_NEWOBJ... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling stackprof.c
linking shared-object stackprof.bundle
ld: warning: directory not found for option '-L/Users/travis/.sm/pkg/active/lib'

make "DESTDIR=" install
make: /usr/local/bin/gmkdir: No such file or directory
make: *** [.RUBYARCHDIR.time] Error 1

make install failed, exit code 2

Gem files will remain installed in /Users/Doe/.rvm/gems/ruby-2.2.5/gems/stackprof-0.2.9 for inspection.
Results logged to /Users/Doe/.rvm/gems/ruby-2.2.5/extensions/x86_64-darwin-15/2.2.0-static/stackprof-0.2.9/gem_make.out
Using switch_user 1.3.0
Using vcr 3.0.3
Using faker 1.6.3
An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.

Answer

I figured out what I needed to do.

Referencing an answer on the json gem github, It seems running brew install coreutils solved all my issues revolving around this problem of mine.

Comments