I'm trying to install the ffi gem (so I can run Octopress) on my OS X Mountain Lion and am running into errors.
Running gem install install ffi -v '1.0.11' gives the following output:
/chetanshenoy.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include... no
checking for rb_thread_blocking_region()... yes
checking for ruby_native_thread_p()... yes
checking for rb_thread_call_with_gvl()... yes
creating extconf.h
creating Makefile
make
Configuring libffi
/Volumes/Secondary - HDD/Users/chetanshenoy/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/configure: line 642: test: too many arguments
/Volumes/Secondary - HDD/Users/chetanshenoy/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/configure: line 642: test: too many arguments
configure: WARNING: Libtool does not cope well with whitespace in `pwd`
cd "/Volumes/Secondary - HDD/Users/chetanshenoy/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi" && make
make "AR_FLAGS=" "CC_FOR_BUILD=" "CFLAGS=" "CXXFLAGS=" "CFLAGS_FOR_BUILD=" "CFLAGS_FOR_TARGET=" "INSTALL=/usr/bin/install -c" "INSTALL_DATA=/usr/bin/install -c -m 644" "INSTALL_PROGRAM=/usr/bin/install -c" "INSTALL_SCRIPT=/usr/bin/install -c" "JC1FLAGS=" "LDFLAGS=" "LIBCFLAGS=" "LIBCFLAGS_FOR_TARGET=" "MAKE=make" "MAKEINFO=/bin/sh "/Volumes/Secondary - HDD/Users/chetanshenoy/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/missing" --run makeinfo " "PICFLAG=" "PICFLAG_FOR_TARGET=" "RUNTESTFLAGS=" "SHELL=/bin/sh" "exec_prefix=/usr/local" "infodir=/usr/local/share/info" "libdir=/usr/local/lib" "prefix=/usr/local" "AR=ar" "AS=as" "CC=gcc-4.2" "CXX=c++" "LD=ld" "NM=/usr/bin/nm" "RANLIB=ranlib" "DESTDIR=" all-recursive
make[2]: *** No rule to make target `HDD/Users/chetanshenoy/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/missing --run makeinfo '. Stop.
make[1]: *** [all] Error 2
make: *** ["/Volumes/Secondary] Error 2
Any help is appreciated.
It looks like the ffi gem does not like spaces in paths also, as you checked already in the config it's not ruby using this paths, has to be something in the process of compiling the gem.
To make it compile you need to get rid of the spaces, there are few ways:
reinstall rvm in a path without spaces, first you need to change rvm_path location in ~/.rvmrc, this is the "safe" choice,
move rvm directly to the path pointed by rvm_path - sudo rm -rf /chetanshenoy.rvm && sudo mv "/Volumes/Secondary - HDD/Users/chetanshenoy/.rvm" /chetanshenoy.rvm - this should work as ruby has no record of the home directory, but it can not be sure the path with spaces is saved in any location - in case of problems use solution 1.
As stated in Issue with installing ImageMagick and rmagick on Mountain Lion, ffi appears to be configured to look for 'gcc-4.2', so once I updated my Apple command line tools (which I may or may not have needed to do), I created a symbolic link to make the ffi install configuration happy:
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
Related
I am trying to install byebug and it keeps giving me this error:
make: *** No rule to make target `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19/ruby/config.h', needed by `breakpoint.o'. Stop.
I tried to reinstall ruby and it did not work.
Any help appreciated.
I had the same error!
I just created a symbolic link:
cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0
ln -sf universal-darwin21 universal-darwin19
Now it is working fine.
Check which universal-darwin you have to point correctly.
I am trying to install "pam" on Windows. But starting
$ gem install pam
gives me
generating _pam-x64-mingw32.def
compiling pam_handle.c
In file included from pam_handle.c:5:0:
_pam.h:9:21: fatal error: version.h: No such file or directory
compilation terminated.
make: *** [pam_handle.o] Error 1
make failed, exit code 2
Ruby DevKit is installed and the Installation is checked with
$ gem install json --platform=ruby
$ ruby -rubygems -e "require 'json'; puts JSON.load('[42]').inspect"
[42]
I doubt that version.h is unix/linux specific. Has anybody managed to install this gem on Windows?
It looks like pam gem is not supported anymore.
https://rubygems.org/gems/pam says, that the latest release was about 10 years ago.
I'd offer you to consider using some newer replacements, and the most common advice is Use some unix-based OS for Ruby development, instead of windows.
I'm creating a Makefile for my project:
build:
sudo gem install sass
Any time I build it's asking me for my superuser password. If I remove sudo it will not install at all, but throw an error instead, as I don't have permissions to install a gem.
So I came up with an idea, that I want to check whether the gem already exists, and run installing command only when it doesn't.
So the question is how to perform this check inside Makefile.
From the command line you can see if a gem is installed with gem list <gemname>. This prints out a list of installed gems that match <gemname>:
$ gem list sass
*** LOCAL GEMS ***
sass (3.4.13, 3.4.1, 3.2.19)
sass-rails (5.0.1, 4.0.3)
The argument is actually a regex, so you can be more specific, checking e.g. only the Sass gem itself:
$ gem list \^sass\$
*** LOCAL GEMS ***
sass (3.4.13, 3.4.1, 3.2.19)
The -i flag to list makes it produce output more usable in scripts, printing true or false, and having a suitable exit status:
$ gem list \^sass\$ -i
true
$ echo $?
0
$ gem list \^notsass\$ -i
false
$ echo $?
1
You can combine this with Make’s conditionals, and the shell function (assuming GNU make) to check if a gem is installed from your makefile:
ifeq ($(shell gem list \^sass\$$ -i), false)
gem install sass
endif
(The extra $ is needed to prevent make trying to expand it as a variable.)
It's now traditional in the Ruby community to use Bundler to manage / install dependencies. This will install Gems without you having sudo privs, and also will keep different Ruby project's gems separate.
If you must install the gem raw, look into RVM or rbenv which both install Ruby and any future gems in your home directory. There' some logic you'd have to add to your Makefile to get it to use the new Ruby in your home folder (rbenv may make this easier than rvm, although Idon't know for sure)... but it's not hard.
One quick way to accomplish the task is writing an .rb script and execute it from a Makefile. The simplest script I came up with goes as follows:
#!/usr/bin/env ruby
if !Gem::Specification::find_all_by_name('sass').any?
exec("sudo gem install sass")
end
find_all_by_name is always returning an array and doesn't raise an error when it can't find anything (as find_by_name does).
Makefile:
default:
./install.rb
Make sure install.rb is executable:
chmod +x install.rb
Run it using make.
I'm trying to install gems to my new Ruby project using bundle install. I've set the version of Ruby using rbenv on my OS X 10.8.4 box. I get the following error:
An error occurred while installing atomic (1.1.13), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.13'` succeeds before bundling.
Kikime:jazzcatalog curt$ gem install atomic
Building native extensions. This could take a while...
Successfully installed atomic-1.1.13
1 gem installed
Kikime:jazzcatalog curt$ rbenv rehash
Kikime:jazzcatalog curt$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.7.9)
Installing atomic (1.1.13)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/curt/.rbenv/versions/2.0.0-p247/bin/ruby extconf.rb
/Users/curt/.rbenv/versions/2.0.0-p247/bin/ruby: invalid option -R (-h will show valid options) (RuntimeError)
Gem files will remain installed in /Volumes/Data RAID/htdocs/jazzcatalog/vendor/bundle/gems/atomic-1.1.13 for inspection.
Results logged to /Volumes/Data RAID/htdocs/jazzcatalog/vendor/bundle/gems/atomic- 1.1.13/ext/gem_make.out
An error occurred while installing atomic (1.1.13), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.13'` succeeds before bundling.
The first two lines are the end of the output from first attempt. As you can see, I then successfully installed atomic as requested. I then tried again and got the same error. I've seen a few errors with installing atomic, but none like this one. It seems to have a problem with the option -R. Since I didn't enter it in the first place, I don't know where to change it.
Update
I started all over rbenv set to version 2.0.0-p0 and and ran rails new jazz catalog -d mysql. It died at the same place with this error:
Installing atomic (1.1.13)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/curt/.rbenv/versions/2.0.0-p0/bin/ruby extconf.rb
creating Makefile
make
compiling atomic_reference.c
atomic_reference.c:50:9: warning: implicit declaration of function 'OSAtomicCompareAndSwap64' is invalid in C99 [-Wimplicit-function-declaration]
if (OSAtomicCompareAndSwap64(expect_value, new_value, &DATA_PTR(self))) {
^
1 warning generated.
linking shared-object atomic_reference.bundle
make install
/usr/bin/install -c -m 0755 atomic_reference.bundle /Volumes/Data RAID/htdocs/jazzcatalog/vendor/bundle/gems/atomic-1.1.13/lib
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 file2
install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 ... fileN directory
install -d [-v] [-g group] [-m mode] [-o owner] directory ...
make: *** [install-so] Error 64
Gem files will remain installed in /Volumes/Data RAID/htdocs/jazzcatalog/vendor/bundle/gems/atomic-1.1.13 for inspection.
Results logged to /Volumes/Data RAID/htdocs/jazzcatalog/vendor/bundle/gems/atomic- 1.1.13/ext/gem_make.out
An error occurred while installing atomic (1.1.13), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.13'` succeeds before bundling.
SOLVED
Sigh - does not handle spaces in path
I had this problem. It turned out to be caused by installing Mac OS 10.9 (Mavericks), since Mavericks has a new stand alone command line tools separate from Xcode. To solve this, I deleted /Applications/Xcode and then installed the stand alone command line tools via:
Note: First line may not be needed, see comments below
sudo rm -rf /Applications/Xcode
xcode-select --install
then click 'install' from the OSX pop up window
source:
http://www.computersnyou.com/2025/2013/06/install-command-line-tools-in-osx-10-9-mavericks-how-to/
For those who reach this page by googling, I solved a similar issue while Installing atomic (1.1.13) on mac this way:
sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2
It seems to be because of conflicting Xcode updates.
The error messages don't give the slightest clue as to what the real problem is. Bundler or a component it calls does not properly handle directory names with spaces in them. In my case it was .../Data RAID/... that caused the problem. Once I moved the project to a different drive where there would be no spaces in the path, everything worked fine. It appears it may be only the location of the gems that are the issue. In an earlier attempt, I created a project where the gems weren't located in a path containing spaces, but the project was. It didn't have any problems as far as I went with it. Notice also that the gem install atomic was successful.
If you're attempting to install Atomic (or bundle update - and that is failing on atomic), on Mac/OSX - you will need to install or update your command line tools for XCode for whatever OS version you are using.
As mentioned above, but I feel like that answer is a little esoteric. Atomic needs these tools for multithreading.
I was getting the same error message and it seems to have been caused by a (seemingly harmless yet erroneous) line in my Gemfile. When used correctly (on a system using RVM) these two lines should be able to use the correct version of Ruby and the desired gemset.
ruby '2.0.0'
#ruby-gemset=railstut_rails_4_0 ; ruby-2.0.0-p247#railstut_rails_4_0
I was under the impression that I was merely adding a comment with the second line- however RVM (by design/as expected) created a new gemset with a name "*railstut_rails_4_0 ; ruby-2.0.0-p247#railstut_rails_4_0*" that had spaces and special characters. Every time I ran bundle install - even after I changed the name inside the Gemfile - RVM loaded the current erroneous gemset. To resolve, I did the following:
$ rvm use ruby-2.0.0-p247#railstut_rails_4_0
Update Gemfile: The first two of the following lines for the benefit of RVM setup; followed by a comment for personal reference:
ruby '2.0.0'
#ruby-gemset=railstut_rails_4_0
#ruby-2.0.0-p247#railstut_rails_4_0
bundle install --without production
bundle update
bundle install
For those who got here by googling: I ran into something similar with atomic 1.1.14.
In my case it was actually Avast (anti-virus program) that wouldn't let me execute an atomic-specific file.
It was solved by excluding the file from Avast, and then run gem install atomic -v '1.1.14' again.
I'm using Mac OS Lion, and for resolve this problem i installed the new Command Line Tools.
Steps: Open XCode -> Downloads -> Install Command Line Tools.
Just it.
This 100% has to do with Spaces in the path. The error it spits out shows the attempted install path. Annoying error.
I'm getting an error message while trying to update my version of bluecloth gem on Windows. Is there a different version that I need to install for Windows or an alternative to bluecloth that I can use? Unfortunately my development environment is strictly Windows due to other software I work with, otherwise I'd use a Linux environment.
Here's a copy paste of what I get:
C:\Users\Developer1>gem update
Updating installed gems
Updating bluecloth
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing bluecloth:
ERROR: Failed to build gem native extension.
C:/Ruby192/bin/ruby.exe extconf.rb
checking for srand()... yes
checking for random()... no
checking for rand()... yes
checking for bzero() in string.h,strings.h... no
checking for strcasecmp()... yes
checking for strncasecmp()... yes
checking for mkdio.h... yes
checking for ruby/encoding.h... yes
creating extconf.h
creating Makefile
make
C:/Ruby192/bin/ruby -e "puts 'EXPORTS', 'Init_bluecloth_ext'" > bluecloth_ext-i386-mingw32.def
gcc -I. -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1
.9.1/ruby/backward -I/C/Ruby192/include/ruby-1.9.1 -I. -DRUBY_EXTCONF_H=\"extconf.h\" -DVERSION=\"2.0.9\" -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -I. -o bluecloth.o -c bluecloth.c
In file included from c:\ruby-devkit\mingw\bin../lib/gcc/mingw32/4.5.2/../../..
/../include/windows.h:48:0,
from c:\ruby-devkit\mingw\bin../lib/gcc/mingw32/4.5.2/../../..
/../include/winsock2.h:22,
from c:/Ruby192/include/ruby-1.9.1/ruby/win32.h:33,
from c:/Ruby192/include/ruby-1.9.1/ruby/defines.h:205,
from c:/Ruby192/include/ruby-1.9.1/ruby/ruby.h:74,
from c:/Ruby192/include/ruby-1.9.1/ruby.h:32,
from bluecloth.h:14,
from bluecloth.c:25:
c:\ruby-devkit\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/windef.h:2
29:23: error: duplicate 'unsigned'
c:\ruby-devkit\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/windef.h:2
38:23: error: duplicate 'unsigned'
c:\ruby-devkit\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/windef.h:2
38:23: error: two or more data types in declaration specifiers
c:\ruby-devkit\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/windef.h:2
41:24: error: duplicate 'unsigned'
make: * [bluecloth.o] Error 1
Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/bluecloth-2.2.0 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/bluecloth-2.2.0/ext/gem_make.out
Nothing to update
It seems the order in which headers are included in the C extension included in BlueCloth are blocking the compilation under Windows.
Applying the following patch:
https://gist.github.com/1539611
Compiles and works.
Perhaps you can report the issue to the gem author?
http://deveiate.org/projects/BlueCloth
https://github.com/ged/bluecloth
Hope that helps.
The header files in 2.2.0 prevents bluecloth from compile on windows. However, you can patch it by yourself. As Luis Lavena mentioned, you need to apply the path.
Run gem install bluecloth -v '2.2.0' if you haven't already
Apply this patch on bluecloth.h file, on my machine it is located in
H:\Ruby193\lib\ruby\gems\1.9.1\gems\bluecloth-2.2.0\ext\bluecloth.h
Go to bluecloth 2.2.0 directory, for example
H:\Ruby193\lib\ruby\gems\1.9.1\gems\bluecloth-2.2.0
Run rake gem (this may require to install some additional gems).
Then you should see .gem file created in
H:\Ruby193\lib\ruby\gems\1.9.1\gems\bluecloth-2.2.0\pkg\bluecloth-2.2.0.gem
Open this directory and install the patched gem:
gem install bluecloth-2.2.0.gem --platform=ruby