Failed to build gem native extension mimemagic + rake failed, exit code 1 - ruby-on-rails

hi guys its actually my first install and I don't know what can I do?
this is the terminal response
I tried to update rake
I tried to install only mimemagic (just as terminal red text)

Related

Bundle install errors and cannot continue, even after installing missing gems

I am working on multiple Ruby on Rails applications and running...
MacOS 10.15.7,
Ruby 2.6.5,
Rails 5.2.3,
In a project app directory I am trying to run a bundle install and get the following error:
An error occurred while installing jaro_winkler (1.5.3), and Bundler cannot continue.
Make sure that `gem install jaro_winkler -v '1.5.3' --source
'https://.../api/gems/rubygems/'` succeeds before bundling.
I proceed to install the gem from the specified source and get confirmation of install
Building native extensions. This could take a while...
Successfully installed jaro_winkler-1.5.3
Parsing documentation for jaro_winkler-1.5.3
Done installing documentation for jaro_winkler after 0 seconds
1 gem installed
after running bundle install again, I will get the original error
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/private/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3/ext/jaro_winkler
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20210406-62421-10txxc5.rb extconf.rb
creating Makefile
current directory:
/private/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3/ext/jaro_winkler
make "DESTDIR=" clean
current directory:
/private/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3/ext/jaro_winkler
make "DESTDIR="
make: *** No rule to make target
`/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19/ruby/config.h',
needed by `adj_matrix.o'. Stop.
make failed, exit code 2
Gem files will remain installed in
/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3
for inspection.
Results logged to
/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/extensions/universal-darwin-19/2.6.0/jaro_winkler-1.5.3/gem_make.out
An error occurred while installing jaro_winkler (1.5.3), and Bundler cannot continue.
Make sure that `gem install jaro_winkler -v '1.5.3' --source
'https://.../api/gems/rubygems/'` succeeds before bundling.
The error message above doesn't give me any clear indication of what is happening. Additionally there is no such directory in the location where the message says "results logged to."
This seems to be happening in multiple application directories - but with different affected gems in each directory. They are all similar in that the error reads "make sure gem succeeds before bundling", then the gem install will succeed, and then the following bundle install will fail with the same original message.
Earlier today I did a clean Ruby 2.6.5 install and updated the Xcode CLI via xcode-select --install
If I run gem which jaro_winkler I get
/Users/{username}/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/jaro_winkler-1.5.3/lib/jaro_winkler.rb
Does anyone have any information on what could be causing this? I cannot do any bundle install without this happening. Please let me know if any more information is desired.
Thank you!
You mentioned that you are using ruby 2.6.5, but the gem is attempting to be installed in 2.6.0. Check that your Gemfile has the correct Ruby version in it.
When you ran gem which, it looks you are using rbenv. Make sure that you are using the correct Ruby version in there, too. Those rubies get installed in a different directory than xcode's. Sometimes there's a .rbenv file in the dir that will set the version as well.
Just some ideas. Hopefully something sticks.
Ended up being an issue with gem install location - export PATH="/usr/local/bin:$PATH" was previously added to my .bash_profile and this was effecting where gems were installed.
Somewhere in the error message /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby is mentioned - this is the "system default" Mac version of Ruby and is not the Ruby version I was intending to use with .rbenv ( 2.6.5 ) and gem installs.
Removing the export mentioned above help resolve the issue.
edit- wording

AWS Codebuild error while installing SASSC gem wrong ruby version

I'm running a Codestar project. Sample app installs fine. When I add my application in with SASSC get failure, because of Ruby version. Is there away to notify CodeBuild to upgrade Ruby version? tried looking through buildspec.yml am I anywhere close? trying to google.
In middle of build logs
Installing sassc 2.0.0 with native extensions
Gem::InstallError: sassc requires Ruby version >= 2.3.3.
At end of build logs
An error occurred while installing sassc (2.0.0), and Bundler cannot continue.
Make sure that `gem install sassc -v '2.0.0'` succeeds before bundling.
[Container] 2018/12/31 04:17:42 Command did not exit successfully bundle install exit status 5
[Container] 2018/12/31 04:17:42 Phase complete: INSTALL Success: false
[Container] 2018/12/31 04:17:42 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: bundle install. Reason: exit status 5
thanks.
I changed Codebuild environment from AWS Linux distro to Ubuntu with Ruby 2.5.3 which fixed my problem. Unless someone has a better answer.

Cannot Bundle Install due to an error compiling Unf_ext '

I'm trying to install Huginn on a raspberry pi 3 running Debian Jesse (arm). Bundle install fails while trying to install unf_ext:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /tmp/bundler20161007-16062-unp7l7unf_ext-0.0.7.1/gems/unf_ext-0.0.7.1/ext/unf_ext
/usr/bin/ruby2.3 -r ./siteconf20161007-16062-wdgukt.rb extconf.rb
When I try: sudo gem install unf_ext -v '0.0.7.1' I get the following error:
current directory: /tmp/bundler20161007-16062-unp7l7unf_ext-0.0.7.1/gems/unf_ext-0.0.7.1/ext/unf_ext
make "DESTDIR="
compiling unf.cc
In file included from unf/normalizer.hh:10:0,
from unf.cc:1:
unf/table.hh:13539:25: error: narrowing conversion of ‘-27’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
-77, -39,-124, -39,-123};
The above is followed by a very long list of err: narrowing conversion of ## from int to char inside {} [-Wnarrowing] errors
I am compiling with: 6.1.1 20160802 (Raspbian 6.1.1-11+rpi1)
I tried gem update, but that didn't help. Nor did adding flags in ext/unf_ext/extconf.rb
+$CXXFLAGS += " -fsigned-char "
+
I'm a beginner with all of this, so any help would be greatly appreciated. Thanks.
NOTE: I've published my gem on Github to save people the effort of making their own. If you want to use mine, then just run these two commands:
wget https://github.com/appleorange1/unf_ext-0.0.6-arm/raw/master/unf_ext-0.0.6.gem
gem install ./unf_ext-0.0.6.gem
If you want to find out how I did this, keep reading:
I've was having this problem too (on a Chromebook C201PA). The issue is that your changes to ext/unf_ext/extconf.rb keep getting overwritten when you run "gem install". I'm not sure why this is, but I got around this problem by creating a local gem.
To do this, download the upstream gem version you want from this page. I used version 0.0.6.
Then, unpack the upstream gem:
gem unpack unf_ext-0.0.6.gem
After you've extracted the upstream gem, rename it so that you don't confuse it with your local gem. (You don't have to do this; it's just a suggestion.)
mv unf_ext-0.0.6.gem unf_ext-0.0.6-upstream.gem
Now, move into the unpacked gem.
cd unf_ext-0.0.6
Then, add the line $CXXFLAGS += ' -fsigned-char' to the file ext/unf_ext/extconf.rb. (I put it on the third line, just under have_library('stdc++').)
vi ext/unf_ext/extconf.rb
Then, you can build and install the gem:
gem build unf_ext.gemspec
gem install ./unf_ext-0.0.6.gem
I had a similar error with a later version bundled within a Rails project's Gemfile.lock:
bundle install
which called:
gem install unf_ext -v '0.0.7.2'
I was able to modify the Gemfile.lock and change the unf_ext version to 0.0.7.4; the unf_ext library has been updated in April 2017 to include ARM processor support. Read the GitHub issue here.
This is not as comprehensive as obscurityenthusiast's answer and could potentially break your solution. Do not change locked version strings without careful consideration.

event machine gem bundle install is not working

I am following a tutorial and had to do a bundle install following the forking & cloning of a repository. Subsequently we are instructed to run bundle install. However, it is not working and I am getting the following error message:
make
generating rubyeventmachine-i386-mingw32.def
compiling binder.cpp
In file included from binder.cpp:20:0:
project.h:85:0: warning: "FD_SETSIZE" redefined
<command-line>:0:0: note: this is the location of the previous definition
compiling cmain.cpp
In file included from cmain.cpp:20:0:
project.h:85:0: warning: "FD_SETSIZE" redefined
<command-line>:0:0: note: this is the location of the previous definition
cmain.cpp: In function 'int evma_send_file_data_to_connection(long unsigned int,
const char*)':
cmain.cpp:752:6: error: 'fstati64' was not declared in this scope
make: *** [cmain.o] Error 1
Gem files will remain installed in c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0
.0/gems/eventmachine-0.12.10 for inspection.
Results logged to c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/eventmach
ine-0.12.10/ext/gem_make.out
An error occurred while installing eventmachine (0.12.10), and Bundler cannot
continue.
Make sure that `gem install eventmachine -v '0.12.10'` succeeds before bundling.
I'm rather stuck on what to do at this point. I am on a Windows machine, any advice on how to troubleshoot this?
Try gem install eventmachine -v '0.12.10' Or sudo gem install eventmachine -v '0.12.10' and then retry bundle install.
Some gem needs sudo privileges to install.
For windows gem install eventmachine --pre. Its a known issue for window with ruby 1.9. https://github.com/eventmachine/eventmachine/issues/319
I was able to fix this by installing the latest version of the Eventmachine gem: https://rubygems.org/gems/eventmachine
And then subsequently instaling the latest version of the SQLite gem:
http://rubygems.org/gems/sqlite3-ruby
You might be prompted to update your Gemlockfile make sure to do that then everything else should work.

Using rails-composer, getting error based on builder version

I'm trying to use rails-composer to start a project. Right after composer installs the gems I get an error and the script stops. Here is the error:
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
composer Running 'after bundler' callbacks.
The template [https://raw.github.com/RailsApps/rails-composer/master/composer.rb] could not be loaded. Error: You have already activated builder 3.0.0, but your Gemfile requires builder 3.0.2. Using bundle exec may solve this.
I'm not sure how to use bundle exec to solve this.
Do this in your commandline
gem install builder --version '3.0.2'
& then try to use rails-composer

Resources