Error installing json 1.5.3 #78

Closed
georgeG opened this Issue Jun 24, 2011 · 23 comments

Comments

Projects
None yet

georgeG commented Jun 24, 2011

Using RVM
Mac OS X 10.6.7
Ruby 1.9.2

$ gem update json
Updating installed gems
Updating json
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.

    /Users/georgegithinji/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb

checking for re.h... no
checking for ruby/st.h... yes
creating Makefile

Do you have build tools installed?

georgeG commented Jun 30, 2011

Yes I have the build tools. Unless some new dependencies have been added in the new version? The previous version installed without any problem.

looking at the changes, it looks like the only ext change was v1.5.2...v1.5.3#diff-6

what patch level of Ruby are you using? and did gem install mention any logs for the ext install failure?

georgeG commented Jul 1, 2011

Am using Ruby-1.9.2-p180
This is the error log

checking for re.h... no
checking for ruby/st.h... yes
creating Makefile

make
gcc -I. -I/Users/user/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/x86_64-darwin10.6.0 -I/Users/user/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/backward -I/Users/user/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1 -I. -DHAVE_RUBY_ST_H -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch x86_64 -fno-common -pipe -O3 -Wall -o parser.o -c parser.c
gcc -dynamic -bundle -o parser.bundle parser.o -L. -L/Users/user/.rvm/rubies/ruby-1.9.2-p180/lib -L. -Wl,-syslibroot /Developer/SDKs/MacOSX10.6.sdk -arch x86_64 -L/usr/local/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -lruby.1.9.1 -lpthread -ldl -lobjc

make install
/opt/local/bin/gmkdir -p /Users/user/.rvm/gems/ruby-1.9.2-p180/gems/json-1.5.3/ext/json/ext/json/ext
make: /opt/local/bin/gmkdir: No such file or directory
make: *** [/Users/user/.rvm/gems/ruby-1.9.2-p180/gems/json-1.5.3/ext/json/ext/json/ext] Error 1

Problem seems to be the gmkdir?

Owner

flori commented Jul 2, 2011

I don't know how you try to install json, on mac "gem install json" should take care of everything needed. Can you show me exactly what you type in and what the output is? So far I can only see that you seem to use build tools that differ from the ones provided by Apple and are installed in /opt. Maybe this is the problem?

georgeG commented Jul 4, 2011

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

    /Users/user/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb

checking for re.h... no
checking for ruby/st.h... yes
creating Makefile

make
gcc -I. -I/Users/user/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/x86_64-darwin10.6.0 -I/Users/user/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/backward -I/Users/user/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1 -I. -DHAVE_RUBY_ST_H -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch x86_64 -fno-common -pipe -O3 -Wall -o parser.o -c parser.c
gcc -dynamic -bundle -o parser.bundle parser.o -L. -L/Users/user/.rvm/rubies/ruby-1.9.2-p180/lib -L. -Wl,-syslibroot /Developer/SDKs/MacOSX10.6.sdk -arch x86_64 -L/usr/local/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -lruby.1.9.1 -lpthread -ldl -lobjc

make install
/opt/local/bin/gmkdir -p /Users/user/.rvm/gems/ruby-1.9.2-p180/gems/json-1.5.3/ext/json/ext/json/ext
make: /opt/local/bin/gmkdir: No such file or directory
make: *** [/Users/user/.rvm/gems/ruby-1.9.2-p180/gems/json-1.5.3/ext/json/ext/json/ext] Error 1

Gem files will remain installed in /Users/user/.rvm/gems/ruby-1.9.2-p180/gems/json-1.5.3 for inspection.
Results logged to /Users/user/.rvm/gems/ruby-1.9.2-p180/gems/json-1.5.3/ext/json/ext/parser/gem_make.out

this is bigger than just installing json. I have the same issue installing json, cucumber and bcrypt-ruby and I haven't had much luck finding a solution... seems any gem that builds using "native extensions" fails

GeorgeG, I finally got mine to work. I had to use RVM to remove ruby, i.e. $ rvm remove 1.9.2 then I deleted all of the gems, and reinstalled 1.9.2 then the gems and they are working now.

ps json installed as expected as well good luck G

gem install json
Building native extensions. This could take a while...
Successfully installed json-1.5.3
1 gem installed

Owner

flori commented Jul 5, 2011

Does /opt/local/bin/gmkdir exist and can you run it if you call it directly? As far as I can interpret this Makefile run, make cannot execute gmkdir, because it doesn't exist or is a dangling symlink.

georgeG commented Jul 7, 2011

/opt/local/bin/gmkir does not exist. I really don't know why it is requested by the make process.

georgeG commented Jul 7, 2011

@doublebee that was quite hefty. There should be an explanation without doing a complete reinstall. I would want to know why even if re-install may turnout to be the only solution. Other gems seem to build fine on my system except json.

flori closed this Jul 7, 2011

GeorgeG, I am a total newb, the reinstall worked, but not really as I then figured out the reason, I was having the error was because I hadn't set a default Gemset to use with RVM so I was installing the gem into one gemset, but then using another and not seeing it. I read the RVM docs to learn how to set which ruby and gemset where defaults, then when I installed gems they would be in the gemset I was using and the issue went away for all gems. I was eager to help but yet, still very green :)

andxyz commented Aug 20, 2011

I had the same issue when installing RedCloth using rvm:
make: /opt/local/bin/gmkdir: No such file or directory

turns out my rvm was old and I updated it and I think it funked my ruby 1.9.2 so I had to remove and reinstall also.

alexch commented Oct 14, 2011

I bet this has to do with switching over from macports to homebrew. Some configuration setting is still pointing to /opt/local/ instead of /usr/local/. My solution:

sudo ln -s /usr/local/bin/gmkdir /opt/local/bin

(Repeat as necessary for other unfound binaries.)

I had this same issue with json 1.6.1 and ruby 1.9.2p290:

$ ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0]
$ gem install json -v '1.6.1'
Building native extensions.  This could take a while...
ERROR:  Error installing json:
    ERROR: Failed to build gem native extension.

        /Users/myles/.rbenv/versions/1.9.2-p290/bin/ruby extconf.rb
checking for re.h... no
checking for ruby/st.h... yes
creating Makefile

make
gcc -I. -I/Users/myles/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/x86_64-darwin11.1.0 -I/Users/myles/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/Users/myles/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1 -I. -DHAVE_RUBY_ST_H -I'/Users/myles/.rbenv/versions/1.9.2-p290/include'  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long  -pipe -O3 -Wall  -o parser.o -c parser.c
gcc -dynamic -bundle -o parser.bundle parser.o -L. -L/Users/myles/.rbenv/versions/1.9.2-p290/lib -L. -L'/Users/myles/.rbenv/versions/1.9.2-p290/lib'  -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace  -lpthread -ldl -lobjc 

make install
/usr/local/bin/gmkdir -p /Users/myles/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/json-1.6.1/ext/json/ext/json/ext
make: /usr/local/bin/gmkdir: No such file or directory
make: *** [/Users/myles/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/json-1.6.1/ext/json/ext/json/ext] Error 1


Gem files will remain installed in /Users/myles/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/json-1.6.1 for inspection.
Results logged to /Users/myles/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/json-1.6.1/ext/json/ext/parser/gem_make.out

Upgraded to ruby 1.9.3p0 and the gem installed fine:

$ ruby --version
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
$ gem install json -v '1.6.1'
Fetching: json-1.6.1.gem (100%)
Building native extensions.  This could take a while...
Successfully installed json-1.6.1

doolin commented Jan 21, 2013

For those of us preserving the sanctity of /usr/local, sudo port install coreutils worked just fine for me.

adg29 commented Jan 30, 2013

@realdoublebee's suggestion to remove ruby 1.9.2 and then install it again worked for me.

Ran into this issue today and it was indeed related to an old macports install. Solution from @alexch worked for me. Thanks! This blog post was also relevant: http://thoughtsthatleakedout.blogspot.com/2011/10/problem-with-gmkdir-when-updating-gems.html

mxchai commented Apr 2, 2015

@j1wilmot thanks for the link buddy. I cannot express how much gratitude I have towards you.

mtjhax commented May 13, 2016 edited

brew update; brew install coreutils was all it took for me after installing Ruby 2.2.5 with RVM and getting the same error on json (opening a new terminal window after that to make sure you have the latest environment does not hurt).

alexey commented Jul 8, 2016

had exactly the same situation like @mtjhax, thanks buddy for help!

Uoa, after 3hours of trying different things. I finally got to install compass.
Thank you @mtjhax!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment